Refactor constants and update grid and plane dimensions for improved configuration management
This commit is contained in:
parent
33a7efceab
commit
1243ccd842
Binary file not shown.
|
@ -363,6 +363,10 @@ const FloorItemsGroup = ({
|
||||||
if (!event.dataTransfer?.files[0]) return;
|
if (!event.dataTransfer?.files[0]) return;
|
||||||
|
|
||||||
if (selectedItem.id !== "" && event.dataTransfer?.files[0] && selectedItem.category !== 'Fenestration') {
|
if (selectedItem.id !== "" && event.dataTransfer?.files[0] && selectedItem.category !== 'Fenestration') {
|
||||||
|
|
||||||
|
state.pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
|
||||||
|
state.pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||||
|
|
||||||
addAssetModel(
|
addAssetModel(
|
||||||
raycaster,
|
raycaster,
|
||||||
state.camera,
|
state.camera,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as THREE from "three";
|
import * as THREE from "three";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import { io } from "socket.io-client";
|
import { io } from "socket.io-client";
|
||||||
|
import * as CONSTANTS from '../../types/world/worldConstants';
|
||||||
|
|
||||||
export const useSocketStore = create<any>((set: any, get: any) => ({
|
export const useSocketStore = create<any>((set: any, get: any) => ({
|
||||||
socket: null,
|
socket: null,
|
||||||
|
@ -386,8 +387,8 @@ export const useLimitDistance = create<any>((set: any) => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const useTileDistance = create<any>((set: any) => ({
|
export const useTileDistance = create<any>((set: any) => ({
|
||||||
gridValue: { size: 300, divisions: 75 },
|
gridValue: { size: CONSTANTS.gridConfig.size, divisions: CONSTANTS.gridConfig.divisions },
|
||||||
planeValue: { height: 300, width: 300 },
|
planeValue: { height: CONSTANTS.planeConfig.height, width: CONSTANTS.planeConfig.width },
|
||||||
|
|
||||||
setGridValue: (value: any) =>
|
setGridValue: (value: any) =>
|
||||||
set((state: any) => ({
|
set((state: any) => ({
|
||||||
|
@ -428,26 +429,26 @@ export const useZoneAssetId = create<ZoneAssetState>((set) => ({
|
||||||
|
|
||||||
// version visible hidden
|
// version visible hidden
|
||||||
interface VersionHistoryState {
|
interface VersionHistoryState {
|
||||||
viewVersionHistory: boolean;
|
viewVersionHistory: boolean;
|
||||||
setVersionHistory: (value: boolean) => void;
|
setVersionHistory: (value: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useVersionHistoryStore = create<VersionHistoryState>((set) => ({
|
const useVersionHistoryStore = create<VersionHistoryState>((set) => ({
|
||||||
viewVersionHistory: false,
|
viewVersionHistory: false,
|
||||||
setVersionHistory: (value) => set({ viewVersionHistory: value }),
|
setVersionHistory: (value) => set({ viewVersionHistory: value }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export default useVersionHistoryStore;
|
export default useVersionHistoryStore;
|
||||||
|
|
||||||
interface ShortcutStore {
|
interface ShortcutStore {
|
||||||
showShortcuts: boolean;
|
showShortcuts: boolean;
|
||||||
setShowShortcuts: (value: boolean) => void;
|
setShowShortcuts: (value: boolean) => void;
|
||||||
toggleShortcuts: () => void;
|
toggleShortcuts: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useShortcutStore = create<ShortcutStore>((set) => ({
|
export const useShortcutStore = create<ShortcutStore>((set) => ({
|
||||||
showShortcuts: false,
|
showShortcuts: false,
|
||||||
setShowShortcuts: (value) => set({ showShortcuts: value }),
|
setShowShortcuts: (value) => set({ showShortcuts: value }),
|
||||||
toggleShortcuts: () =>
|
toggleShortcuts: () =>
|
||||||
set((state) => ({ showShortcuts: !state.showShortcuts })),
|
set((state) => ({ showShortcuts: !state.showShortcuts })),
|
||||||
}));
|
}));
|
|
@ -42,17 +42,16 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
border-radius: #{$border-radius-large};
|
border-radius: #{$border-radius-large};
|
||||||
|
.value {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 180px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
text-align: start;
|
||||||
|
}
|
||||||
.zone-header {
|
.zone-header {
|
||||||
@include flex-center;
|
@include flex-center;
|
||||||
|
|
||||||
.value {
|
|
||||||
width: 100%;
|
|
||||||
text-align: start;
|
|
||||||
max-width: 180px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.options-container {
|
.options-container {
|
||||||
@include flex-center;
|
@include flex-center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
|
@ -74,7 +73,9 @@
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: var(--highlight-accent-color);
|
.list-item {
|
||||||
|
background: var(--highlight-accent-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,4 +84,4 @@
|
||||||
|
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,22 +227,10 @@ export const twoDimension: TwoDimension = {
|
||||||
rightMouse: 0, // Mouse button for no action
|
rightMouse: 0, // Mouse button for no action
|
||||||
};
|
};
|
||||||
|
|
||||||
export const threeDimension: ThreeDimension = {
|
|
||||||
defaultPosition: [0, 40, 30], // Default position of the camera
|
|
||||||
defaultTarget: [0, 0, 0], // Default target of the camera
|
|
||||||
defaultRotation: [0, 0, 0], // Default rotation of the camera
|
|
||||||
defaultAzimuth: 0, // Default azimuth of the camera
|
|
||||||
boundaryBottom: [-150, 0, -150], // Bottom boundary of the camera movement
|
|
||||||
boundaryTop: [150, 100, 150], // Top boundary of the camera movement
|
|
||||||
minDistance: 1, // Minimum distance from the target
|
|
||||||
leftMouse: 2, // Mouse button for panning
|
|
||||||
rightMouse: 1, // Mouse button for rotation
|
|
||||||
};
|
|
||||||
|
|
||||||
export const camPositionUpdateInterval: number = 200; // Interval for updating the camera position
|
export const camPositionUpdateInterval: number = 200; // Interval for updating the camera position
|
||||||
|
|
||||||
export const gridConfig: GridConfig = {
|
export const gridConfig: GridConfig = {
|
||||||
size: 300, // Size of the grid
|
size: 150, // Size of the grid
|
||||||
divisions: 75, // Number of divisions in the grid
|
divisions: 75, // Number of divisions in the grid
|
||||||
primaryColor: savedTheme === "dark" ? "#131313" : "#d5d5d5", // Primary color of the grid
|
primaryColor: savedTheme === "dark" ? "#131313" : "#d5d5d5", // Primary color of the grid
|
||||||
secondaryColor: savedTheme === "dark" ? "#434343" : "#e3e3e3", // Secondary color of the grid
|
secondaryColor: savedTheme === "dark" ? "#434343" : "#e3e3e3", // Secondary color of the grid
|
||||||
|
@ -251,13 +239,25 @@ export const gridConfig: GridConfig = {
|
||||||
position3D: [0, -0.5, 0], // Position of the grid in 3D view
|
position3D: [0, -0.5, 0], // Position of the grid in 3D view
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const threeDimension: ThreeDimension = {
|
||||||
|
defaultPosition: [0, 40, 30], // Default position of the camera
|
||||||
|
defaultTarget: [0, 0, 0], // Default target of the camera
|
||||||
|
defaultRotation: [0, 0, 0], // Default rotation of the camera
|
||||||
|
defaultAzimuth: 0, // Default azimuth of the camera
|
||||||
|
boundaryBottom: [-gridConfig.size / 2, 0, -gridConfig.size / 2], // Bottom boundary of the camera movement
|
||||||
|
boundaryTop: [gridConfig.size / 2, 100, gridConfig.size / 2], // Top boundary of the camera movement
|
||||||
|
minDistance: 1, // Minimum distance from the target
|
||||||
|
leftMouse: 2, // Mouse button for panning
|
||||||
|
rightMouse: 1, // Mouse button for rotation
|
||||||
|
};
|
||||||
|
|
||||||
export const planeConfig: PlaneConfig = {
|
export const planeConfig: PlaneConfig = {
|
||||||
position2D: [0, -0.5, 0], // Position of the plane
|
position2D: [0, -0.5, 0], // Position of the plane
|
||||||
position3D: [0, -0.65, 0], // Position of the plane
|
position3D: [0, -0.65, 0], // Position of the plane
|
||||||
rotation: -Math.PI / 2, // Rotation of the plane
|
rotation: -Math.PI / 2, // Rotation of the plane
|
||||||
|
|
||||||
width: 300, // Width of the plane
|
width: 150, // Width of the plane
|
||||||
height: 300, // Height of the plane
|
height: 150, // Height of the plane
|
||||||
color: savedTheme === "dark" ? "#323232" : "#f3f3f3", // Color of the plane
|
color: savedTheme === "dark" ? "#323232" : "#f3f3f3", // Color of the plane
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue