Revisions improvements
Revert mouse dragging code which was accidentally removed in [24565]. see #24425. git-svn-id: http://core.svn.wordpress.org/trunk@24575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b95c432870
commit
e90986ae62
|
@ -645,6 +645,25 @@ window.wp = window.wp || {};
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function( event, ui ) {
|
start: function( event, ui ) {
|
||||||
|
if ( this.model.get( 'compareTwoMode' ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Track the mouse position to enable smooth dragging,
|
||||||
|
// overrides default jQuery UI step behaviour.
|
||||||
|
$( window ).on( 'mousemove', { slider: this }, function( e ) {
|
||||||
|
var slider = e.data.slider,
|
||||||
|
sliderLeft = slider.$el.offset().left,
|
||||||
|
sliderRight = sliderLeft + slider.$el.width();
|
||||||
|
|
||||||
|
// Follow mouse movements, as long as handle remains inside slider.
|
||||||
|
if ( e.clientX < sliderLeft ) {
|
||||||
|
$( ui.handle ).css( 'left', 0 ); // Mouse to left of slider.
|
||||||
|
} else if ( e.clientX > sliderRight ) {
|
||||||
|
$( ui.handle ).css( 'left', sliderRight - sliderLeft); // Mouse to right of slider.
|
||||||
|
} else {
|
||||||
|
$( ui.handle ).css( 'left', e.clientX - sliderLeft ); // Mouse in slider.
|
||||||
|
}
|
||||||
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
|
@ -679,6 +698,8 @@ window.wp = window.wp || {};
|
||||||
if ( this.model.get( 'compareTwoMode' ) )
|
if ( this.model.get( 'compareTwoMode' ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$( window ).off( 'mousemove' );
|
||||||
|
|
||||||
// Reset settings props handle back to the step position.
|
// Reset settings props handle back to the step position.
|
||||||
this.settings.trigger( 'change' );
|
this.settings.trigger( 'change' );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue