cm-chessboard 8.12.15 → 8.12.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -68,6 +68,10 @@ export class ChessboardView {
|
|
|
68
68
|
this.pointerDownListener = this.pointerDownHandler.bind(this)
|
|
69
69
|
this.container.addEventListener("mousedown", this.pointerDownListener)
|
|
70
70
|
this.container.addEventListener("touchstart", this.pointerDownListener, {passive: false})
|
|
71
|
+
// Suppress the native context menu on the whole board
|
|
72
|
+
// VisualMoveInput triggers a move cancel with a transient listener on right click
|
|
73
|
+
this.contextMenuListener = (e) => e.preventDefault()
|
|
74
|
+
this.container.addEventListener("contextmenu", this.contextMenuListener)
|
|
71
75
|
this.createSvgAndGroups()
|
|
72
76
|
this.handleResize()
|
|
73
77
|
}
|
|
@@ -91,8 +95,9 @@ export class ChessboardView {
|
|
|
91
95
|
if (this.resizeListener) {
|
|
92
96
|
window.removeEventListener("resize", this.resizeListener)
|
|
93
97
|
}
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
98
|
+
this.container.removeEventListener("mousedown", this.pointerDownListener)
|
|
99
|
+
this.container.removeEventListener("touchstart", this.pointerDownListener)
|
|
100
|
+
this.container.removeEventListener("contextmenu", this.contextMenuListener)
|
|
96
101
|
Svg.removeElement(this.svg)
|
|
97
102
|
this.container.remove()
|
|
98
103
|
}
|
|
@@ -208,7 +208,7 @@ export class VisualMoveInput {
|
|
|
208
208
|
this.pointerCancelListener = null
|
|
209
209
|
}
|
|
210
210
|
if (this.contextMenuListener) {
|
|
211
|
-
removeEventListener("contextmenu", this.contextMenuListener)
|
|
211
|
+
this.chessboard.view.svg.removeEventListener("contextmenu", this.contextMenuListener)
|
|
212
212
|
this.contextMenuListener = null
|
|
213
213
|
}
|
|
214
214
|
this.setMoveInputState(MOVE_INPUT_STATE.waitForInputStart)
|