|
|
@ -56,13 +56,15 @@ export default function RealtimeLayer(props: { |
|
|
|
if (data.data.event === "START_RECORD_SIG") { |
|
|
|
// setRtPoints([]);
|
|
|
|
pointArr.length = 0; |
|
|
|
console.log("-----------------------------------") |
|
|
|
ctx.resetTransform(); |
|
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height); |
|
|
|
ctx.strokeStyle = "blue"; |
|
|
|
const xOffset = (xEndPx - xStartPx) / 2; |
|
|
|
const yOffset = yStepPx * 2; |
|
|
|
ctx.translate(xStartPx + xOffset, yStartPx + yOffset); |
|
|
|
setTimeout(() => { |
|
|
|
ctx.strokeStyle = "blue"; |
|
|
|
const xOffset = (xEndPx - xStartPx) / 2; |
|
|
|
const yOffset = yStepPx * 2; |
|
|
|
ctx.translate(xStartPx + xOffset, yStartPx + yOffset); |
|
|
|
ctx.beginPath(); |
|
|
|
}, 0); |
|
|
|
} else if (data.data.event === "END_RECORD_SIG") { |
|
|
|
//
|
|
|
|
} |
|
|
@ -78,7 +80,6 @@ export default function RealtimeLayer(props: { |
|
|
|
const ctx = canvas.getContext("2d"); |
|
|
|
if (!ctx) return; |
|
|
|
|
|
|
|
// ctx.clearRect(0, 0, canvas.width * 2, canvas.height * 2);
|
|
|
|
const pointsPx = pointArr.map(p => ({ x: p.x * unitPx, y: p.y * unitPx })); |
|
|
|
|
|
|
|
for (let idx = 0; idx < pointsPx.length; idx++) { |
|
|
@ -88,9 +89,7 @@ export default function RealtimeLayer(props: { |
|
|
|
ctx.lineTo(pointsPx[idx].x, pointsPx[idx].y); |
|
|
|
} |
|
|
|
} |
|
|
|
// if (pointsPx.length > 1) {
|
|
|
|
ctx.stroke(); |
|
|
|
// }
|
|
|
|
ctx.stroke(); |
|
|
|
} |
|
|
|
}); |
|
|
|
wsClient.connect(); |
|
|
|