Tpt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101679


Change subject: Activate zoom on mouse wheel only when the user have 
double-clicked
......................................................................

Activate zoom on mouse wheel only when the user have double-clicked

Change-Id: I9c58ad45a141e03c1bde3d681d6b144441c75e45
---
M modules/jquery/jquery.prpZoom.js
1 file changed, 22 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/79/101679/1

diff --git a/modules/jquery/jquery.prpZoom.js b/modules/jquery/jquery.prpZoom.js
index 8ce2506..7937058 100644
--- a/modules/jquery/jquery.prpZoom.js
+++ b/modules/jquery/jquery.prpZoom.js
@@ -44,6 +44,8 @@
                        height: 0
                },
 
+               zoomOnMouseWheelActivated: false,
+
                _getPosition: function() {
                        var position = this.element.position();
                        position.width = this.element.width();
@@ -92,20 +94,30 @@
                        this.reset();
 
                        var element = this.element;
-                       $.each( this._events, function( event, handler ) {
+                       $.each( this._events(), function( event, handler ) {
                                element.bind( event, handler );
                        } );
                },
 
-               _events: {
-                       //depends on jquery.mousewheel.js
-                       'mousewheel': function( event ) {
-                               if( event.deltaY > 0 ) {
-                                       $( this ).prpZoom( 'zoomOut' );
-                               } else if( event.deltaY < 0 ) {
-                                       $( this ).prpZoom( 'zoomIn' );
+               _events: function() {
+                       var prpZoom = this;
+                       return {
+                               'dblclick': function( event ) {
+                                       prpZoom.zoomOnMouseWheelActivated = 
!prpZoom.zoomOnMouseWheelActivated;
+                               },
+                               //depends on jquery.mousewheel.js
+                               'mousewheel': function( event ) {
+                                       if( !prpZoom.zoomOnMouseWheelActivated 
) {
+                                               return;
+                                       }
+
+                                       if( event.deltaY > 0 ) {
+                                               prpZoom.zoomOut();
+                                       } else if( event.deltaY < 0 ) {
+                                               prpZoom.zoomIn();
+                                       }
+                                       event.preventDefault(); //Don't scroll 
while zooming
                                }
-                               event.preventDefault(); //Don't scroll while 
zooming
                        }
                },
 
@@ -177,7 +189,7 @@
                                } );
 
                        var element = this.element;
-                       $.each( this._events, function( event, handler ) {
+                       $.each( this._events(), function( event, handler ) {
                                element.unbind( event, handler );
                        } );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c58ad45a141e03c1bde3d681d6b144441c75e45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Tpt <thoma...@hotmail.fr>

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

Reply via email to