From bae6f640f979736d900839a6fd4bd050bc40bfae 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 Former-commit-id: 9f42f9f2f5b598e849c924b17c76c01b6e7cbb8c [formerly 58917ef575a66b54b03b91fce85dfe5bccf2ef6e] [formerly 50efcb884fd400e99889c4c038679c45d889e855 [formerly dee322a88d10de32a54aae1de443a19d30457fab]] Former-commit-id: f1ab662f4af9bc651f849657497c327d446e9568 [formerly 76e19d6eff958de7df0608c04559e0ecbd784398] Former-commit-id: 7fcc85deebc3d56dc81d9d3b9d27b7193c381f7f --- 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) {