refactor: Update zone handling by integrating zoneStore in multiple components and removing unused zones state

This commit is contained in:
2025-07-03 17:55:19 +05:30
parent 3f59f5d2dd
commit 46ff5c0208
10 changed files with 80 additions and 56 deletions

View File

@@ -20,7 +20,7 @@ function ZoneCreator() {
const { activeLayer } = useActiveLayer();
const { socket } = useSocketStore();
const { zoneStore } = useSceneContext();
const { addZone, getZonePointById, getZoneByPoints } = zoneStore();
const { zones, addZone, getZonePointById, getZoneByPoints } = zoneStore();
const drag = useRef(false);
const isLeftMouseDown = useRef(false);
const { selectedVersionStore } = useVersionContext();
@@ -32,6 +32,7 @@ function ZoneCreator() {
const [isCreating, setIsCreating] = useState(false);
const { zoneColor, zoneHeight, snappedPosition, snappedPoint, setSnappedPoint, setSnappedPosition } = useBuilderStore();
useEffect(() => {
const canvasElement = gl.domElement;
@@ -92,7 +93,7 @@ function ZoneCreator() {
if (tempPoints.length > 2 && isCreating && snappedPoint && snappedPoint.pointUuid === tempPoints[0].pointUuid) {
const zone: Zone = {
zoneUuid: THREE.MathUtils.generateUUID(),
zoneName: "Zone",
zoneName: `Zone `,
points: tempPoints,
zoneColor,
zoneHeight,