projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adjust comments, add a few TODOs + remove DEBUG in play/undo
[vchess.git]
/
public
/
javascripts
/
components
/
game.js
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
84976b0
..
72b5da9
100644
(file)
--- a/
public/javascripts/components/game.js
+++ b/
public/javascripts/components/game.js
@@
-432,14
+432,14
@@
Vue.component('my-game', {
"col-lg-6":true,
"col-lg-offset-3":true,
},
"col-lg-6":true,
"col-lg-offset-3":true,
},
- // NOTE: click = mousedown + mouseup
--> what about smartphone?!
+ // NOTE: click = mousedown + mouseup
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,
+// touchstart: this.mousedown, //TODO...
+
//
touchmove: this.mousemove,
+
//
touchend: this.mouseup,
},
},
elementArray
},
},
elementArray
@@
-736,6
+736,19
@@
Vue.component('my-game', {
},
mousedown: function(e) {
e = e || window.event;
},
mousedown: function(e) {
e = e || window.event;
+ let ingame = false;
+ let elem = e.target;
+ while (!ingame && elem !== null)
+ {
+ if (elem.classList.contains("game"))
+ {
+ ingame = true;
+ break;
+ }
+ elem = elem.parentElement;
+ }
+ if (!ingame) //let default behavior (click on button...)
+ return;
e.preventDefault(); //disable native drag & drop
if (!this.selectedPiece && e.target.classList.contains("piece"))
{
e.preventDefault(); //disable native drag & drop
if (!this.selectedPiece && e.target.classList.contains("piece"))
{