cm-chessboard 5.5.4 → 5.5.5
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
|
@@ -19,18 +19,7 @@ export class RenderVideo extends Extension {
|
|
|
19
19
|
this.registerExtensionPoint(EXTENSION_POINT.animation, () => {
|
|
20
20
|
if(this.recorder && this.recorder.state === "recording") {
|
|
21
21
|
setTimeout(() => {
|
|
22
|
-
|
|
23
|
-
let serialized = new XMLSerializer().serializeToString(clonedSvgElement)
|
|
24
|
-
const blob = new Blob([serialized], {type: "image/svg+xml"})
|
|
25
|
-
const blobURL = URL.createObjectURL(blob)
|
|
26
|
-
const image = new Image()
|
|
27
|
-
this.images.push(image)
|
|
28
|
-
image.onload = () => {
|
|
29
|
-
let context = this.canvas.getContext('2d')
|
|
30
|
-
context.drawImage(image, 0, 0, this.canvas.width, this.canvas.height)
|
|
31
|
-
this.recorder.requestData()
|
|
32
|
-
}
|
|
33
|
-
image.src = blobURL
|
|
22
|
+
this.cloneImageAndRender()
|
|
34
23
|
})
|
|
35
24
|
}
|
|
36
25
|
})
|
|
@@ -58,7 +47,9 @@ export class RenderVideo extends Extension {
|
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
49
|
this.recorder.start()
|
|
61
|
-
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
this.cloneImageAndRender()
|
|
52
|
+
}, 50)
|
|
62
53
|
console.log("recorder", this.recorder.state)
|
|
63
54
|
})
|
|
64
55
|
/**
|
|
@@ -69,12 +60,27 @@ export class RenderVideo extends Extension {
|
|
|
69
60
|
console.error("recorder is not recording")
|
|
70
61
|
return
|
|
71
62
|
}
|
|
63
|
+
this.recorder.requestData()
|
|
72
64
|
this.recorder.stop()
|
|
73
65
|
console.log("recorder", this.recorder.state)
|
|
74
66
|
return URL.createObjectURL(new Blob(this.recordedData, {type: this.props.mediaType}))
|
|
75
67
|
})
|
|
76
68
|
}
|
|
77
69
|
|
|
70
|
+
cloneImageAndRender() {
|
|
71
|
+
let clonedSvgElement = this.chessboard.view.svg.cloneNode(true)
|
|
72
|
+
let serialized = new XMLSerializer().serializeToString(clonedSvgElement)
|
|
73
|
+
const blob = new Blob([serialized], {type: "image/svg+xml"})
|
|
74
|
+
const blobURL = URL.createObjectURL(blob)n
|
|
75
|
+
const image = new Image()
|
|
76
|
+
image.onload = () => {
|
|
77
|
+
let context = this.canvas.getContext('2d')
|
|
78
|
+
context.drawImage(image, 0, 0, this.canvas.width, this.canvas.height)
|
|
79
|
+
this.recorder.requestData()
|
|
80
|
+
}
|
|
81
|
+
image.src = blobURL
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
transferComputedStyle(element) {
|
|
79
85
|
const computedStyle = getComputedStyle(element, null)
|
|
80
86
|
for (let i = 0; i < computedStyle.length; i++) {
|