Skip to content

Commit

Permalink
Merge pull request #95 from dampkwab/master
Browse files Browse the repository at this point in the history
Housekeeping
  • Loading branch information
sandstrom authored May 10, 2019
2 parents 80eeec5 + 6451413 commit f31013d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/pinch-zoom.min.js

Large diffs are not rendered by default.

48 changes: 39 additions & 9 deletions dist/pinch-zoom.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@
value: true
});
/*
PinchZoom.js
Copyright (c) Manuel Stofer 2013 - today
Author: Manuel Stofer ([email protected])
Version: 2.3.2
Version: 2.3.3
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

// polyfills
Expand Down Expand Up @@ -158,7 +158,14 @@
dragEndEventName: 'pz_dragend',
doubleTapEventName: 'pz_doubletap',
verticalPadding: 0,
horizontalPadding: 0
horizontalPadding: 0,
onZoomStart: null,
onZoomEnd: null,
onZoomUpdate: null,
onDragStart: null,
onDragEnd: null,
onDragUpdate: null,
onDoubleTap: null
},

/**
Expand All @@ -167,6 +174,9 @@
*/
handleDragStart: function handleDragStart(event) {
triggerEvent(this.el, this.options.dragStartEventName);
if (typeof this.options.onDragStart == "function") {
this.options.onDragStart(this, event);
}
this.stopAnimation();
this.lastDragPosition = false;
this.hasInteraction = true;
Expand All @@ -186,6 +196,9 @@

handleDragEnd: function handleDragEnd() {
triggerEvent(this.el, this.options.dragEndEventName);
if (typeof this.options.onDragEnd == "function") {
this.options.onDragEnd(this, event);
}
this.end();
},

Expand All @@ -195,6 +208,9 @@
*/
handleZoomStart: function handleZoomStart(event) {
triggerEvent(this.el, this.options.zoomStartEventName);
if (typeof this.options.onZoomStart == "function") {
this.options.onZoomStart(this, event);
}
this.stopAnimation();
this.lastScale = 1;
this.nthZoom = 0;
Expand Down Expand Up @@ -224,6 +240,9 @@

handleZoomEnd: function handleZoomEnd() {
triggerEvent(this.el, this.options.zoomEndEventName);
if (typeof this.options.onZoomEnd == "function") {
this.options.onZoomEnd(this, event);
}
this.end();
},

Expand Down Expand Up @@ -251,6 +270,9 @@

this.animate(this.options.animationDuration, updateProgress, this.swing);
triggerEvent(this.el, this.options.doubleTapEventName);
if (typeof this.options.onDoubleTap == "function") {
this.options.onDoubleTap(this, event);
}
},

/**
Expand Down Expand Up @@ -337,6 +359,9 @@
y: (_scale - 1) * (center.y + this.offset.y)
});
triggerEvent(this.el, this.options.zoomUpdateEventName);
if (typeof this.options.onZoomUpdate == "function") {
this.options.onZoomUpdate(this, event);
}
},

/**
Expand Down Expand Up @@ -390,6 +415,9 @@
});
}
triggerEvent(this.el, this.options.dragUpdateEventName);
if (typeof this.options.onDragUpdate == "function") {
this.options.onDragUpdate(this, event);
}
}
},

Expand Down Expand Up @@ -857,7 +885,9 @@
} else {
switch (interaction) {
case 'zoom':
target.handleZoom(event, calculateScale(startTouches, targetTouches(event.touches)));
if (startTouches.length == 2 && event.touches.length == 2) {
target.handleZoom(event, calculateScale(startTouches, targetTouches(event.touches)));
}
break;
case 'drag':
target.handleDrag(event);
Expand Down
1 change: 1 addition & 0 deletions dist/pinch-zoom.umd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pinch-zoom-js",
"version": "2.3.2",
"version": "2.3.3",
"description": "Browser library for multi-touch gestures to zoom and drag on any DOM element.",
"author": "Manuel Stofer",
"license": "MIT",
Expand All @@ -26,6 +26,7 @@
"typings": "src/pinch-zoom.d.ts",
"devDependencies": {
"babel-cli": "~6.26.0",
"babel-minify": "^0.5.0",
"babel-preset-env": "~1.6.1"
},
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ mkdir dist

# UMD build
babel src/pinch-zoom.js -o dist/pinch-zoom.umd.js

# Minify
babel-minify --sourceType module src/pinch-zoom.js -o dist/pinch-zoom.min.js
babel-minify dist/pinch-zoom.umd.js -o dist/pinch-zoom.umd.min.js
2 changes: 1 addition & 1 deletion src/pinch-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Copyright (c) Manuel Stofer 2013 - today
Author: Manuel Stofer ([email protected])
Version: 2.3.2
Version: 2.3.3
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit f31013d

Please sign in to comment.