Tpt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/104313
Change subject: Add limitation to the zoom scale factor
......................................................................
Add limitation to the zoom scale factor
Change-Id: I8a9e6059dfa13506b12b878c279ca6192918fde9
---
M modules/jquery/jquery.prpZoom.js
1 file changed, 13 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage
refs/changes/13/104313/1
diff --git a/modules/jquery/jquery.prpZoom.js b/modules/jquery/jquery.prpZoom.js
index 79b1ef6..4423c81 100644
--- a/modules/jquery/jquery.prpZoom.js
+++ b/modules/jquery/jquery.prpZoom.js
@@ -25,7 +25,9 @@
options: {
zoomStep: 6,
- animationDuration: 10
+ animationDuration: 10,
+ minScaleFactor: 0.2,
+ maxScaleFactor: 10
},
defaultDimensions: {
@@ -54,6 +56,10 @@
width: Math.round( position.width ),
height: Math.round( position.height )
}, this.options.animationDuration );
+ },
+
+ _getScaleFactor: function( position ) {
+ return position.width / this.defaultDimensions.width;
},
_create: function() {
@@ -134,6 +140,12 @@
position.top -= proportion * this.zoomStep.height;
position.width += 2 * proportion * this.zoomStep.width;
position.height += 2 * proportion *
this.zoomStep.height;
+
+ var scaleFactor = this._getScaleFactor( position );
+ if( this.options.minScaleFactor > scaleFactor ||
scaleFactor > this.options.maxScaleFactor ) {
+ return;
+ }
+
this._applyPosition( position );
},
--
To view, visit https://gerrit.wikimedia.org/r/104313
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a9e6059dfa13506b12b878c279ca6192918fde9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Tpt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits