@alepot55/chessboardjs 2.3.6 → 2.3.7
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/dist/chessboard.cjs.js +408 -744
- package/dist/chessboard.esm.js +408 -744
- package/dist/chessboard.iife.js +408 -744
- package/dist/chessboard.umd.js +408 -744
- package/package.json +1 -1
- package/src/components/Piece.js +13 -1
- package/src/core/Chessboard.js +323 -660
- package/src/core/ChessboardConfig.js +33 -18
- package/src/core/ChessboardFactory.js +5 -0
- package/src/core/index.js +15 -34
- package/src/errors/messages.js +1 -0
- package/src/index.js +13 -13
- package/src/services/ValidationService.js +14 -1
- package/src/utils/validation.js +5 -1
package/package.json
CHANGED
package/src/components/Piece.js
CHANGED
|
@@ -201,10 +201,22 @@ class Piece {
|
|
|
201
201
|
|
|
202
202
|
setDrag(f) {
|
|
203
203
|
if (!this.element) { console.debug(`[Piece] setDrag: ${this.id} - element is null`); return; }
|
|
204
|
+
// Remove previous handlers
|
|
205
|
+
this.element.onmousedown = null;
|
|
206
|
+
this.element.ontouchstart = null;
|
|
207
|
+
this.element.ondragstart = null;
|
|
208
|
+
if (window.PointerEvent) {
|
|
209
|
+
this.element.onpointerdown = null;
|
|
210
|
+
}
|
|
211
|
+
// Set new handlers
|
|
204
212
|
this.element.ondragstart = (e) => { e.preventDefault() };
|
|
205
213
|
this.element.onmousedown = f;
|
|
206
214
|
this.element.ontouchstart = f; // Drag touch
|
|
207
|
-
|
|
215
|
+
if (window.PointerEvent) {
|
|
216
|
+
this.element.onpointerdown = f;
|
|
217
|
+
console.debug(`[Piece] setDrag: pointerdown set for ${this.id}`);
|
|
218
|
+
}
|
|
219
|
+
console.debug(`[Piece] setDrag: mousedown/ontouchstart set for ${this.id}`);
|
|
208
220
|
}
|
|
209
221
|
|
|
210
222
|
destroy() {
|