touch evt on move
Former-commit-id: 9f42f9f2f5b598e849c924b17c76c01b6e7cbb8c [formerly 58917ef575a66b54b03b91fce85dfe5bccf2ef6e] [formerly 50efcb884fd400e99889c4c038679c45d889e855 [formerly dee322a88d
]]
Former-commit-id: f1ab662f4af9bc651f849657497c327d446e9568 [formerly 76e19d6eff958de7df0608c04559e0ecbd784398]
Former-commit-id: 7fcc85deebc3d56dc81d9d3b9d27b7193c381f7f
pull/726/head
parent
1cdb791aaa
commit
bae6f640f9
|
@ -4,7 +4,12 @@
|
||||||
<p>Choose new house for your file(s)/folder(s):</p>
|
<p>Choose new house for your file(s)/folder(s):</p>
|
||||||
|
|
||||||
<ul class="file-list">
|
<ul class="file-list">
|
||||||
<li @click="select" @dblclick="next" :aria-selected="moveTo == item.url" :key="item.name" v-for="item in items" :data-url="item.url">{{ item.name }}</li>
|
<li @click="select"
|
||||||
|
@touchstart="touchstart"
|
||||||
|
@dblclick="next"
|
||||||
|
:aria-selected="moveTo == item.url"
|
||||||
|
:key="item.name" v-for="item in items"
|
||||||
|
:data-url="item.url">{{ item.name }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Currently navigating on: <code>{{ current }}</code>.</p>
|
<p>Currently navigating on: <code>{{ current }}</code>.</p>
|
||||||
|
@ -27,6 +32,10 @@ export default {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
items: [],
|
items: [],
|
||||||
|
touches: {
|
||||||
|
id: '',
|
||||||
|
count: 0
|
||||||
|
},
|
||||||
current: window.location.pathname,
|
current: window.location.pathname,
|
||||||
moveTo: null
|
moveTo: null
|
||||||
}
|
}
|
||||||
|
@ -119,6 +128,31 @@ export default {
|
||||||
.then(this.fillOptions)
|
.then(this.fillOptions)
|
||||||
.catch(this.showError)
|
.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) {
|
select: function (event) {
|
||||||
// If the element is already selected, unselect it.
|
// If the element is already selected, unselect it.
|
||||||
if (this.moveTo === event.currentTarget.dataset.url) {
|
if (this.moveTo === event.currentTarget.dataset.url) {
|
||||||
|
|
Loading…
Reference in New Issue