Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6797 closed bug (duplicate)

Handles can't slide to right, when they in one position.

Reported by: velocityzen Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.slider Version: 1.8.7
Keywords: Cc:
Blocked by: Blocking:

Description

I'm solve this:

_mouseCapture: function( event ) {

var o = this.options,

position, normValue,

distance, minDistance, maxDistance, closestHandle,

self, index, allowed, offset, mouseOverHandle;

if ( o.disabled ) {

return false;

}

this.elementSize = {

width: this.element.outerWidth(), height: this.element.outerHeight()

}; this.elementOffset = this.element.offset();

position = { x: event.pageX, y: event.pageY }; normValue = this._normValueFromMouse( position ); distance = minDistance = maxDistance = this._valueMax() - this._valueMin() + 1; self = this;

this.handles.each(function( i ) {

var thisDistance = normValue - self.values(i);

if (thisDistance < 0) {

thisDistance = Math.abs(thisDistance);

if ( (minDistance > thisDistance) && (thisDistance < maxDistance) ) {

minDistance = distance = thisDistance; closestHandle = $( this ); index = i;

}

} else {

if ( (maxDistance >= thisDistance) && (thisDistance <= minDistance) ) { maxDistance = distance = thisDistance; closestHandle = $( this ); index = i;

}

}

});

allowed = this._start( event, index ); if ( allowed === false ) {

return false;

} this._mouseSliding = true;

self._handleIndex = index;

closestHandle

.addClass( "ui-state-active" ) .focus();

offset = closestHandle.offset(); mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {

left: event.pageX - offset.left - ( closestHandle.width() / 2 ), top: event.pageY - offset.top -

( closestHandle.height() / 2 ) -

( parseInt( closestHandle.css("borderTopWidth"), 10 ) ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) ( parseInt( closestHandle.css("marginTop"), 10 )
0 ) -
0) +
0)

};

if ( !this.handles.hasClass( "ui-state-hover" ) ) {

this._slide( event, index, normValue );

} this._animateOff = true; return true;

},

Change History (3)

comment:1 Changed 9 years ago by velocityzen

only need to change this.handles.each function in _mouseCapture and add minDistance, maxDistance vars. theoretically works with many handles.

comment:2 Changed 9 years ago by Scott González

Resolution: duplicate
Status: newclosed

comment:3 Changed 9 years ago by Scott González

Duplicate of #3736.

Note: See TracTickets for help on using tickets.