|
103 | 103 | }); |
104 | 104 | var val = normValueFromMouse(me, position, obj); |
105 | 105 | var pixmouse = getPixelMouse(me, position, false); |
| 106 | + |
106 | 107 | var isAtEnd = !mouseOverHandle && (!me.isScrollBar ? 0 : |
107 | 108 | pixmouse < 5 ? -1 : pixmouse > getPixelTotal(me) - 5 ? 1 : 0); |
108 | | - |
109 | 109 | if (isAtEnd) { |
110 | 110 | me.element.addClass(me.orientation === "horizontal" ? |
111 | 111 | (isAtEnd == 1 ? "ui-j2sslider-at-right" : "ui-j2sslider-at-left") |
|
162 | 162 | } |
163 | 163 |
|
164 | 164 | var getPixelTotal = function(me) { |
165 | | - return (me.orientation == "horizontal" ? width(me) : height(me)) || 100; |
| 165 | + return (me.orientation == "horizontal" ? width(me) : height(me)) - me.visibleAdjust || 100; |
166 | 166 | } |
167 | 167 |
|
168 | 168 | var postMouseEvent = function(me, xye, id) { |
|
229 | 229 | this._mouseInit(); |
230 | 230 | this.isScrollBar = o.isScrollBar; |
231 | 231 | this.handleSize = 0; // scrollbar only |
| 232 | + this.visibleAmount = 0; |
| 233 | + this.visibleAdjust = 0; |
| 234 | + this.visibleFraction = 0; |
232 | 235 | this.handleFraction = 0; |
233 | 236 | this.marginX = (o.isScrollBar ? 0 : 19); // from CSS - margin * 2 + border |
234 | 237 | this.marginY = (o.isScrollBar ? 0 : 0); |
|
595 | 598 | this._refreshValue(); |
596 | 599 | this._animateOff = false; |
597 | 600 | break; |
598 | | - case "handleSize": |
| 601 | + case "visibleAmount": |
599 | 602 | this.isScrollBar = true; |
600 | | - this.handleFraction = value; |
| 603 | + this.visibleAmount = value; |
| 604 | + var min = this._valueMin(); |
| 605 | + var max = this._valueMax(); |
| 606 | + var f = (value >= 0 && min + value <= max ? |
| 607 | + value * 1 / (max - min) : 0.1); |
| 608 | + this.visibleFraction = f; |
| 609 | + if (f < 0.1) |
| 610 | + f = 0.1; |
| 611 | + this.handleFraction = f; |
| 612 | + var hw = (this.orientation === "horizontal" ? width(this) : height(this)); |
601 | 613 | if (this.orientation === "horizontal") |
602 | | - $(this.handles[0]).width(this.handleSize = value * width(this)); |
| 614 | + $(this.handles[0]).width(this.handleSize = f * hw); |
603 | 615 | else |
604 | | - $(this.handles[0]).height(this.handleSize = value * height(this)); |
| 616 | + $(this.handles[0]).height(this.handleSize = f * hw); |
| 617 | + this.visibleAdjust = (f - this.visibleFraction) * hw; |
605 | 618 | this._animateOff = true; |
606 | 619 | this._resetClass(); |
607 | 620 | this._refreshValue(); |
|
655 | 668 | if (val <= this._valueMin()) { |
656 | 669 | return this._valueMin(); |
657 | 670 | } |
658 | | - var max = Math.round((this._valueMax() - this._valueMin()) * (1-this.handleFraction) + this._valueMin()); |
| 671 | + var max = Math.round(this._valueMax() - this.visibleAmount); //* (1-this.handleFraction) |
659 | 672 | if (val >= max) { |
660 | 673 | return max; |
661 | 674 | } |
|
696 | 709 | }, |
697 | 710 |
|
698 | 711 | _refreshValue : function() { |
699 | | - var lastValPercent, valPercent, value, valueMin, valueMax, oRange = this.options.range, o = this.options, that = this, animate = (!this._animateOff) ? o.animate |
700 | | - : false, _set = {}; |
| 712 | + var lastValPercent, valPercent, value, valueMin, valueMax; |
| 713 | + var o = this.options; |
| 714 | + var oRange = o.range; |
| 715 | + var that = this; |
| 716 | + var animate = (!this._animateOff) ? o.animate : false; |
| 717 | + var _set = {}; |
701 | 718 | if (this.options.values |
702 | 719 | && this.options.values.length) { |
703 | 720 | this.handles |
|
0 commit comments