Fix selection on mobile

pull/37/head
Varun Patil 2022-09-07 18:07:53 -07:00
parent 2880d9b4b6
commit 9228c45e40
1 changed files with 28 additions and 0 deletions

View File

@ -9,6 +9,10 @@
}">
<img
@click="click"
@contextmenu="contextmenu"
@touchstart="touchstart"
@touchend="touchend"
@touchcancel="touchend"
:src="data.ph ? undefined : getPreviewUrl(data.fileid, data.etag)"
:key="data.fileid"
@load = "data.l = Math.random()"
@ -23,6 +27,11 @@ import { getPreviewUrl } from "../services/FileUtils";
export default {
name: 'Photo',
data() {
return {
touchTimer: 0,
}
},
props: {
data: {
type: Object,
@ -148,6 +157,25 @@ export default {
}
this.$emit('select', this.data);
},
touchstart() {
this.touchTimer = setTimeout(() => {
this.toggleSelect();
this.touchTimer = 0;
}, 400);
},
contextmenu(e) {
e.preventDefault();
e.stopPropagation();
},
touchend() {
if (this.touchTimer) {
clearTimeout(this.touchTimer);
this.touchTimer = 0;
}
},
}
}
</script>