Revisions: Have the tooltip follow the "from" scrubber handle when that is the one being moved, in compare-two mode.

See #24425.

git-svn-id: http://core.svn.wordpress.org/trunk@24678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-07-12 17:25:27 +00:00
parent cf02b10d4b
commit 9694d47bcf
1 changed files with 7 additions and 9 deletions

View File

@ -827,7 +827,7 @@ window.wp = window.wp || {};
// Responds to slide events // Responds to slide events
slide: function( event, ui ) { slide: function( event, ui ) {
var attributes; var attributes, movedRevision;
// Compare two revisions mode // Compare two revisions mode
if ( ! _.isUndefined( ui.values ) && this.model.get('compareTwoMode') ) { if ( ! _.isUndefined( ui.values ) && this.model.get('compareTwoMode') ) {
// Prevent sliders from occupying same spot // Prevent sliders from occupying same spot
@ -838,28 +838,26 @@ window.wp = window.wp || {};
to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[0] - 1 : ui.values[1] ), // Reverse directions for RTL. to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[0] - 1 : ui.values[1] ), // Reverse directions for RTL.
from: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[1] - 1 : ui.values[0] ) // Reverse directions for RTL. from: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[1] - 1 : ui.values[0] ) // Reverse directions for RTL.
}; };
movedRevision = ! isRtl && ui.value === ui.values[0] ? attributes.from : attributes.to;
} else { } else {
// Compare single revision mode // Compare single revision mode
var sliderPosition = this.getSliderPosition( ui ); var sliderPosition = this.getSliderPosition( ui );
attributes = { attributes = {
to: this.model.revisions.at( sliderPosition ) to: this.model.revisions.at( sliderPosition )
}; };
movedRevision = attributes.to;
// If we're at the first revision, unset 'from'. // If we're at the first revision, unset 'from'.
if ( sliderPosition ) // Reverse directions for RTL. if ( sliderPosition ) // Reverse directions for RTL.
attributes.from = this.model.revisions.at( sliderPosition - 1 ); attributes.from = this.model.revisions.at( sliderPosition - 1 );
else else
attributes.from = undefined; attributes.from = undefined;
} }
this.model.set( attributes );
// If we are scrubbing, a scrub to a revision is considered a hover // If we are scrubbing, a scrub to a revision is considered a hover
if ( this.model.get( 'scrubbing' ) ) { if ( this.model.get('scrubbing') )
this.model.set({ attributes.hoveredRevision = movedRevision;
'hoveredRevision': attributes.to
}); this.model.set( attributes );
}
}, },
stop: function( event, ui ) { stop: function( event, ui ) {