sel: allow touchmove by 30px
Signed-off-by: Varun Patil <varunpatil@ucla.edu>pull/504/head
parent
857c44adc8
commit
235cf66dee
|
@ -321,6 +321,7 @@ export default defineComponent({
|
||||||
|
|
||||||
this.touchAnchor = photo;
|
this.touchAnchor = photo;
|
||||||
this.prevOver = photo;
|
this.prevOver = photo;
|
||||||
|
this.prevTouch = event.touches[0];
|
||||||
this.touchPrevSel = new Map(this.selection);
|
this.touchPrevSel = new Map(this.selection);
|
||||||
this.touchTimer = window.setTimeout(() => {
|
this.touchTimer = window.setTimeout(() => {
|
||||||
if (this.touchAnchor === photo) {
|
if (this.touchAnchor === photo) {
|
||||||
|
@ -358,7 +359,20 @@ export default defineComponent({
|
||||||
touchmovePhoto(anchor: IPhoto, event: TouchEvent, rowIdx: number) {
|
touchmovePhoto(anchor: IPhoto, event: TouchEvent, rowIdx: number) {
|
||||||
if (anchor.flag & this.c.FLAG_PLACEHOLDER) return;
|
if (anchor.flag & this.c.FLAG_PLACEHOLDER) return;
|
||||||
|
|
||||||
|
// Use first touch -- can't do much
|
||||||
|
const touch: Touch = event.touches[0];
|
||||||
|
|
||||||
if (this.touchTimer) {
|
if (this.touchTimer) {
|
||||||
|
// To be more forgiving, check if touch is still
|
||||||
|
// within 30px of anchor touch (prevTouch)
|
||||||
|
if (
|
||||||
|
this.prevTouch &&
|
||||||
|
Math.abs(this.prevTouch.clientX - touch.clientX) < 30 &&
|
||||||
|
Math.abs(this.prevTouch.clientY - touch.clientY) < 30
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Touch is not held, just cancel
|
// Touch is not held, just cancel
|
||||||
window.clearTimeout(this.touchTimer);
|
window.clearTimeout(this.touchTimer);
|
||||||
this.touchTimer = 0;
|
this.touchTimer = 0;
|
||||||
|
@ -372,8 +386,7 @@ export default defineComponent({
|
||||||
// Prevent scrolling
|
// Prevent scrolling
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// Use first touch -- can't do much
|
// This should never happen
|
||||||
const touch: Touch = event.touches[0];
|
|
||||||
if (!touch) return;
|
if (!touch) return;
|
||||||
this.prevTouch = touch;
|
this.prevTouch = touch;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue