Skip to main content

Search and Top Navigation

#6797 closed bug (duplicate)

Opened January 01, 2011 04:37PM UTC

Closed January 03, 2011 01:34PM UTC

Last modified January 03, 2011 01:34PM UTC

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 ) || 0 ) -

( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +

( parseInt( closestHandle.css("marginTop"), 10 ) || 0)

};

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

this._slide( event, index, normValue );

}

this._animateOff = true;

return true;

},

Attachments (0)
Change History (3)

Changed January 01, 2011 04:40PM UTC by velocityzen comment:1

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

theoretically works with many handles.

Changed January 03, 2011 01:34PM UTC by scottgonzalez comment:2

resolution: → duplicate
status: newclosed

Changed January 03, 2011 01:34PM UTC by scottgonzalez comment:3

Duplicate of #3736.