architwin 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/architwin.d.ts +15 -2
- package/lib/architwin.js +150 -96
- package/lib/atwinui/components/toolbar/i18n.js +2 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.d.ts +2 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.js +15 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +1 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +16 -2
- package/lib/atwinui/events.js +82 -43
- package/lib/loaders/polydrawerLoader.js +3 -0
- package/lib/types.d.ts +4 -2
- package/lib/utils.d.ts +9 -0
- package/lib/utils.js +16 -0
- package/package.json +1 -1
- package/static/utility.css +4 -0
package/lib/architwin.d.ts
CHANGED
|
@@ -435,6 +435,19 @@ declare function renderPolygon(payload: PartitionPayload | Array<Vector3>, updat
|
|
|
435
435
|
* @returns {void}
|
|
436
436
|
*/
|
|
437
437
|
declare function setPolygonPath(id: number, vertices: Array<Vector3>): void;
|
|
438
|
+
/**
|
|
439
|
+
* Enables vertice controls on an existing polygon
|
|
440
|
+
* @param component
|
|
441
|
+
* @returns
|
|
442
|
+
*/
|
|
443
|
+
declare function enableVerticeControls(component: MpSdk.Scene.IComponent): void;
|
|
444
|
+
/**
|
|
445
|
+
* Deletes the edge of a polygon.
|
|
446
|
+
* @param component - The component of the polygon instance
|
|
447
|
+
* @param endPoint - Endpoint of the edge to be deleted
|
|
448
|
+
* @returns
|
|
449
|
+
*/
|
|
450
|
+
declare function deleteEdge(component: MpSdk.Scene.IComponent, endPoint: Vector3): void;
|
|
438
451
|
declare function startDraw(): void;
|
|
439
452
|
declare function exitDraw(): void;
|
|
440
453
|
declare function cancelDraw(): void;
|
|
@@ -442,7 +455,7 @@ declare function getCurrentPolygon(): IObjectData;
|
|
|
442
455
|
/**
|
|
443
456
|
* Wrapper function around toggleMeshChildrenVisibility
|
|
444
457
|
* @param {MpSdk.Scene.IComponent} component - Component of the model
|
|
445
|
-
* @param {string
|
|
458
|
+
* @param {string} name - name of the model
|
|
446
459
|
*/
|
|
447
460
|
declare function toggleWallVisibility(component: MpSdk.Scene.IComponent, name: string): boolean;
|
|
448
461
|
/**
|
|
@@ -620,4 +633,4 @@ declare function unFollowParticipant(unFollowParticipant: any): void;
|
|
|
620
633
|
* @param {Array<PartitionNode>} partitionNodes Array of partition nodes
|
|
621
634
|
*/
|
|
622
635
|
declare function setSpacePartitionNodes(partitionNodes: Array<PartitionNode>): Promise<void>;
|
|
623
|
-
export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable, minimap, _modelDetails, _onMouseClickInstance, transformHistory, _partitionNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, getCurrentFloor, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails, getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject, copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, convertDegRotationToEuler, pauseVideo, playVideo, setVideoPlayback, setAnimationState, showMinimap, hideMinimap, getMapConfig, addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, toggleFitToScreen, getFloors, getLabels, renderMeetingSidebar, createMeetingTemplate, joinMeetingTemplate, meet, dispatchSpaceEvent, subscribeSpaceEvent, unsubscribeSpaceEvent, registerCustomSpaceEvent, initSocketIo, socketEmit, getParticipants, followParticipant, unFollowParticipant, enableHUD, disableHUD, getMediaScreenHUDs, canSetHud, saveMediaScreenHud, removeMediaScreenHud, enableFitScreen, disableFitScreen, initToolbarUI, themeManager, convertToEuler, disableSweeps, enableSweep, disableSweep, tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight, setSpacePartitionNodes, getSpaceId, getCurrentPolygon };
|
|
636
|
+
export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable, minimap, _modelDetails, _onMouseClickInstance, transformHistory, _partitionNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, getCurrentFloor, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails, getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject, copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, convertDegRotationToEuler, pauseVideo, playVideo, setVideoPlayback, setAnimationState, showMinimap, hideMinimap, getMapConfig, addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, toggleFitToScreen, getFloors, getLabels, renderMeetingSidebar, createMeetingTemplate, joinMeetingTemplate, meet, dispatchSpaceEvent, subscribeSpaceEvent, unsubscribeSpaceEvent, registerCustomSpaceEvent, initSocketIo, socketEmit, getParticipants, followParticipant, unFollowParticipant, enableHUD, disableHUD, getMediaScreenHUDs, canSetHud, saveMediaScreenHud, removeMediaScreenHud, enableFitScreen, disableFitScreen, initToolbarUI, themeManager, convertToEuler, disableSweeps, enableSweep, disableSweep, tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight, enableVerticeControls, deleteEdge, setSpacePartitionNodes, getSpaceId, getCurrentPolygon };
|
package/lib/architwin.js
CHANGED
|
@@ -11,7 +11,7 @@ import axios from "axios";
|
|
|
11
11
|
import { planeType, planeFactory,
|
|
12
12
|
// planeType2,
|
|
13
13
|
planeImageFactory, planeVideoFactory, planePdfFactory, setHudState, gltfType, gltfFactory, boxType, boxFactory, textType, textFactory, css3DType, css3DFactory, planeTypeImage, planeTypeVideo, planeTypePdf, sweepPuckType, puckBackgroundFactory, viewpointType, viewpointFactory, tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry } from "./loaders";
|
|
14
|
-
import { meterToMillimeter, generateUUID, formatMatterportUrl, initBundleVersion, isEqual } from "./utils";
|
|
14
|
+
import { meterToMillimeter, generateUUID, formatMatterportUrl, initBundleVersion, isEqual, replaceWordInString } from "./utils";
|
|
15
15
|
import { initToolbarUI, themeManager, toggleActionBarButtons, setActiveActionBtn } from "./atwinui";
|
|
16
16
|
import { SPACE_EVENTS, } from "./types";
|
|
17
17
|
import * as JSZip from "jszip";
|
|
@@ -202,11 +202,12 @@ let _visualize = true, _editPolygonMode = false, _drawPolygonMode = false, _tube
|
|
|
202
202
|
// _thisVertexComponent:MpSdk.Scene.IComponent, // Current Vertex Component
|
|
203
203
|
// _thisVerticeNode:MpSdk.Scene.INode, // Current VerticeNode
|
|
204
204
|
// _thisVertexPath = new Array()
|
|
205
|
-
let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath, _verticeComponentsCollection = [], _highestYaxisPoint, _polygonFloorOffset = 0.1, _autoLevelFloorEnabled = true, _floorBaseHeight;
|
|
205
|
+
let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath, _verticeComponentsCollection = [], _vertexConnectiveComponentCollection = [], _vertexConnectiveNodeCollection = [], _highestYaxisPoint, _polygonFloorOffset = 0.1, _autoLevelFloorEnabled = true, _floorBaseHeight, _offsetedBaseHeight = _floorBaseHeight ? _floorBaseHeight + _polygonFloorOffset : undefined;
|
|
206
206
|
let _intersectionData, _tubes, _verticeEmitPath, _verticeEditEmitPath;
|
|
207
207
|
let _navigationInputNode;
|
|
208
208
|
let _navigationComponent;
|
|
209
209
|
let _isNavigationComponentCreated = false;
|
|
210
|
+
let _isVerticeClickSpyCreated = false;
|
|
210
211
|
//Pathfinding TubeLine
|
|
211
212
|
let _currentPathfindingTubeline;
|
|
212
213
|
let _tubeLinePath;
|
|
@@ -5216,8 +5217,6 @@ function renderPolygon(payload, updatePolygon = false) {
|
|
|
5216
5217
|
setPolygonPath(_3DXObjects[index].object.id, payload);
|
|
5217
5218
|
}
|
|
5218
5219
|
}
|
|
5219
|
-
if (updatePolygon) {
|
|
5220
|
-
}
|
|
5221
5220
|
}
|
|
5222
5221
|
else {
|
|
5223
5222
|
polyNode = _sceneObject.addNode();
|
|
@@ -5313,6 +5312,7 @@ function addVerticeControls(component, index) {
|
|
|
5313
5312
|
// Trigger onInputsUpdated
|
|
5314
5313
|
_activeVertex.inputs.active = false;
|
|
5315
5314
|
if (_currentPolygon) {
|
|
5315
|
+
//setSelectedObject(_currentPolygon.object,_currentPolygon.node,_currentPolygon.component, 'POLYGON')
|
|
5316
5316
|
setPolygonPath(_currentPolygon.object.id, _thisVertexPath);
|
|
5317
5317
|
}
|
|
5318
5318
|
//@ts-expect-error
|
|
@@ -5351,12 +5351,74 @@ function createVerticeControls(component, isDeleting = false) {
|
|
|
5351
5351
|
}
|
|
5352
5352
|
verticeNode.start();
|
|
5353
5353
|
}
|
|
5354
|
+
/**
|
|
5355
|
+
* Creates the individual vertex nodes and components and attached vertice controls
|
|
5356
|
+
* @param {Vector3} position - Coordinates
|
|
5357
|
+
*/
|
|
5358
|
+
function createVertexPoints(position, redrawing = false) {
|
|
5359
|
+
log.info("createVertexPoints()");
|
|
5360
|
+
if (!position) {
|
|
5361
|
+
log.error("Position is undefined");
|
|
5362
|
+
return;
|
|
5363
|
+
}
|
|
5364
|
+
// If no node is active
|
|
5365
|
+
if (_thisVertexNode === undefined) {
|
|
5366
|
+
log.info("_thisVertexNode is undefined. Adding vertex...");
|
|
5367
|
+
let start = Object.assign({}, position);
|
|
5368
|
+
log.info("_floorBaseHeight", _floorBaseHeight);
|
|
5369
|
+
if (_floorBaseHeight !== undefined) {
|
|
5370
|
+
log.info("Using _floorBaseHeight");
|
|
5371
|
+
start.y = _floorBaseHeight;
|
|
5372
|
+
}
|
|
5373
|
+
if (redrawing == false) {
|
|
5374
|
+
start.y += _polygonFloorOffset;
|
|
5375
|
+
}
|
|
5376
|
+
// Generate Tag ID from position
|
|
5377
|
+
const r = (x) => Math.round(x * 100) / 100;
|
|
5378
|
+
let thisName = "x" + r(start.x) + "y" + r(start.y) + "z" + r(start.z);
|
|
5379
|
+
if (redrawing) {
|
|
5380
|
+
thisName = `${thisName}-${uid.rnd()}`;
|
|
5381
|
+
}
|
|
5382
|
+
//@ts-expect-error
|
|
5383
|
+
[_thisVertexNode, _thisVertexComponent] = addVertex(thisName, [start]);
|
|
5384
|
+
_thisVertexPath.push(start);
|
|
5385
|
+
log.info("_thisVertexPath ", _thisVertexPath);
|
|
5386
|
+
if (visualize) {
|
|
5387
|
+
_activeVertex.inputs.collider = false;
|
|
5388
|
+
}
|
|
5389
|
+
//Add to the array so we can re enable the vertex controls of the polygon later
|
|
5390
|
+
_vertexConnectiveComponentCollection.push(_thisVertexComponent);
|
|
5391
|
+
_vertexConnectiveNodeCollection.push(_thisVertexNode);
|
|
5392
|
+
log.info("_thisVertexNode ", _thisVertexNode);
|
|
5393
|
+
createVerticeControls(_thisVertexComponent);
|
|
5394
|
+
}
|
|
5395
|
+
else {
|
|
5396
|
+
log.info("_thisVertexNode is defined");
|
|
5397
|
+
log.info("before position ", position);
|
|
5398
|
+
log.info("before _floorBaseHeight ", _floorBaseHeight);
|
|
5399
|
+
let point = Object.assign({}, position);
|
|
5400
|
+
// _intersectionData.position.y += (_highestYaxisPoint + _polygonFloorOffset)
|
|
5401
|
+
if (_floorBaseHeight !== undefined) {
|
|
5402
|
+
point = {
|
|
5403
|
+
x: position.x,
|
|
5404
|
+
y: _floorBaseHeight,
|
|
5405
|
+
z: position.z
|
|
5406
|
+
};
|
|
5407
|
+
}
|
|
5408
|
+
//point.y += _polygonFloorOffset
|
|
5409
|
+
log.info("after position ", point);
|
|
5410
|
+
_thisVertexPath.push(Object.assign({}, point));
|
|
5411
|
+
_thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5412
|
+
// Show Vertices
|
|
5413
|
+
createVerticeControls(_thisVertexComponent);
|
|
5414
|
+
}
|
|
5415
|
+
}
|
|
5354
5416
|
function createVerticeClickSpy() {
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5417
|
+
log.info("createVerticeClickSpy()");
|
|
5418
|
+
if (_isVerticeClickSpyCreated) {
|
|
5419
|
+
log.info("Vertice click spy has already been created");
|
|
5420
|
+
return;
|
|
5421
|
+
}
|
|
5360
5422
|
const click_path = _sceneObject.addPath({
|
|
5361
5423
|
id: "clicklistener",
|
|
5362
5424
|
type: _atwin.Scene.PathType.EMIT,
|
|
@@ -5372,65 +5434,46 @@ function createVerticeClickSpy() {
|
|
|
5372
5434
|
log.info("isCtrlPressed ", isCtrlPressed);
|
|
5373
5435
|
if (isCtrlPressed) {
|
|
5374
5436
|
if (_drawPolygonMode) {
|
|
5437
|
+
createVertexPoints(_intersectionData.position);
|
|
5375
5438
|
// If no node is active
|
|
5376
|
-
if (_thisVertexNode === undefined) {
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
}
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
// _highestYaxisPoint = _intersectionData.position.y
|
|
5415
|
-
// }
|
|
5416
|
-
// if (_floorBaseHeight !== undefined && _floorBaseHeight > _highestYaxisPoint) {
|
|
5417
|
-
// _highestYaxisPoint = _floorBaseHeight
|
|
5418
|
-
// }
|
|
5419
|
-
// _intersectionData.position.y += (_highestYaxisPoint + _polygonFloorOffset)
|
|
5420
|
-
if (_floorBaseHeight !== undefined) {
|
|
5421
|
-
point = {
|
|
5422
|
-
x: _intersectionData.position.x,
|
|
5423
|
-
y: _floorBaseHeight,
|
|
5424
|
-
z: _intersectionData.position.z
|
|
5425
|
-
};
|
|
5426
|
-
}
|
|
5427
|
-
//point.y += _polygonFloorOffset
|
|
5428
|
-
log.info("after _intersectionData.position ", point);
|
|
5429
|
-
_thisVertexPath.push(Object.assign({}, point));
|
|
5430
|
-
_thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5431
|
-
// Show Vertices
|
|
5432
|
-
createVerticeControls(_thisVertexComponent);
|
|
5433
|
-
}
|
|
5439
|
+
// if (_thisVertexNode === undefined) {
|
|
5440
|
+
// let start = { ..._intersectionData.position };
|
|
5441
|
+
// log.info("_floorBaseHeight", _floorBaseHeight)
|
|
5442
|
+
// if (_floorBaseHeight !== undefined) {
|
|
5443
|
+
// log.info("Using _floorBaseHeight")
|
|
5444
|
+
// start.y = _floorBaseHeight
|
|
5445
|
+
// }
|
|
5446
|
+
// start.y += _polygonFloorOffset
|
|
5447
|
+
// // Generate Tag ID from position
|
|
5448
|
+
// const r = (x) => Math.round(x * 100) / 100;
|
|
5449
|
+
// let thisName = "x" + r(start.x) + "y" + r(start.y) + "z" + r(start.z);
|
|
5450
|
+
// //@ts-expect-error
|
|
5451
|
+
// [_thisVertexNode, _thisVertexComponent] = addVertex(thisName, [start]);
|
|
5452
|
+
// _thisVertexPath.push(start);
|
|
5453
|
+
// log.info("_thisVertexPath ", _thisVertexPath)
|
|
5454
|
+
// if (visualize) {
|
|
5455
|
+
// _activeVertex.inputs.collider = false;
|
|
5456
|
+
// }
|
|
5457
|
+
// createVerticeControls(_thisVertexComponent);
|
|
5458
|
+
// } else {
|
|
5459
|
+
// log.info("before _intersectionData.position ",_intersectionData.position)
|
|
5460
|
+
// log.info("before _floorBaseHeight ",_floorBaseHeight)
|
|
5461
|
+
// let point = {..._intersectionData.position}
|
|
5462
|
+
// // _intersectionData.position.y += (_highestYaxisPoint + _polygonFloorOffset)
|
|
5463
|
+
// if (_floorBaseHeight !== undefined) {
|
|
5464
|
+
// point = {
|
|
5465
|
+
// x: _intersectionData.position.x,
|
|
5466
|
+
// y: _floorBaseHeight,
|
|
5467
|
+
// z: _intersectionData.position.z
|
|
5468
|
+
// }
|
|
5469
|
+
// }
|
|
5470
|
+
// //point.y += _polygonFloorOffset
|
|
5471
|
+
// log.info("after _intersectionData.position ",point)
|
|
5472
|
+
// _thisVertexPath.push({ ...point });
|
|
5473
|
+
// _thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5474
|
+
// // Show Vertices
|
|
5475
|
+
// createVerticeControls(_thisVertexComponent);
|
|
5476
|
+
// }
|
|
5434
5477
|
dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, {
|
|
5435
5478
|
position: _intersectionData.position,
|
|
5436
5479
|
path: _thisVertexPath
|
|
@@ -5439,8 +5482,8 @@ function createVerticeClickSpy() {
|
|
|
5439
5482
|
}
|
|
5440
5483
|
},
|
|
5441
5484
|
};
|
|
5442
|
-
//_sceneObject.spyOnEvent(new VerticeClickSpy(_verticeEmitPath,dispatchSpaceEvent))
|
|
5443
5485
|
_sceneObject.spyOnEvent(click_spy);
|
|
5486
|
+
_isVerticeClickSpyCreated = true;
|
|
5444
5487
|
}
|
|
5445
5488
|
/**
|
|
5446
5489
|
* Removes a vertex sphere from the space. If no argument is passed it will remove the last vertex that has been added
|
|
@@ -5497,9 +5540,34 @@ function enableVerticeControls(component) {
|
|
|
5497
5540
|
log.error("Path of component is empty or undefined");
|
|
5498
5541
|
return;
|
|
5499
5542
|
}
|
|
5500
|
-
|
|
5543
|
+
startDraw();
|
|
5544
|
+
//@ts-expect-error
|
|
5545
|
+
const currenPath = [...component.inputs.path];
|
|
5546
|
+
const last = currenPath.pop();
|
|
5547
|
+
log.info("currenPath ", currenPath);
|
|
5548
|
+
////@ts-expect-error
|
|
5549
|
+
_thisVertexPath = [...currenPath];
|
|
5550
|
+
const first = _thisVertexPath[0];
|
|
5551
|
+
const r = (x) => Math.round(x * 100) / 100;
|
|
5552
|
+
let name = "x" + r(first.x) + "y" + r(first.y) + "z" + r(first.z);
|
|
5553
|
+
name = `${name}-${uid.rnd()}`;
|
|
5554
|
+
//@ts-expect-error
|
|
5555
|
+
[_thisVertexNode, _thisVertexComponent] = addVertex(name, _thisVertexPath);
|
|
5556
|
+
log.info("_thisVertexPath ", _thisVertexPath);
|
|
5557
|
+
if (visualize) {
|
|
5558
|
+
_activeVertex.inputs.collider = false;
|
|
5559
|
+
}
|
|
5560
|
+
_thisVertexPath.push(Object.assign({}, last));
|
|
5561
|
+
_thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5562
|
+
createVerticeControls(_thisVertexComponent);
|
|
5501
5563
|
}
|
|
5502
|
-
|
|
5564
|
+
/**
|
|
5565
|
+
* Deletes the edge of a polygon.
|
|
5566
|
+
* @param component - The component of the polygon instance
|
|
5567
|
+
* @param endPoint - Endpoint of the edge to be deleted
|
|
5568
|
+
* @returns
|
|
5569
|
+
*/
|
|
5570
|
+
function deleteEdge(component, endPoint) {
|
|
5503
5571
|
log.info("deletePolygonLine()");
|
|
5504
5572
|
if (!component) {
|
|
5505
5573
|
log.error("Component is undefined");
|
|
@@ -5662,7 +5730,7 @@ function toggleMeshChildrenVisibility(component, name) {
|
|
|
5662
5730
|
/**
|
|
5663
5731
|
* Wrapper function around toggleMeshChildrenVisibility
|
|
5664
5732
|
* @param {MpSdk.Scene.IComponent} component - Component of the model
|
|
5665
|
-
* @param {string
|
|
5733
|
+
* @param {string} name - name of the model
|
|
5666
5734
|
*/
|
|
5667
5735
|
function toggleWallVisibility(component, name) {
|
|
5668
5736
|
if (!component) {
|
|
@@ -5674,6 +5742,8 @@ function toggleWallVisibility(component, name) {
|
|
|
5674
5742
|
return;
|
|
5675
5743
|
}
|
|
5676
5744
|
const state = toggleMeshChildrenVisibility(component, name);
|
|
5745
|
+
const wallLabelName = replaceWordInString(name, 'wall', 'wallLabel');
|
|
5746
|
+
toggleMeshChildrenVisibility(component, wallLabelName);
|
|
5677
5747
|
return state;
|
|
5678
5748
|
}
|
|
5679
5749
|
/**
|
|
@@ -5753,12 +5823,14 @@ function setFloorBaseHeight(baseHeight) {
|
|
|
5753
5823
|
return;
|
|
5754
5824
|
}
|
|
5755
5825
|
_floorBaseHeight = baseHeight;
|
|
5826
|
+
_offsetedBaseHeight = _floorBaseHeight + _polygonFloorOffset;
|
|
5756
5827
|
}
|
|
5757
5828
|
/**
|
|
5758
5829
|
* Clear the value of the base height for floors of polygons
|
|
5759
5830
|
*/
|
|
5760
5831
|
function clearFloorBaseHeight() {
|
|
5761
5832
|
_floorBaseHeight = undefined;
|
|
5833
|
+
_offsetedBaseHeight = undefined;
|
|
5762
5834
|
}
|
|
5763
5835
|
//===================== END VERTEX DRAWING METHODS =========================//
|
|
5764
5836
|
//===================== START KEYBINDINGS =========================//
|
|
@@ -5783,6 +5855,10 @@ function handleKeyUp(event) {
|
|
|
5783
5855
|
}
|
|
5784
5856
|
function setupKeybindingEventListeners(iframe) {
|
|
5785
5857
|
log.info("setupKeybindingEventListeners()");
|
|
5858
|
+
if (!_navigationInputNode || !_navigationComponent) {
|
|
5859
|
+
log.info("Navigation node and component is undefined. Skipping key binding creation");
|
|
5860
|
+
return;
|
|
5861
|
+
}
|
|
5786
5862
|
iframe.contentDocument.body.addEventListener('keydown', handleKeyDown);
|
|
5787
5863
|
iframe.contentDocument.body.addEventListener('keyup', handleKeyUp);
|
|
5788
5864
|
window.addEventListener('keydown', handleKeyDown);
|
|
@@ -6738,35 +6814,13 @@ class PolygonClickSpy {
|
|
|
6738
6814
|
_currentPolygon = {
|
|
6739
6815
|
node: this.node,
|
|
6740
6816
|
component: this.component,
|
|
6741
|
-
object: this.object_data
|
|
6817
|
+
object: this.object_data,
|
|
6818
|
+
type: 'POLYGON'
|
|
6742
6819
|
};
|
|
6743
6820
|
}
|
|
6744
6821
|
}
|
|
6745
6822
|
}
|
|
6746
6823
|
}
|
|
6747
|
-
class VerticeEditSpy {
|
|
6748
|
-
constructor(path, callback) {
|
|
6749
|
-
this.path = path;
|
|
6750
|
-
this.callback = callback;
|
|
6751
|
-
}
|
|
6752
|
-
onEvent(data) {
|
|
6753
|
-
log.info("VerticeEditSpy");
|
|
6754
|
-
// if (data.collider !== null) {
|
|
6755
|
-
// const nodeIterator = _tubes.nodeIterator();
|
|
6756
|
-
// let nodes = nodeIterator.next();
|
|
6757
|
-
// while (!nodes.done) {
|
|
6758
|
-
// const componentIterator = nodes.value.componentIterator();
|
|
6759
|
-
// let component = componentIterator.next();
|
|
6760
|
-
// component.value.inputs.collider = data.collider;
|
|
6761
|
-
// nodes = nodeIterator.next();
|
|
6762
|
-
// }
|
|
6763
|
-
// }
|
|
6764
|
-
// // Trigger onInputsUpdated
|
|
6765
|
-
// _activeVertex.inputs.active = false;
|
|
6766
|
-
// _activeVertex.inputs.path[data.index] = data.position;
|
|
6767
|
-
// _activeVertex.inputs.active = true;
|
|
6768
|
-
}
|
|
6769
|
-
}
|
|
6770
6824
|
export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable,
|
|
6771
6825
|
//minimap
|
|
6772
6826
|
minimap, _modelDetails, _onMouseClickInstance, transformHistory,
|
|
@@ -6824,7 +6878,7 @@ initToolbarUI, themeManager,
|
|
|
6824
6878
|
//utils
|
|
6825
6879
|
convertToEuler, disableSweeps, enableSweep, disableSweep,
|
|
6826
6880
|
//Draw polygon
|
|
6827
|
-
tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight,
|
|
6881
|
+
tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight, enableVerticeControls, deleteEdge,
|
|
6828
6882
|
// Space partition
|
|
6829
6883
|
setSpacePartitionNodes,
|
|
6830
6884
|
// others
|
|
@@ -117,6 +117,7 @@ i18n
|
|
|
117
117
|
"MarkBaseHeight": "Click to mark an area as your desired base height",
|
|
118
118
|
"Saving": "Saving",
|
|
119
119
|
"DeletePartition": "Delete Partition",
|
|
120
|
+
"ModifyPartition": "Modify Partition"
|
|
120
121
|
}
|
|
121
122
|
},
|
|
122
123
|
ja: {
|
|
@@ -228,6 +229,7 @@ i18n
|
|
|
228
229
|
"NoPartitionDeleted": "削除できる区画がありません",
|
|
229
230
|
"Saving": "保存",
|
|
230
231
|
"DeletePartition": "パーティション削除",
|
|
232
|
+
"ModifyPartition": "パーティションの変更"
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
235
|
},
|
|
@@ -72,3 +72,5 @@ export declare function setCurrentPartitionData(): Promise<void>;
|
|
|
72
72
|
export declare function getCurrentPartitionData(): PartitionNode;
|
|
73
73
|
export declare function getNewlyAddedPartition(): Array<PartitionNode>;
|
|
74
74
|
export declare function getDeletedSavedPartitionArray(): Array<PartitionNode>;
|
|
75
|
+
export declare function getDrawingMode(): boolean;
|
|
76
|
+
export declare function setDrawingMode(state: boolean): void;
|
|
@@ -15,6 +15,7 @@ import { generateUUID, extractUUID } from '../../../../utils';
|
|
|
15
15
|
import { getCurrentEditRoomData } from './roomTreePane';
|
|
16
16
|
import { toggleModal, setModalAction } from "../modal";
|
|
17
17
|
import { Notyf } from 'notyf';
|
|
18
|
+
import log from 'loglevel';
|
|
18
19
|
let isDrawing = false;
|
|
19
20
|
let roomFormMode = "ADD" /* FORM_MODE.ADD */;
|
|
20
21
|
let isSaving = false;
|
|
@@ -69,6 +70,10 @@ export function renderRoomFormPane() {
|
|
|
69
70
|
${i18n.t('DrawPartition')}
|
|
70
71
|
<span class="mdi mdi-cube-outline"></span>
|
|
71
72
|
</div>
|
|
73
|
+
<div class="at_button at_draw_partition_btn at_w-full at_hidden" id="at-modify-partition-form-btn" data-cy="at-modify-partition-form-btn">
|
|
74
|
+
${i18n.t('ModifyPartition')}
|
|
75
|
+
<span class="mdi mdi-cube-outline"></span>
|
|
76
|
+
</div>
|
|
72
77
|
<div class="at_partition_list_container at_h-min-40" id="at-partition-list-container" data-cy="at-partition-list-container">
|
|
73
78
|
<div class="at_face_title" id="at-face-title" style="display: none;">
|
|
74
79
|
<span class="mdi mdi-chevron-left" id="at-back-partition"></span>
|
|
@@ -818,3 +823,13 @@ export function getNewlyAddedPartition() {
|
|
|
818
823
|
export function getDeletedSavedPartitionArray() {
|
|
819
824
|
return deletedSavedPartitionArray;
|
|
820
825
|
}
|
|
826
|
+
export function getDrawingMode() {
|
|
827
|
+
return isDrawing;
|
|
828
|
+
}
|
|
829
|
+
export function setDrawingMode(state) {
|
|
830
|
+
if (typeof state !== 'boolean') {
|
|
831
|
+
log.error("Invalid parameter value");
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
isDrawing = state;
|
|
835
|
+
}
|
|
@@ -14,6 +14,7 @@ import { setPartitionFormMode } from "./roomFormPane";
|
|
|
14
14
|
import { _3DXObjects } from "../../../../architwin";
|
|
15
15
|
let roomDataArray = [];
|
|
16
16
|
let currentEditRoomData = null;
|
|
17
|
+
let currentSelectedPartitionId = null;
|
|
17
18
|
/**
|
|
18
19
|
* Renders and returns the HTML element for the room tree pane.
|
|
19
20
|
* @returns {HTMLElement} The HTML element representing the room tree pane.
|
|
@@ -107,7 +108,7 @@ export function displayPartition(partition) {
|
|
|
107
108
|
element.innerHTML = `
|
|
108
109
|
<li class="at_room_tree_parent">
|
|
109
110
|
<div class="at_flex at_space_between at_toggle">
|
|
110
|
-
<span class="toggle selectable" >▶ ${partition.name}</span>
|
|
111
|
+
<span class="toggle selectable" id="at-room-${partition.uuid}">▶ ${partition.name}</span>
|
|
111
112
|
<div>
|
|
112
113
|
<span id="at-room-edit-${partition.uuid}-btn" class="mdi mdi-pencil at_room_edit_btn" target-pane="at-room-form-pane"></span>
|
|
113
114
|
<span id="at-room-visibility-${partition.uuid}-btn" class="mdi mdi-eye at_room_visible_btn"></span>
|
|
@@ -137,7 +138,7 @@ export function displayPartitions(partitions, partitionId) {
|
|
|
137
138
|
let partitionHTML = `
|
|
138
139
|
<li class="at_room_tree_child">
|
|
139
140
|
<div class="at_flex at_space_between at_toggle">
|
|
140
|
-
<span class="toggle selectable">▶ ${i18n.t(`${partitionItem[0]}`)} ${partitionItem[1]}</span>
|
|
141
|
+
<span class="toggle selectable" id="at-partition-${partition.uuid}" parentId="at-partition-${partitionId}">▶ ${i18n.t(`${partitionItem[0]}`)} ${partitionItem[1]}</span>
|
|
141
142
|
<div>
|
|
142
143
|
<span id="at-partition-visibility-${partition.uuid}-btn" class="mdi mdi-eye at_room_visible_btn"></span>
|
|
143
144
|
</div>
|
|
@@ -199,6 +200,13 @@ function toggleSelectedPartition() {
|
|
|
199
200
|
try {
|
|
200
201
|
document.querySelectorAll('.at_room_tree .toggle, .at_room_tree .selectable').forEach(function (item) {
|
|
201
202
|
item.addEventListener('click', function (event) {
|
|
203
|
+
const targetElement = event.target;
|
|
204
|
+
const partitionId = extractUUID(targetElement.id);
|
|
205
|
+
setSelectedPartitionId(partitionId);
|
|
206
|
+
if (item.getAttribute('parentId')) {
|
|
207
|
+
const parentnId = extractUUID(item.getAttribute('parentId'));
|
|
208
|
+
setSelectedPartitionId(parentnId);
|
|
209
|
+
}
|
|
202
210
|
// Prevent event from propagating to parent elements
|
|
203
211
|
event.stopPropagation();
|
|
204
212
|
// Find the parent div of the clicked toggle
|
|
@@ -328,3 +336,9 @@ function setCurrentEditRoomData(id) {
|
|
|
328
336
|
export function getCurrentEditRoomData() {
|
|
329
337
|
return currentEditRoomData;
|
|
330
338
|
}
|
|
339
|
+
function setSelectedPartitionId(partitionId) {
|
|
340
|
+
currentSelectedPartitionId = partitionId;
|
|
341
|
+
}
|
|
342
|
+
export function getSelectedPartitionId() {
|
|
343
|
+
return currentSelectedPartitionId;
|
|
344
|
+
}
|
package/lib/atwinui/events.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { actionBar, renderObjectCards, renderLibraryCards, renderTags, renderTagRow, getTagFormData, addClickEventToTagRow, setActiveCard, setActiveMenu, removeObjectCard, setTagCategoriesOption, toggleDropdown, tagFormMode, selectedTag, renderRecepientOptions, renderTagMessages, createTagMessage, setTagLink, setTagMessagingDetails, renderCategoryDropdownOptions, clearTagFormDropdown, clearActiveActionBtn, clearActiveCard, toggleActionBarButtons, selectedCategoryFilterId, selectedSubCategoryFilterId, filterTagList, toggleModal, setModalAction } from "./components/toolbar";
|
|
11
|
-
import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId,
|
|
11
|
+
import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, enableVerticeControls, cancelDraw, } from "../architwin";
|
|
12
12
|
import { Notyf } from 'notyf';
|
|
13
13
|
import 'notyf/notyf.min.css';
|
|
14
14
|
import { SPACE_EVENTS } from "../types";
|
|
@@ -23,8 +23,8 @@ import { isValidUrl, debounce } from "../utils";
|
|
|
23
23
|
import log from 'loglevel';
|
|
24
24
|
import * as minimap from '../minimap';
|
|
25
25
|
import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
|
|
26
|
-
import { getCurrentEditRoomData, displayRoomTree, updateParentVisibility } from "./components/toolbar/spacePartition/roomTreePane";
|
|
27
|
-
import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition } from "./components/toolbar/spacePartition/roomFormPane";
|
|
26
|
+
import { getCurrentEditRoomData, displayRoomTree, updateParentVisibility, getSelectedPartitionId } from "./components/toolbar/spacePartition/roomTreePane";
|
|
27
|
+
import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setDrawingMode, getDrawingMode } from "./components/toolbar/spacePartition/roomFormPane";
|
|
28
28
|
let activeToolbarItem, activeActionItem, activePane, activeActionPane, cancelTagPlacementPrompt, cancelModelPlacementPrompt;
|
|
29
29
|
let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, types: [
|
|
30
30
|
{
|
|
@@ -248,13 +248,14 @@ function setupIndividualEventListeners() {
|
|
|
248
248
|
handleSaveTheme();
|
|
249
249
|
handlePartitionDisplay();
|
|
250
250
|
handleDrawPartition();
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
handleSavePartition();
|
|
252
|
+
handleDeletePartition();
|
|
253
|
+
handleCancelPartition();
|
|
254
254
|
//handleToggleFloorLevelInput()
|
|
255
255
|
handleFloorLevelInputChange();
|
|
256
256
|
handleMarkFloor();
|
|
257
257
|
handleSpacePartitionReport();
|
|
258
|
+
handleModifyPartition();
|
|
258
259
|
}
|
|
259
260
|
//================ OBJECT EVENT HANDLERS ===============//
|
|
260
261
|
function handleTranslateObject() {
|
|
@@ -1085,6 +1086,7 @@ function setupSpaceEventSubscriptions() {
|
|
|
1085
1086
|
subscribeSpaceEvent(SPACE_EVENTS.TAGPLACER_CREATED, handleTagPlacerCreated);
|
|
1086
1087
|
subscribeSpaceEvent(SPACE_EVENTS.PARTITION_UPDATED, handlePolygonData);
|
|
1087
1088
|
subscribeSpaceEvent(SPACE_EVENTS.UPDATE_ROOM_TREE, handleUpdateRoomTree);
|
|
1089
|
+
subscribeSpaceEvent(SPACE_EVENTS.PARTITION_CLICKED, handlePartitionSelected);
|
|
1088
1090
|
// subscribeSpaceEvent(SPACE_EVENTS.PARTITION_RENDERED, handlePolygonObjectData)
|
|
1089
1091
|
}
|
|
1090
1092
|
function handlePolygonData(payload) {
|
|
@@ -1370,9 +1372,7 @@ function handleDrawPartition() {
|
|
|
1370
1372
|
});
|
|
1371
1373
|
}
|
|
1372
1374
|
function handleSavePartition() {
|
|
1373
|
-
|
|
1374
|
-
function handleSaveRoom() {
|
|
1375
|
-
log.info("__@ handleSaveRoom()");
|
|
1375
|
+
log.info("__@ handleSavePartition()");
|
|
1376
1376
|
const saveRoomBtn = document.getElementById('at-save-room-btn');
|
|
1377
1377
|
saveRoomBtn.addEventListener('click', () => {
|
|
1378
1378
|
document.getElementById('at-save-room-btn').innerHTML = `
|
|
@@ -1416,8 +1416,8 @@ function handleSaveRoom() {
|
|
|
1416
1416
|
notyf.success(`${i18n.t('SuccessRoomSaved')}`);
|
|
1417
1417
|
});
|
|
1418
1418
|
}
|
|
1419
|
-
function
|
|
1420
|
-
log.info("
|
|
1419
|
+
function handleDeletePartition() {
|
|
1420
|
+
log.info("handleDeletePartition()");
|
|
1421
1421
|
const deleteRoomBtn = document.getElementById('at-delete-room-btn');
|
|
1422
1422
|
deleteRoomBtn.addEventListener('click', () => {
|
|
1423
1423
|
const currentEditRoomData = getCurrentEditRoomData();
|
|
@@ -1447,7 +1447,7 @@ function handeDeleteRoom() {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
});
|
|
1449
1449
|
}
|
|
1450
|
-
function
|
|
1450
|
+
function handleCancelPartition() {
|
|
1451
1451
|
const cancelRoomBtn = document.getElementById('at-cancel-room-form-btn');
|
|
1452
1452
|
cancelRoomBtn.addEventListener('click', () => {
|
|
1453
1453
|
getNewlyAddedPartition().map(partition => {
|
|
@@ -1503,8 +1503,13 @@ function handleSpacePartitionReport() {
|
|
|
1503
1503
|
if (_partitionNodes.length > 0) {
|
|
1504
1504
|
// Should route to report page
|
|
1505
1505
|
const spaceId = getSpaceId(window.location.href);
|
|
1506
|
-
|
|
1507
|
-
|
|
1506
|
+
const partitionId = getSelectedPartitionId();
|
|
1507
|
+
const paylaod = {
|
|
1508
|
+
spaceId: spaceId,
|
|
1509
|
+
partitionId: partitionId
|
|
1510
|
+
};
|
|
1511
|
+
log.info("__@ Report payload", paylaod);
|
|
1512
|
+
dispatchSpaceEvent(SPACE_EVENTS.DISPLAY_SPACE_PARTITION_REPORT, paylaod);
|
|
1508
1513
|
}
|
|
1509
1514
|
else {
|
|
1510
1515
|
// Nothing to display
|
|
@@ -1517,41 +1522,12 @@ function handleSpacePartitionReport() {
|
|
|
1517
1522
|
log.error("Error report: ", error);
|
|
1518
1523
|
}
|
|
1519
1524
|
}
|
|
1520
|
-
/**
|
|
1521
|
-
* Toggles the enabled state of the floor level input based on the checkbox state.
|
|
1522
|
-
*/
|
|
1523
|
-
function handleToggleFloorLevelInput() {
|
|
1524
|
-
const checkbox = document.getElementById('at-floor-offset-checkbox');
|
|
1525
|
-
const floorLevelInput = document.getElementById('at-room-floor-level-input');
|
|
1526
|
-
floorLevelInput.disabled = !checkbox.checked;
|
|
1527
|
-
checkbox.addEventListener('change', (e) => {
|
|
1528
|
-
const floorLevelInput = document.getElementById('at-room-floor-level-input');
|
|
1529
|
-
const isChecked = e.target.checked; // Get the checked state
|
|
1530
|
-
log.info("Checkbox checked state:", isChecked);
|
|
1531
|
-
floorLevelInput.disabled = !isChecked;
|
|
1532
|
-
if (isChecked == false) {
|
|
1533
|
-
floorLevelInput.classList.add('at_disabled');
|
|
1534
|
-
floorLevelInput.value = '0';
|
|
1535
|
-
setPolygonFloorOffset(0);
|
|
1536
|
-
}
|
|
1537
|
-
else {
|
|
1538
|
-
floorLevelInput.value = getPolygonFloorOffset().toString();
|
|
1539
|
-
floorLevelInput.classList.remove('at_disabled');
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
1525
|
function handleFloorLevelInputChange() {
|
|
1544
1526
|
const floorLevelInput = document.getElementById('at-room-floor-level-input');
|
|
1545
1527
|
// Function to handle input change
|
|
1546
1528
|
const handleInputChange = debounce(() => {
|
|
1547
1529
|
const newFloorLevel = Number.parseFloat(floorLevelInput.value);
|
|
1548
1530
|
if (!isNaN(newFloorLevel)) {
|
|
1549
|
-
// if (newOffset > 2) {
|
|
1550
|
-
// notyf.open({
|
|
1551
|
-
// type: 'info',
|
|
1552
|
-
// message: 'Your offset value is very high. Consider lowering it'
|
|
1553
|
-
// })
|
|
1554
|
-
// }
|
|
1555
1531
|
setFloorBaseHeight(newFloorLevel);
|
|
1556
1532
|
notyf.success("Updated floor offset");
|
|
1557
1533
|
}
|
|
@@ -1580,6 +1556,69 @@ function handleMarkFloor() {
|
|
|
1580
1556
|
}));
|
|
1581
1557
|
}
|
|
1582
1558
|
}
|
|
1559
|
+
function handleModifyPartition() {
|
|
1560
|
+
const modifyBtn = document.getElementById('at-modify-partition-form-btn');
|
|
1561
|
+
if (!modifyBtn) {
|
|
1562
|
+
log.error("Modify partition button element is undefined");
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
modifyBtn.addEventListener('click', () => {
|
|
1566
|
+
const modifyPartitionBtn = document.getElementById('at-modify-partition-form-btn');
|
|
1567
|
+
let selectedPartition = getSelectedObject();
|
|
1568
|
+
const isDrawingEnabled = getDrawingMode();
|
|
1569
|
+
if (isDrawingEnabled) {
|
|
1570
|
+
modifyPartitionBtn.classList.add('at_draw_partition_btn');
|
|
1571
|
+
modifyPartitionBtn.classList.remove('at_draw_partition_btn_active');
|
|
1572
|
+
modifyPartitionBtn.innerHTML = `
|
|
1573
|
+
${i18n.t('ModifyPartition')}
|
|
1574
|
+
<span class="mdi mdi-check-bold"></span>
|
|
1575
|
+
`;
|
|
1576
|
+
const drawBtn = document.getElementById('at-draw-partition-form-btn');
|
|
1577
|
+
const modifyBtn = document.getElementById('at-modify-partition-form-btn');
|
|
1578
|
+
drawBtn.classList.remove('at_hidden');
|
|
1579
|
+
modifyBtn.classList.add('at_hidden');
|
|
1580
|
+
setDrawingMode(false);
|
|
1581
|
+
cancelDraw();
|
|
1582
|
+
}
|
|
1583
|
+
else {
|
|
1584
|
+
modifyPartitionBtn.classList.remove('at_draw_partition_btn');
|
|
1585
|
+
modifyPartitionBtn.classList.add('at_draw_partition_btn_active');
|
|
1586
|
+
modifyPartitionBtn.innerHTML = `
|
|
1587
|
+
${i18n.t('DoneDrawing')}
|
|
1588
|
+
<span class="mdi mdi-check-bold"></span>
|
|
1589
|
+
`;
|
|
1590
|
+
if (!selectedPartition) {
|
|
1591
|
+
log.error("No partition selected");
|
|
1592
|
+
notyf.error("No partition selected to modify");
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
if (selectedPartition.type !== 'POLYGON') {
|
|
1596
|
+
log.error("Vertice editing can only be enabled for partitions");
|
|
1597
|
+
notyf.error("Vertice editing can only be enabled for partitions");
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
setDrawingMode(true);
|
|
1601
|
+
enableVerticeControls(selectedPartition.component);
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
function handlePartitionSelected(object) {
|
|
1606
|
+
log.info("handlePartitionSelected() ", object);
|
|
1607
|
+
if (object) {
|
|
1608
|
+
const drawBtn = document.getElementById('at-draw-partition-form-btn');
|
|
1609
|
+
const modifyBtn = document.getElementById('at-modify-partition-form-btn');
|
|
1610
|
+
if (!drawBtn) {
|
|
1611
|
+
log.error("Draw partition button element is undefined");
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
if (!modifyBtn) {
|
|
1615
|
+
log.error("Modify partition button element is undefined");
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
drawBtn.classList.add('at_hidden');
|
|
1619
|
+
modifyBtn.classList.remove('at_hidden');
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1583
1622
|
export {
|
|
1584
1623
|
//state
|
|
1585
1624
|
activeToolbarItem, activeActionItem, cancelModelPlacementPrompt,
|
|
@@ -510,6 +510,7 @@ export class BufferGeometry {
|
|
|
510
510
|
opacity: this.inputs.floorOpacity,
|
|
511
511
|
transparent: true
|
|
512
512
|
}));
|
|
513
|
+
floorMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}-floor` : 'floor';
|
|
513
514
|
this.groupedMesh.add(floorMesh);
|
|
514
515
|
const floorArea = getPolygonArea(this.inputs.path);
|
|
515
516
|
let [floors, walls] = this.renderWalls(WALL_HEIGHT);
|
|
@@ -616,6 +617,7 @@ export class BufferGeometry {
|
|
|
616
617
|
const outlineMaterial = new THREE.LineBasicMaterial({ color: 0x00ff00, linewidth: 3 });
|
|
617
618
|
const outlineMesh = new THREE.LineSegments(outlineGeometry, outlineMaterial);
|
|
618
619
|
wallMesh.add(outlineMesh);
|
|
620
|
+
wallMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}_wall-${i}` : `wall-${i}`;
|
|
619
621
|
const wallLength = new THREE.Vector3(endPoint.x - startPoint.x, endPoint.y - startPoint.y, endPoint.z - startPoint.z).length();
|
|
620
622
|
const wallArea = wallLength * WALL_HEIGHT;
|
|
621
623
|
// Create wall label
|
|
@@ -641,6 +643,7 @@ export class BufferGeometry {
|
|
|
641
643
|
const wallLabelMesh = new THREE.Mesh(wallLabelGeometry, wallLabelMaterial);
|
|
642
644
|
wallLabelMesh.position.set((startPoint.x + endPoint.x) / 2, midPoint.y + WALL_HEIGHT / 2, (startPoint.z + endPoint.z) / 2);
|
|
643
645
|
wallLabelMesh.rotation.y = angle;
|
|
646
|
+
wallLabelMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}_wallLabel-${i}` : `wallLabel-${i}`;
|
|
644
647
|
//wallLabelMesh.rotation.x = -Math.PI / 8;
|
|
645
648
|
// Floor edge label
|
|
646
649
|
const floorLabelGeometry = new THREE.PlaneGeometry(WALL_HEIGHT, WALL_HEIGHT / 4);
|
package/lib/types.d.ts
CHANGED
|
@@ -993,9 +993,11 @@ export interface FloorPolyData {
|
|
|
993
993
|
export interface WallPolyData {
|
|
994
994
|
uuid?: string | undefined;
|
|
995
995
|
name?: string | undefined;
|
|
996
|
+
index?: number | undefined;
|
|
996
997
|
options?: {
|
|
997
|
-
color
|
|
998
|
-
opacity
|
|
998
|
+
color?: number | undefined;
|
|
999
|
+
opacity?: number | undefined;
|
|
1000
|
+
visible?: boolean | undefined;
|
|
999
1001
|
};
|
|
1000
1002
|
area: number;
|
|
1001
1003
|
wall_height: number;
|
package/lib/utils.d.ts
CHANGED
|
@@ -61,3 +61,12 @@ export declare function debounce(func: Function, delay: number): (...args: any[]
|
|
|
61
61
|
* @returns boolean indicating if the values are equivalent
|
|
62
62
|
*/
|
|
63
63
|
export declare function isEqual(value: any, other: any): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Replaces a specific word in a string with another word, preserving the string structure
|
|
66
|
+
* Case insensitive version
|
|
67
|
+
* @param originalString The original string to modify
|
|
68
|
+
* @param targetWord The word to find and replace
|
|
69
|
+
* @param replacementWord The word to replace the target with
|
|
70
|
+
* @returns The modified string with the replacement word
|
|
71
|
+
*/
|
|
72
|
+
export declare function replaceWordInString(originalString: string, targetWord: string, replacementWord: string, caseInsensitive?: boolean): string;
|
package/lib/utils.js
CHANGED
|
@@ -302,3 +302,19 @@ export function isEqual(value, other) {
|
|
|
302
302
|
}
|
|
303
303
|
return false;
|
|
304
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Replaces a specific word in a string with another word, preserving the string structure
|
|
307
|
+
* Case insensitive version
|
|
308
|
+
* @param originalString The original string to modify
|
|
309
|
+
* @param targetWord The word to find and replace
|
|
310
|
+
* @param replacementWord The word to replace the target with
|
|
311
|
+
* @returns The modified string with the replacement word
|
|
312
|
+
*/
|
|
313
|
+
export function replaceWordInString(originalString, targetWord, replacementWord, caseInsensitive = true) {
|
|
314
|
+
if (!originalString || !targetWord || !replacementWord) {
|
|
315
|
+
return originalString;
|
|
316
|
+
}
|
|
317
|
+
const caseMode = caseInsensitive ? 'gi' : 'g';
|
|
318
|
+
const pattern = new RegExp(`\\b${targetWord}\\b`, caseMode);
|
|
319
|
+
return originalString.replace(pattern, replacementWord);
|
|
320
|
+
}
|
package/package.json
CHANGED