Skip to content

Commit

Permalink
feat(images): Align method names with event names
Browse files Browse the repository at this point in the history
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
  • Loading branch information
starypatyk committed Mar 10, 2024
1 parent e96662c commit aeab2bd
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
@load="updateImgSize"
@wheel.stop.prevent="updateZoom"
@dblclick.prevent="onDblclick"
@pointerdown.prevent="dragStart"
@pointerup.prevent="dragEnd"
@pointermove.prevent="dragHandler">
@pointerdown.prevent="pointerDown"
@pointerup.prevent="pointerUp"
@pointermove.prevent="pointerMove">

<template v-if="livePhoto">
<video v-show="livePhotoCanBePlayed"
Expand All @@ -65,9 +65,9 @@
@wheel.stop.prevent="updateZoom"
@error.capture.prevent.stop.once="onFail"
@dblclick.prevent="onDblclick"
@pointerdown.prevent="dragStart"
@pointerup.prevent="dragEnd"
@pointermove.prevent="dragHandler"
@pointerdown.prevent="pointerDown"
@pointerup.prevent="pointerUp"
@pointermove.prevent="pointerMove"
@ended="stopLivePhoto" />
<button v-if="width !== 0"
class="live-photo_play_button"
Expand Down Expand Up @@ -213,11 +213,11 @@ export default {
this.resetZoom()
// end the dragging if your pointer (mouse or touch) go out of the content
// Not sure why ???
window.addEventListener('pointerout', this.dragEnd)
window.addEventListener('pointerout', this.pointerUp)
// the item is not displayed
} else if (val === false) {
// Not sure why ???
window.removeEventListener('pointerout', this.dragEnd)
window.removeEventListener('pointerout', this.pointerUp)
}
},
},
Expand Down Expand Up @@ -321,11 +321,11 @@ export default {
// https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Pinch_zoom_gestures
/**
* Dragging handlers
* Dragging and (pinch) zooming handlers
*
* @param {DragEvent} event the event
*/
dragStart(event) {
pointerDown(event) {
// New pointer - mouse down or additional touch --> store client coordinates in the pointer cache
this.pointerCache.push({ pointerId: event.pointerId, x: event.clientX, y: event.clientY })
Expand All @@ -348,7 +348,7 @@ export default {
/**
* @param {DragEvent} event the event
*/
dragEnd(event) {
pointerUp(event) {
// Remove pointer from the pointer cache
const index = this.pointerCache.findIndex(
(cachedEv) => cachedEv.pointerId === event.pointerId,
Expand All @@ -360,7 +360,7 @@ export default {
/**
* @param {DragEvent} event the event
*/
dragHandler(event) {
pointerMove(event) {
if (this.pointerCache.length > 0) {
// Update pointer position in the pointer cache
Expand Down

0 comments on commit aeab2bd

Please sign in to comment.