summaryrefslogtreecommitdiff
path: root/public/board.js
diff options
context:
space:
mode:
authorame <[email protected]>2024-09-02 13:44:30 -0500
committerame <[email protected]>2024-09-02 13:44:30 -0500
commitae5e76c8a187b6e2c6d44de3bd11653f6129e490 (patch)
tree0c0413864c1e68d05b8dcd339baab2b5342f2001 /public/board.js
parentf1f29d7ea83dcd59e1e98724ca1bde7086df12dc (diff)
set drag imageHEADmain
Diffstat (limited to 'public/board.js')
-rw-r--r--public/board.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/public/board.js b/public/board.js
index 7ba8507..1141a5c 100644
--- a/public/board.js
+++ b/public/board.js
@@ -23,9 +23,10 @@ function handle_highlight(elem) {
return function(ev) {
//validates if square has a piece, and it is it's turn
- if(ev.type === "dragstart" && (!elem || !elem.hasChildNodes() ||
- !elem.children[0].classList.contains(to_move? "w" : "b"))){
- return false
+ if(ev.type === "dragstart"){
+ if(!elem || !elem.hasChildNodes() || !elem.children[0].classList.contains(to_move? "w" : "b"))
+ return false
+ ev.dataTransfer.setDragImage(elem.children[0], 0, 0);
}
let moves = move(board, elem.id.charCodeAt(0) - 48, elem.id.charCodeAt(1) - 48, to_move)