commit: 5829cd98af60b758ee3a39c35f76f4da95a630c3
parent 49fa9c47e961c44acc75b30cf8be69df1fdd7d0a
Author: Tusooa Zhu <tusooa@kazv.moe>
Date: Wed, 8 Sep 2021 21:26:59 -0400
Clean up debug code for image pinch zoom
Diffstat:
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/src/components/media_modal/media_modal.js b/src/components/media_modal/media_modal.js
@@ -103,7 +103,6 @@ const MediaModal = {
this.$refs.pinchZoom.setTransform({ scale: 1, x: offsets[0], y: 0 })
},
handleSwipeEnd (sign) {
- console.log('handleSwipeEnd:', sign)
this.$refs.pinchZoom.setTransform({ scale: 1, x: 0, y: 0 })
if (sign > 0) {
this.goNext()
diff --git a/src/services/gesture_service/gesture_service.js b/src/services/gesture_service/gesture_service.js
@@ -25,9 +25,6 @@ const project = (v1, v2) => {
return [scalar * v2[0], scalar * v2[1]]
}
-// const debug = console.log
-const debug = () => {}
-
// direction: either use the constants above or an arbitrary 2d vector.
// threshold: how many Px to move from touch origin before checking if the
// callback should be called.
@@ -86,7 +83,7 @@ class SwipeAndClickGesture {
swipelessClickCallback,
threshold = 30, perpendicularTolerance = 1.0
}) {
- const nop = () => { debug('Warning: Not implemented') }
+ const nop = () => {}
this.direction = direction
this.swipePreviewCallback = swipePreviewCallback || nop
this.swipeEndCallback = swipeEndCallback || nop
@@ -106,8 +103,6 @@ class SwipeAndClickGesture {
}
start (event) {
- debug('start() called', event)
-
// Only handle left click
if (event.button !== BUTTON_LEFT) {
return
@@ -115,7 +110,6 @@ class SwipeAndClickGesture {
this._startPos = pointerEventCoord(event)
this._pointerId = event.pointerId
- debug('start pos:', this._startPos)
this._swiping = true
this._swiped = false
}
@@ -132,7 +126,6 @@ class SwipeAndClickGesture {
}
cancel (event) {
- debug('cancel called')
if (!this._swiping || this._pointerId !== event.pointerId) {
return
}
@@ -142,29 +135,20 @@ class SwipeAndClickGesture {
end (event) {
if (!this._swiping) {
- debug('not swiping')
return
}
if (this._pointerId !== event.pointerId) {
- debug('pointer id does not match')
return
}
this._swiping = false
- debug('end: is swipe event')
-
- debug('button = ', event.button)
-
// movement too small
const coord = pointerEventCoord(event)
const delta = deltaCoord(this._startPos, coord)
const sign = (() => {
- debug(
- 'threshold = ', this.threshold(),
- 'vector len =', vectorLength(delta))
if (vectorLength(delta) < this.threshold()) {
return 0
}