Sliding now triggers goToRevision.

This commit is contained in:
s1341 2013-12-16 14:17:10 +02:00
parent 676ff3f436
commit b8591edc8d
2 changed files with 4 additions and 1 deletions

View file

@ -58,6 +58,7 @@ $.Class("RevisionSlider",
}, },
onSlide: function (value) { onSlide: function (value) {
console.log("in slide handler:", value); console.log("in slide handler:", value);
this.goToRevision(value);
}, },
loadElements: function (root_element) { loadElements: function (root_element) {
this.elements.root = root_element; this.elements.root = root_element;

View file

@ -136,14 +136,16 @@ $.Class("SliderUI",
if (_this.current_value != start_value) { if (_this.current_value != start_value) {
//_this.setValue(start_value); //_this.setValue(start_value);
} }
var prev_value = start_value;
$(document).on("mousemove.slider", function (event) { $(document).on("mousemove.slider", function (event) {
var current_value = Math.floor((event.clientX-_this.element.offset().left) / _this._getStep()); var current_value = Math.floor((event.clientX-_this.element.offset().left) / _this._getStep());
console.log("sliderbar mousemove, value:", current_value); console.log("sliderbar mousemove, value:", current_value);
// don't change the value if it hasn't actually changed! // don't change the value if it hasn't actually changed!
if (_this.current_value != current_value) { if (prev_value != current_value) {
//_this.setValue(current_value); //_this.setValue(current_value);
_this._trigger("slide", current_value); _this._trigger("slide", current_value);
prev_value = current_value;
} }
}); });