d6cd8b78f1
* feat: decouple package deps and introduce yarn workspaces * update root directory * fix * fix scripts * fix lint * update path in scripts * remove yarn.lock files from packages * ignore workspace * dummy * dummy * remove comment check * revert workflow changes * ignore ws when installing gh actions * remove log * update path * fix * fix typo
28 lines
612 B
TypeScript
28 lines
612 B
TypeScript
import { useEffect, useRef } from "react";
|
|
import { LaserPathManager } from "./LaserPathManager";
|
|
import "./LaserToolOverlay.scss";
|
|
|
|
type LaserToolOverlayProps = {
|
|
manager: LaserPathManager;
|
|
};
|
|
|
|
export const LaserToolOverlay = ({ manager }: LaserToolOverlayProps) => {
|
|
const svgRef = useRef<SVGSVGElement | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (svgRef.current) {
|
|
manager.start(svgRef.current);
|
|
}
|
|
|
|
return () => {
|
|
manager.stop();
|
|
};
|
|
}, [manager]);
|
|
|
|
return (
|
|
<div className="LaserToolOverlay">
|
|
<svg ref={svgRef} className="LaserToolOverlayCanvas" />
|
|
</div>
|
|
);
|
|
};
|