feat: Add dragging and rotating state management to simulation store
- Introduced `useIsDragging` and `useIsRotating` stores to manage dragging and rotating states. - Each store maintains its own state and provides setter functions. refactor: Enhance storage unit and vehicle stores - Added `clearStorageUnits` and `clearvehicles` methods to clear respective stores. - Prevent duplicate entries in `addStorageUnit` and `addVehicle` methods by checking for existing model UUIDs. style: Update SCSS variables and improve styling consistency - Refactored background gradient variables for better readability. - Introduced log indication colors for better visual feedback. - Cleaned up and organized styles in various components for improved maintainability. chore: Remove unused ROISummary styles - Deleted `ROISummary.scss` as it was no longer needed. feat: Implement new analysis component styles - Created `analysis.scss` for the new analysis component layout and styles. - Added styles for various sections including metrics, throughput values, and progress bars. fix: Update main styles import - Adjusted imports in `main.scss` to reflect the new structure and removed obsolete imports.
This commit is contained in:
@@ -8,7 +8,6 @@ import * as Types from "../../../types/world/worldTypes";
|
||||
import { initializeDB, retrieveGLTF, storeGLTF } from '../../../utils/indexDB/idbUtils';
|
||||
import { getCamera } from '../../../services/factoryBuilder/camera/getCameraApi';
|
||||
import { getFloorAssets } from '../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi';
|
||||
import PointsCalculator from '../../simulation/events/points/functions/pointsCalculator';
|
||||
|
||||
async function loadInitialFloorItems(
|
||||
itemsGroup: Types.RefGroup,
|
||||
@@ -72,7 +71,7 @@ async function loadInitialFloorItems(
|
||||
// Check Three.js Cache
|
||||
const cachedModel = THREE.Cache.get(item.modelfileID!);
|
||||
if (cachedModel) {
|
||||
// console.log(`[Cache] Fetching ${item.modelName}`);
|
||||
//
|
||||
processLoadedModel(cachedModel.scene.clone(), item, itemsGroup, setFloorItems, addEvent);
|
||||
modelsLoaded++;
|
||||
checkLoadingCompletion(modelsLoaded, modelsToLoad, dracoLoader, resolve);
|
||||
@@ -82,7 +81,7 @@ async function loadInitialFloorItems(
|
||||
// Check IndexedDB
|
||||
const indexedDBModel = await retrieveGLTF(item.modelfileID!);
|
||||
if (indexedDBModel) {
|
||||
// console.log(`[IndexedDB] Fetching ${item.modelName}`);
|
||||
//
|
||||
const blobUrl = URL.createObjectURL(indexedDBModel);
|
||||
loader.load(blobUrl, (gltf) => {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
@@ -103,7 +102,7 @@ async function loadInitialFloorItems(
|
||||
}
|
||||
|
||||
// Fetch from Backend
|
||||
// console.log(`[Backend] Fetching ${item.modelName}`);
|
||||
//
|
||||
const modelUrl = `${url_Backend_dwinzo}/api/v2/AssetFile/${item.modelfileID!}`;
|
||||
loader.load(modelUrl, async (gltf) => {
|
||||
const modelBlob = await fetch(modelUrl).then((res) => res.blob());
|
||||
@@ -121,7 +120,7 @@ async function loadInitialFloorItems(
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// console.log(`Item ${item.modelName} is not near`);
|
||||
//
|
||||
setFloorItems((prevItems) => [
|
||||
...(prevItems || []),
|
||||
{
|
||||
@@ -282,8 +281,8 @@ function processLoadedModel(
|
||||
actionName: "Action 1",
|
||||
actionType: "pickAndPlace",
|
||||
process: {
|
||||
startPoint: [0, 0, 0],
|
||||
endPoint: [0, 0, 0]
|
||||
startPoint: null,
|
||||
endPoint: null
|
||||
},
|
||||
triggers: []
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ async function handleModelLoad(
|
||||
const nextPoint = ConveyorEvent.points[i + 1];
|
||||
|
||||
if (currentPoint.action.triggers.length > 0) {
|
||||
currentPoint.action.triggers[0].triggeredAsset!.triggeredPoint.pointUuid = nextPoint.uuid;
|
||||
currentPoint.action.triggers[0].triggeredAsset!.triggeredPoint!.pointUuid = nextPoint.uuid;
|
||||
currentPoint.action.triggers[0].triggeredAsset!.triggeredAction!.actionUuid = nextPoint.action.actionUuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function assetManager(
|
||||
const taskId = ++currentTaskId; // Increment taskId for each call
|
||||
activePromises.set(taskId, true); // Mark task as active
|
||||
|
||||
// console.log("Received message from worker:", data);
|
||||
//
|
||||
|
||||
if (data.toRemove.length > 0) {
|
||||
data.toRemove.forEach((uuid: string) => {
|
||||
@@ -58,7 +58,7 @@ export default async function assetManager(
|
||||
// Check Three.js Cache
|
||||
const cachedModel = THREE.Cache.get(item.modelfileID!);
|
||||
if (cachedModel) {
|
||||
// console.log(`[Cache] Fetching ${item.modelName}`);
|
||||
//
|
||||
processLoadedModel(cachedModel.scene.clone(), item, itemsGroup, resolve);
|
||||
return;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export default async function assetManager(
|
||||
// Check IndexedDB
|
||||
const indexedDBModel = await retrieveGLTF(item.modelfileID!);
|
||||
if (indexedDBModel) {
|
||||
// console.log(`[IndexedDB] Fetching ${item.modelName}`);
|
||||
//
|
||||
const blobUrl = URL.createObjectURL(indexedDBModel);
|
||||
loader.load(
|
||||
blobUrl,
|
||||
@@ -86,7 +86,7 @@ export default async function assetManager(
|
||||
}
|
||||
|
||||
// Fetch from Backend
|
||||
// console.log(`[Backend] Fetching ${item.modelName}`);
|
||||
//
|
||||
loader.load(
|
||||
modelUrl,
|
||||
async (gltf) => {
|
||||
@@ -114,14 +114,14 @@ export default async function assetManager(
|
||||
|
||||
const existingModel = itemsGroup?.current?.getObjectByProperty("uuid", item.modelUuid);
|
||||
if (existingModel) {
|
||||
// console.log(`Model ${item.modelName} already exists in the scene.`);
|
||||
//
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
const model = gltf;
|
||||
model.uuid = item.modelUuid;
|
||||
model.userData = { name: item.modelName, modelId: item.modelfileID, modelUuid: item.modelUuid };
|
||||
model.userData = { name: item.modelName, modelId: item.modelfileID, modelUuid: item.modelUuid, eventData: item.eventData };
|
||||
model.scale.set(...CONSTANTS.assetConfig.defaultScaleBeforeGsap);
|
||||
model.position.set(...item.position);
|
||||
model.rotation.set(item.rotation.x, item.rotation.y, item.rotation.z);
|
||||
|
||||
Reference in New Issue
Block a user