this.aw;
this.draging = false;
+ this.scaling = true;
+ this.pinchScale = 1;
this.dragX = 0;
this.dragY = 0;
this.dragMinX = 0;
var mc = new Hammer(h.get(0));
mc.get('pan').set({direction: Hammer.DIRECTION_ALL});
+ mc.get('pinch').set({enable: true});
+
mc.on('pan', function (e) {
if ($this.scale == 1) {
return false;
$this.setMovePos($this.dragX + e.deltaX, $this.dragY + e.deltaY);
-
if (e.isFinal) {
$this.dragging = false;
$this.dragX = $this.dragY = 0;
return false;
});
+ mc.on('pinch', function (e) {
+ if (!this.scaling) {
+ $this.scaling = true;
+ $this.pinchScale = $this.scale;
+ }
+
+ $this.scale = $this.normalizeScale($this.scale + ((e.scale - 1) * 0.1));
+ $this.resize();
+
+ if (e.isFinal) {
+ $this.scaling = false;
+ }
+ });
+
i.css(
{
left: this.image.naturalWidth / -2,