'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=[]; },
},
})
]
);
elementArray.push(reserves);
}
- return h(
- 'div',
- {
- // NOTE: click = mousedown + mouseup
+ let onEvents = {};
+ // NOTE: click = mousedown + mouseup
+ if ('ontouchstart' in window)
+ {
+ onEvents = {
on: {
- mousedown: this.mousedown,
- mousemove: this.mousemove,
- mouseup: this.mouseup,
touchstart: this.mousedown,
touchmove: this.mousemove,
touchend: this.mouseup,
},
- },
+ };
+ }
+ else
+ {
+ onEvents = {
+ on: {
+ mousedown: this.mousedown,
+ mousemove: this.mousemove,
+ mouseup: this.mouseup,
+ },
+ };
+ }
+ return h(
+ 'div',
+ onEvents,
elementArray
);
},