2025-06-13 09:52:03 +00:00
|
|
|
import { CameraControls } from "@react-three/drei";
|
feat: Implement duplicate event and product stores using Zustand with immer middleware
- Created `duplicateEventStore` to manage events with actions for adding, removing, updating events, points, actions, and triggers.
- Implemented helper functions to retrieve events, points, actions, and triggers by their unique identifiers.
- Created `duplicateProductStore` to manage products and their associated events, including actions for adding, removing, updating products, events, points, actions, and triggers.
- Added renaming functions for products, actions, and triggers.
- Included comprehensive helper functions to retrieve products and their related data by various identifiers.
2025-06-13 12:10:55 +00:00
|
|
|
import { useRef } from "react";
|
|
|
|
import { useFrame, useThree } from "@react-three/fiber";
|
2025-06-13 09:52:03 +00:00
|
|
|
import * as CONSTANTS from '../../../types/world/worldConstants';
|
|
|
|
|
feat: Implement duplicate event and product stores using Zustand with immer middleware
- Created `duplicateEventStore` to manage events with actions for adding, removing, updating events, points, actions, and triggers.
- Implemented helper functions to retrieve events, points, actions, and triggers by their unique identifiers.
- Created `duplicateProductStore` to manage products and their associated events, including actions for adding, removing, updating products, events, points, actions, and triggers.
- Added renaming functions for products, actions, and triggers.
- Included comprehensive helper functions to retrieve products and their related data by various identifiers.
2025-06-13 12:10:55 +00:00
|
|
|
import { useDuplicatedCamData, useToggleView } from "../../../store/builder/store";
|
2025-06-13 09:52:03 +00:00
|
|
|
|
feat: Implement duplicate event and product stores using Zustand with immer middleware
- Created `duplicateEventStore` to manage events with actions for adding, removing, updating events, points, actions, and triggers.
- Implemented helper functions to retrieve events, points, actions, and triggers by their unique identifiers.
- Created `duplicateProductStore` to manage products and their associated events, including actions for adding, removing, updating products, events, points, actions, and triggers.
- Added renaming functions for products, actions, and triggers.
- Included comprehensive helper functions to retrieve products and their related data by various identifiers.
2025-06-13 12:10:55 +00:00
|
|
|
export default function ControlsDuplicate() {
|
2025-06-13 09:52:03 +00:00
|
|
|
const controlsRef = useRef<CameraControls>(null);
|
|
|
|
const { toggleView } = useToggleView();
|
|
|
|
const state = useThree();
|
feat: Implement duplicate event and product stores using Zustand with immer middleware
- Created `duplicateEventStore` to manage events with actions for adding, removing, updating events, points, actions, and triggers.
- Implemented helper functions to retrieve events, points, actions, and triggers by their unique identifiers.
- Created `duplicateProductStore` to manage products and their associated events, including actions for adding, removing, updating products, events, points, actions, and triggers.
- Added renaming functions for products, actions, and triggers.
- Included comprehensive helper functions to retrieve products and their related data by various identifiers.
2025-06-13 12:10:55 +00:00
|
|
|
const { duplicatedCamData } = useDuplicatedCamData();
|
2025-06-13 09:52:03 +00:00
|
|
|
|
feat: Implement duplicate event and product stores using Zustand with immer middleware
- Created `duplicateEventStore` to manage events with actions for adding, removing, updating events, points, actions, and triggers.
- Implemented helper functions to retrieve events, points, actions, and triggers by their unique identifiers.
- Created `duplicateProductStore` to manage products and their associated events, including actions for adding, removing, updating products, events, points, actions, and triggers.
- Added renaming functions for products, actions, and triggers.
- Included comprehensive helper functions to retrieve products and their related data by various identifiers.
2025-06-13 12:10:55 +00:00
|
|
|
useFrame(() => {
|
|
|
|
controlsRef.current?.setPosition(...duplicatedCamData.camPosition, true);
|
|
|
|
controlsRef.current?.setTarget(...duplicatedCamData.camTarget, true);
|
|
|
|
})
|
2025-06-13 09:52:03 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<CameraControls
|
|
|
|
makeDefault
|
|
|
|
ref={controlsRef}
|
|
|
|
minDistance={toggleView ? CONSTANTS.twoDimension.minDistance : CONSTANTS.threeDimension.minDistance}
|
|
|
|
maxDistance={CONSTANTS.thirdPersonControls.maxDistance}
|
|
|
|
minZoom={CONSTANTS.thirdPersonControls.minZoom}
|
|
|
|
maxZoom={CONSTANTS.thirdPersonControls.maxZoom}
|
|
|
|
maxPolarAngle={CONSTANTS.thirdPersonControls.maxPolarAngle}
|
|
|
|
camera={state.camera}
|
|
|
|
verticalDragToForward={true}
|
|
|
|
boundaryEnclosesCamera={true}
|
|
|
|
dollyToCursor={toggleView}
|
|
|
|
>
|
|
|
|
</CameraControls>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|