diff --git a/src/main/webapp/scripts/widgets/slider-widget.js b/src/main/webapp/scripts/widgets/slider-widget.js index 5717d0f74..6a0138ef6 100644 --- a/src/main/webapp/scripts/widgets/slider-widget.js +++ b/src/main/webapp/scripts/widgets/slider-widget.js @@ -11,6 +11,14 @@ function SliderWidget(elmt, options) { }; this._drag = null; + var self = this; + this._mouseMoveHandler = function(evt) { + return self._onMouseMove(evt); + }; + this._mouseUpHandler = function(evt) { + return self._onMouseUp(evt); + }; + this._initializeUI(); this._update(); } @@ -71,16 +79,23 @@ SliderWidget.prototype._onMouseDown = function(evt, part) { return; } + $(document).mousemove(this._mouseMoveHandler); + $(document).mouseup(this._mouseUpHandler); + this._drag = { - sureDrag: false + sureDrag: false, + overlay: $('
').addClass("slider-widget-overlay").appendTo(document.body) }; if ("highlight" == part) { this._drag.elmt = this._highlightRect; this._drag.value = this._range.from; + $(this._drag.overlay).css("cursor", "move"); } else if ("left" == part) { this._drag.elmt = this._leftBracket; + $(this._drag.overlay).css("cursor", "e-resize"); } else if ("right" == part) { this._drag.elmt = this._rightBracket; + $(this._drag.overlay).css("cursor", "w-resize"); } this._drag.what = part; this._drag.from = this._range.from; @@ -96,10 +111,14 @@ SliderWidget.prototype._onMouseUp = function(evt) { return; } + $(document).unbind("mousemove", this._mouseMoveHandler); + $(document).unbind("mouseup", this._mouseUpHandler); + if (this._drag.sureDrag) { this._update(); this._trigger("stop"); } + this._drag.overlay.remove(); this._drag = null; }; diff --git a/src/main/webapp/styles/widgets/slider-widget.css b/src/main/webapp/styles/widgets/slider-widget.css index c0a03ebeb..315cbc0a9 100644 --- a/src/main/webapp/styles/widgets/slider-widget.css +++ b/src/main/webapp/styles/widgets/slider-widget.css @@ -43,3 +43,12 @@ margin-left: 2px; cursor: w-resize; } +.slider-widget-overlay { + position: fixed; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + background: white; + opacity: 0.01; +} \ No newline at end of file