cm-chessboard 7.8.0 → 7.8.2
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.
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
|
|
7
7
|
<link rel="stylesheet" href="../styles/examples.css"/>
|
|
8
8
|
<link rel="stylesheet" href="../../assets/chessboard.css"/>
|
|
9
|
+
<link rel="stylesheet" href="../../assets/extensions/markers/markers.css"/>
|
|
9
10
|
<style>
|
|
10
|
-
|
|
11
|
+
/*noinspection CssUnusedSymbol*/
|
|
12
|
+
.board .html-layer {
|
|
13
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
.board .html-layer div {
|
|
11
17
|
position: absolute;
|
|
12
18
|
top: 30%;
|
|
13
19
|
left: 1rem;
|
|
@@ -32,17 +38,21 @@
|
|
|
32
38
|
<script type="module">
|
|
33
39
|
import {Chessboard, FEN} from "../../src/Chessboard.js"
|
|
34
40
|
import {HtmlLayer} from "../../src/extensions/html-layer/HtmlLayer.js"
|
|
41
|
+
import {Markers} from "../../src/extensions/markers/Markers.js"
|
|
35
42
|
|
|
36
43
|
const board = new Chessboard(document.getElementById("board"), {
|
|
37
44
|
position: FEN.start,
|
|
38
45
|
assetsUrl: "../../assets/",
|
|
39
|
-
extensions: [{class: HtmlLayer}]
|
|
46
|
+
extensions: [{class: HtmlLayer}, {class: Markers}]
|
|
40
47
|
})
|
|
41
48
|
board.enableMoveInput(() => true)
|
|
42
49
|
let layer = null
|
|
43
50
|
window.addLayer = () => {
|
|
44
51
|
if(!layer) {
|
|
45
|
-
layer = board.addHtmlLayer("<div
|
|
52
|
+
layer = board.addHtmlLayer("<div>Welcome to cm-chessboard!</div>")
|
|
53
|
+
layer.addEventListener("click", () => {
|
|
54
|
+
window.removeLayer()
|
|
55
|
+
})
|
|
46
56
|
}
|
|
47
57
|
}
|
|
48
58
|
window.removeLayer = () => {
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export class HtmlLayer extends Extension {
|
|
|
17
17
|
const layer = document.createElement("div")
|
|
18
18
|
this.chessboard.context.appendChild(layer)
|
|
19
19
|
this.chessboard.context.style.position = "relative"
|
|
20
|
+
layer.classList.add("html-layer")
|
|
20
21
|
layer.style.position = "absolute"
|
|
21
22
|
layer.style.top = "0"
|
|
22
23
|
layer.style.left = "0"
|