Skip to content

Commit

Permalink
updating pull request inline of szimek's request to delete duplicate …
Browse files Browse the repository at this point in the history
…methods in slider.js - great find
  • Loading branch information
jonobr1 committed Mar 26, 2011
1 parent d249ca6 commit f95262f
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions controllers/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,6 @@ GUI.Slider = function(numberController, min, max, step, initValue) {
this.fg.style.width = pct+"%";
});

var onDrag = function(e) {
if (!clicked) return;
var pos = findPos(_this.domElement);
var val = GUI.map(e.pageX, pos[0], pos[0] + _this.domElement.offsetWidth, min, max);
val = Math.round(val/step)*step;
numberController.setValue(val);
};

this.domElement.addEventListener('mousedown', function(e) {
clicked = true;
x = px = e.pageX;
_this.domElement.setAttribute('class', 'guidat-slider-bg active');
_this.fg.setAttribute('class', 'guidat-slider-fg active');
onDrag(e);
document.addEventListener('mouseup', mouseup, false);
}, false);

var mouseup = function(e) {
_this.domElement.setAttribute('class', 'guidat-slider-bg');
_this.fg.setAttribute('class', 'guidat-slider-fg');
clicked = false;
if (numberController.finishChangeFunction != null) {
numberController.finishChangeFunction.call(this, numberController.getValue());
}
document.removeEventListener('mouseup', mouseup, false);
};

document.addEventListener('mousemove', onDrag, false);

this.value = initValue;
Expand Down

0 comments on commit f95262f

Please sign in to comment.