Refactor constants and update grid and plane dimensions for improved configuration management

This commit is contained in:
2025-05-13 20:00:47 +05:30
parent 33a7efceab
commit 1243ccd842
5 changed files with 44 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
import * as THREE from "three";
import { create } from "zustand";
import { io } from "socket.io-client";
import * as CONSTANTS from '../../types/world/worldConstants';
export const useSocketStore = create<any>((set: any, get: any) => ({
socket: null,
@@ -386,8 +387,8 @@ export const useLimitDistance = create<any>((set: any) => ({
}));
export const useTileDistance = create<any>((set: any) => ({
gridValue: { size: 300, divisions: 75 },
planeValue: { height: 300, width: 300 },
gridValue: { size: CONSTANTS.gridConfig.size, divisions: CONSTANTS.gridConfig.divisions },
planeValue: { height: CONSTANTS.planeConfig.height, width: CONSTANTS.planeConfig.width },
setGridValue: (value: any) =>
set((state: any) => ({
@@ -428,26 +429,26 @@ export const useZoneAssetId = create<ZoneAssetState>((set) => ({
// version visible hidden
interface VersionHistoryState {
viewVersionHistory: boolean;
setVersionHistory: (value: boolean) => void;
viewVersionHistory: boolean;
setVersionHistory: (value: boolean) => void;
}
const useVersionHistoryStore = create<VersionHistoryState>((set) => ({
viewVersionHistory: false,
setVersionHistory: (value) => set({ viewVersionHistory: value }),
viewVersionHistory: false,
setVersionHistory: (value) => set({ viewVersionHistory: value }),
}));
export default useVersionHistoryStore;
interface ShortcutStore {
showShortcuts: boolean;
setShowShortcuts: (value: boolean) => void;
toggleShortcuts: () => void;
showShortcuts: boolean;
setShowShortcuts: (value: boolean) => void;
toggleShortcuts: () => void;
}
export const useShortcutStore = create<ShortcutStore>((set) => ({
showShortcuts: false,
setShowShortcuts: (value) => set({ showShortcuts: value }),
toggleShortcuts: () =>
set((state) => ({ showShortcuts: !state.showShortcuts })),
showShortcuts: false,
setShowShortcuts: (value) => set({ showShortcuts: value }),
toggleShortcuts: () =>
set((state) => ({ showShortcuts: !state.showShortcuts })),
}));