WordPress.org

Make WordPress Core

Changeset 24575


Ignore:
Timestamp:
07/05/2013 10:54:17 PM (8 years ago)
Author:
ocean90
Message:

Revisions improvements

Revert mouse dragging code which was accidentally removed in [24565].

see #24425.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/revisions.js

    r24565 r24575  
    646646
    647647        start: function( event, ui ) {
     648            if ( this.model.get( 'compareTwoMode' ) )
     649                return;
     650
     651            // Track the mouse position to enable smooth dragging,
     652            // overrides default jQuery UI step behaviour.
     653            $( window ).on( 'mousemove', { slider: this }, function( e ) {
     654                var slider = e.data.slider,
     655                    sliderLeft = slider.$el.offset().left,
     656                    sliderRight = sliderLeft + slider.$el.width();
     657
     658                // Follow mouse movements, as long as handle remains inside slider.
     659                if ( e.clientX < sliderLeft ) {
     660                    $( ui.handle ).css( 'left', 0 ); // Mouse to left of slider.
     661                } else if ( e.clientX > sliderRight ) {
     662                    $( ui.handle ).css( 'left', sliderRight - sliderLeft); // Mouse to right of slider.
     663                } else {
     664                    $( ui.handle ).css( 'left', e.clientX - sliderLeft ); // Mouse in slider.
     665                }
     666            } );
    648667        },
    649668
     
    680699                return;
    681700
     701            $( window ).off( 'mousemove' );
     702
    682703            // Reset settings props handle back to the step position.
    683704            this.settings.trigger( 'change' );
Note: See TracChangeset for help on using the changeset viewer.