projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Experimental fix attempt in Board.vue (bad behavior on smartphones)
[vchess.git]
/
client
/
src
/
components
/
Board.vue
diff --git
a/client/src/components/Board.vue
b/client/src/components/Board.vue
index
8d7f7bd
..
0c12620
100644
(file)
--- a/
client/src/components/Board.vue
+++ b/
client/src/components/Board.vue
@@
-75,8
+75,6
@@
export default {
'class': { 'choice-piece': true },
on: {
"click": e => { this.play(m); this.choices=[]; },
'class': { 'choice-piece': true },
on: {
"click": e => { this.play(m); this.choices=[]; },
- // NOTE: add 'touchstart' event to fix a problem on smartphones
- //"touchstart": e => { this.play(m); this.choices=[]; },
},
})
]
},
})
]
@@
-246,19
+244,31
@@
export default {
);
elementArray.push(reserves);
}
);
elementArray.push(reserves);
}
- return h(
- 'div',
- {
- // NOTE: click = mousedown + mouseup
+ let onEvents = {};
+ // NOTE: click = mousedown + mouseup
+ if ('ontouchstart' in window)
+ {
+ onEvents = {
+ on: {
+ touchstart: this.mousedown,
+ touchmove: this.mousemove,
+ touchend: this.mouseup,
+ },
+ };
+ }
+ else
+ {
+ onEvents = {
on: {
mousedown: this.mousedown,
mousemove: this.mousemove,
mouseup: this.mouseup,
on: {
mousedown: this.mousedown,
mousemove: this.mousemove,
mouseup: this.mouseup,
- //touchstart: this.mousedown,
- touchmove: this.mousemove,
- //touchend: this.mouseup,
},
},
- },
+ };
+ }
+ return h(
+ 'div',
+ onEvents,
elementArray
);
},
elementArray
);
},