Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -34,11 +34,10 @@ export default {
|
||||
let newDistance = this.touchDistance(event.touches)
|
||||
let midX = (event.touches.item(0).clientX + event.touches.item(1).clientX) / 2
|
||||
let midY = (event.touches.item(0).clientY + event.touches.item(1).clientY) / 2
|
||||
let scale = newDistance / this.touchPrevious.distance
|
||||
let scaleChange = this.canvasZoom * (scale - 1)
|
||||
this.canvasZoom *= scale
|
||||
this.canvasOffset.x += -((midX - 16) * scaleChange) + (midX - this.touchPrevious.x)
|
||||
this.canvasOffset.y += -((midY - 96) * scaleChange) + (midY - this.touchPrevious.y)
|
||||
let zoomFactor = newDistance / this.touchPrevious.distance
|
||||
this.canvasZoom *= zoomFactor
|
||||
this.canvasOffset.x = (midX - 16) * (1 - zoomFactor) + this.canvasOffset.x * zoomFactor + (midX - this.touchPrevious.x)
|
||||
this.canvasOffset.y = (midY - 96) * (1 - zoomFactor) + this.canvasOffset.y * zoomFactor + (midY - this.touchPrevious.y)
|
||||
this.touchPrevious = {distance: newDistance, x: midX, y: midY}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user