From dee322a88d10de32a54aae1de443a19d30457fab Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 8 Jul 2017 21:55:15 +0100 Subject: [PATCH] touch evt on move --- assets/src/components/prompts/Move.vue | 36 +++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/assets/src/components/prompts/Move.vue b/assets/src/components/prompts/Move.vue index 1c543d8c..122b0d4e 100644 --- a/assets/src/components/prompts/Move.vue +++ b/assets/src/components/prompts/Move.vue @@ -4,7 +4,12 @@

Choose new house for your file(s)/folder(s):

Currently navigating on: {{ current }}.

@@ -27,6 +32,10 @@ export default { data: function () { return { items: [], + touches: { + id: '', + count: 0 + }, current: window.location.pathname, moveTo: null } @@ -119,6 +128,31 @@ export default { .then(this.fillOptions) .catch(this.showError) }, + touchstart (event) { + let url = event.currentTarget.dataset.url + + // In 300 milliseconds, we shall reset the count. + setTimeout(() => { + this.touches.count = 0 + }, 300) + + // If the element the user is touching + // is different from the last one he touched, + // reset the count. + if (this.touches.id !== url) { + this.touches.id = url + this.touches.count = 1 + return + } + + this.touches.count++ + + // If there is more than one touch already, + // open the next screen. + if (this.touches.count > 1) { + this.next(event) + } + }, select: function (event) { // If the element is already selected, unselect it. if (this.moveTo === event.currentTarget.dataset.url) {