jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/371622 )

Change subject: Fix unnecessary reloading of diff
......................................................................


Fix unnecessary reloading of diff

Currently, when dragging a pointer over another revision but not
releasing it until it is at the same location, the diff still reloads
This change stores the initial positions and comparing at the end.

Bug: T163425
Change-Id: I430650d12bfeb3ce4af59abe91f18cc2b861a3de
---
M modules/ext.RevisionSlider.SliderView.js
1 file changed, 17 insertions(+), 0 deletions(-)

Approvals:
  WMDE-Fisch: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ext.RevisionSlider.SliderView.js 
b/modules/ext.RevisionSlider.SliderView.js
index 75a5691..bdf5c38 100644
--- a/modules/ext.RevisionSlider.SliderView.js
+++ b/modules/ext.RevisionSlider.SliderView.js
@@ -85,6 +85,16 @@
 
                escapePressed: false,
 
+               /**
+                * {number}
+                */
+               lastOldPointerPosition: null,
+
+               /**
+                * {number}
+                */
+               lastNewPointerPosition: null,
+
                render: function ( $container ) {
                        var containerWidth = 
this.calculateSliderContainerWidth(),
                                $revisions = 
this.slider.getRevisions().getView().render( this.revisionWidth ),
@@ -419,6 +429,8 @@
                                        self.setPointerDragCursor();
                                        self.fadeOutPointerLines();
                                        self.escapePressed = false;
+                                       self.lastOldPointerPosition = 
self.getOlderPointerPos();
+                                       self.lastNewPointerPosition = 
self.getNewerPointerPos();
                                },
                                stop: function () {
                                        var $p = $( this ),
@@ -445,6 +457,11 @@
                                                $revisions, 
self.getOlderPointerPos()
                                        ).data( 'revid' );
 
+                                       if ( self.getNewerPointerPos() === 
self.lastNewPointerPosition &&
+                                               self.getOlderPointerPos() === 
self.lastOldPointerPosition ) {
+                                               return;
+                                       }
+
                                        self.refreshDiffView( diff, oldid, true 
);
                                        self.alignPointersAndLines( 0 );
                                        
self.resetRevisionStylesBasedOnPointerPosition( $revisions );

-- 
To view, visit https://gerrit.wikimedia.org/r/371622
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I430650d12bfeb3ce4af59abe91f18cc2b861a3de
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/RevisionSlider
Gerrit-Branch: master
Gerrit-Owner: MtDu <justin.d...@gmail.com>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Andrew-WMDE <andrew.kos...@wikimedia.de>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: WMDE-Fisch <christoph.jau...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to