mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 03:33:45 +00:00
Merge "Tooltips when hovering slider lines in the SliderViewTwo"
This commit is contained in:
commit
bf4cd0da02
|
@ -78,6 +78,11 @@
|
|||
*/
|
||||
dir: null,
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
isDragged: false,
|
||||
|
||||
render: function ( $container ) {
|
||||
var containerWidth = this.calculateSliderContainerWidth(),
|
||||
$revisions = this.slider.getRevisions().getView().render( this.revisionWidth ),
|
||||
|
@ -210,6 +215,7 @@
|
|||
grid: [ this.revisionWidth, null ],
|
||||
containment: containmentClass,
|
||||
start: function() {
|
||||
self.isDragged = true;
|
||||
self.setPointerDragCursor();
|
||||
self.fadeOutPointerLines();
|
||||
escapePressed = false;
|
||||
|
@ -220,6 +226,7 @@
|
|||
pointer = self.whichPointer( $p ),
|
||||
revId1, revId2;
|
||||
|
||||
self.isDragged = false;
|
||||
self.removePointerDragCursor();
|
||||
|
||||
if ( escapePressed ) {
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
renderPointerContainer: function( containerWidth ) {
|
||||
var pointerContainerPosition = 53,
|
||||
pointerContainerWidth = containerWidth + this.revisionWidth - 1,
|
||||
pointerContainerStyle;
|
||||
pointerContainerStyle, lastMouseMoveRevisionPos,
|
||||
self = this;
|
||||
|
||||
pointerContainerStyle = { left: pointerContainerPosition + 'px', width: pointerContainerWidth + 'px' };
|
||||
if ( this.dir === 'rtl' ) {
|
||||
|
@ -37,7 +38,15 @@
|
|||
return $( '<div>' )
|
||||
.addClass( 'mw-revslider-pointer-container' )
|
||||
.css( pointerContainerStyle )
|
||||
.append( this.renderPointerContainers() );
|
||||
.append( this.renderPointerContainers() )
|
||||
.mousemove( function( event ) {
|
||||
if ( !self.isDragged ) {
|
||||
lastMouseMoveRevisionPos = self.showTooltipsOnMouseMoveHandler(
|
||||
event,
|
||||
lastMouseMoveRevisionPos
|
||||
);
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
renderPointerContainers: function() {
|
||||
|
@ -135,6 +144,20 @@
|
|||
.removeClass( 'mw-revslider-pointer-grabbing' );
|
||||
},
|
||||
|
||||
showTooltipsOnMouseMoveHandler: function( event, lastValidPosition ) {
|
||||
var pos = this.getRevisionPositionFromLeftOffset( event.pageX ),
|
||||
$hoveredRevisionWrapper;
|
||||
|
||||
if ( pos === lastValidPosition ) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
$hoveredRevisionWrapper = this.getRevElementAtPosition( this.getRevisionsElement(), pos ).parent();
|
||||
this.slider.getRevisions().getView().showTooltip( $hoveredRevisionWrapper );
|
||||
|
||||
return pos;
|
||||
},
|
||||
|
||||
sliderLineClickHandler: function( event, $line ) {
|
||||
var pos = this.getRevisionPositionFromLeftOffset( event.pageX ),
|
||||
$clickedRev, pointerMoved, pointerOther, $revisions;
|
||||
|
|
Loading…
Reference in a new issue