feat: Remove localStorage camera position and control target management from various components
This commit is contained in:
@@ -46,14 +46,10 @@ export default function SwitchView() {
|
||||
// state.controls?.setLookAt(data.position.x, data.position.y, data.position.z, data.target.x, data.target.y, data.target.z, true)
|
||||
state.controls?.setPosition(data.position.x, data.position.y, data.position.z);
|
||||
state.controls?.setTarget(data.target.x, data.target.y, data.target.z);
|
||||
localStorage.setItem("cameraPosition", JSON.stringify(data.position));
|
||||
localStorage.setItem("controlTarget", JSON.stringify(data.target));
|
||||
} else {
|
||||
// state.controls?.setLookAt(...CONSTANTS.threeDimension.defaultPosition, ...CONSTANTS.threeDimension.defaultTarget, true);
|
||||
state.controls?.setPosition(...CONSTANTS.threeDimension.defaultPosition);
|
||||
state.controls?.setTarget(...CONSTANTS.threeDimension.defaultTarget);
|
||||
localStorage.setItem("cameraPosition", JSON.stringify(new THREE.Vector3(...CONSTANTS.threeDimension.defaultPosition)));
|
||||
localStorage.setItem("controlTarget", JSON.stringify(new THREE.Vector3(...CONSTANTS.threeDimension.defaultTarget)));
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -23,9 +23,4 @@ export default function updateCamPosition(
|
||||
projectId,
|
||||
};
|
||||
socket.emit("v1:Camera:set", camData);
|
||||
localStorage.setItem("cameraPosition", JSON.stringify(position));
|
||||
localStorage.setItem(
|
||||
"controlTarget",
|
||||
JSON.stringify(new THREE.Vector3(target.x, 0, target.z))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,9 +49,6 @@ export default function Controls() {
|
||||
controlsRef.current?.setTarget(...CONSTANTS.threeDimension.defaultTarget);
|
||||
controlsRef.current?.rotateAzimuthTo(CONSTANTS.threeDimension.defaultAzimuth);
|
||||
|
||||
localStorage.setItem("cameraPosition", JSON.stringify(new THREE.Vector3(...CONSTANTS.threeDimension.defaultPosition)));
|
||||
localStorage.setItem("controlTarget", JSON.stringify(new THREE.Vector3(...CONSTANTS.threeDimension.defaultTarget)));
|
||||
|
||||
const camData = {
|
||||
organization,
|
||||
userId: userId,
|
||||
|
||||
@@ -277,12 +277,8 @@ const SelectionControls: React.FC = () => {
|
||||
const deleteSelection = () => {
|
||||
if (selectedAssets.length > 0 && duplicatedObjects.length === 0) {
|
||||
|
||||
const storedItems = JSON.parse(localStorage.getItem("FloorItems") ?? "[]");
|
||||
const selectedUUIDs = selectedAssets.map((mesh: THREE.Object3D) => mesh.uuid);
|
||||
|
||||
const updatedStoredItems = storedItems.filter((item: { modelUuid: string }) => !selectedUUIDs.includes(item.modelUuid));
|
||||
localStorage.setItem("FloorItems", JSON.stringify(updatedStoredItems));
|
||||
|
||||
selectedAssets.forEach((selectedMesh: THREE.Object3D) => {
|
||||
//REST
|
||||
|
||||
|
||||
Reference in New Issue
Block a user