Skip to content

Commit

Permalink
double-tap-scale property
Browse files Browse the repository at this point in the history
  • Loading branch information
drozhzhin-n-e committed Feb 27, 2019
1 parent 07b2e5a commit 3f6d438
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/pinch-zoom/pinch-zoom.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class PinchZoomComponent implements OnInit {
@Input('height') containerHeight: string;
@Input('transition-duration') transitionDuration = 200;
@Input('double-tap') doubleTap = true;
@Input('double-tap-scale') doubleTapScale = 2;
@Input('zoom-button') zoomButton = true;
@Input('linear-horizontal-swipe') linearHorizontalSwipe = false;
@Input('linear-vertical-swipe') linearVerticalSwipe = false;
Expand Down Expand Up @@ -436,11 +437,11 @@ export class PinchZoomComponent implements OnInit {
if (event && event.changedTouches) {
const changedTouches = event.changedTouches;

this.scale = this.initialScale * 2;
this.moveX = this.initialMoveX - (changedTouches[0].clientX - this.elementPosition.left);
this.moveY = this.initialMoveY - (changedTouches[0].clientY - this.elementPosition.top);
this.scale = this.initialScale * this.doubleTapScale;
this.moveX = this.initialMoveX - (changedTouches[0].clientX * (this.doubleTapScale - 1) - this.elementPosition.left);
this.moveY = this.initialMoveY - (changedTouches[0].clientY * (this.doubleTapScale - 1) - this.elementPosition.top);
} else {
this.scale = this.initialScale * 2;
this.scale = this.initialScale * this.doubleTapScale;
this.moveX = this.initialMoveX - this.element.offsetWidth / 2;
this.moveY = this.initialMoveY - this.element.offsetHeight / 2;
}
Expand Down

0 comments on commit 3f6d438

Please sign in to comment.