add svgContainer offset

This commit is contained in:
zsviczian
2023-10-07 10:35:06 +02:00
committed by GitHub
parent c65d6506f7
commit 16de3d9243
3 changed files with 10 additions and 17 deletions

View File

@@ -106,6 +106,13 @@ export class LaserPathManager {
}
startPath(x: number, y: number) {
if (this.container) {
this.container.style.top = "0px";
this.container.style.left = "0px";
const { x, y } = this.container.getBoundingClientRect();
this.container.style.top = `${-y}px`;
this.container.style.left = `${-x}px`;
}
this.ownState.currentPath = instantiatePath();
this.ownState.currentPath.addPoint([x, y, performance.now()]);
this.updatePath(this.ownState);