-
-
Save ederchrono/9e0316b3c8bbbe9243bcdb2cd77973ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inside the vue instance data | |
dragging: false, | |
cursorStartX: 0, | |
cursorCurrentX: 0 | |
// after data | |
methods: { | |
startDrag(e) { | |
this.dragging = true | |
this.cursorStartX = getCursorX(e) | |
this.cursorCurrentX = this.cursorStartX | |
}, | |
drag(e) { | |
if(!this.dragging) { | |
// avoid updating if not dragging | |
return | |
} | |
this.cursorCurrentX = getCursorX(e) | |
}, | |
stopDrag(e) { | |
this.dragging = false | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment