architwin 1.8.7 → 1.8.8
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 +30 -1
- package/lib/architwin.js +220 -35
- package/lib/atwinui/components/toolbar/i18n.js +19 -5
- package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.d.ts +64 -8
- package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.js +373 -161
- package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.js +2 -3
- package/lib/atwinui/events.js +162 -32
- package/lib/atwinui/index.js +0 -1
- package/lib/loaders/polydrawerLoader.d.ts +2 -0
- package/lib/loaders/polydrawerLoader.js +35 -109
- package/lib/types.d.ts +4 -1
- package/lib/types.js +1 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +11 -0
- package/package.json +1 -1
- package/static/utility.css +4 -0
package/lib/architwin.d.ts
CHANGED
|
@@ -111,6 +111,7 @@ declare function getCurrentCameraPose(): MpSdk.Camera.Pose;
|
|
|
111
111
|
declare function getCurrentCameraZoom(): MpSdk.Camera.ZoomData;
|
|
112
112
|
declare function getCameraPosition(): MpSdk.Vector3;
|
|
113
113
|
declare function getCurrentSweepPosition(): MpSdk.Vector3;
|
|
114
|
+
declare function getCurrentFloor(): MpSdk.Floor.FloorData;
|
|
114
115
|
declare function getSweeps(): Promise<ISweep | null>;
|
|
115
116
|
declare function getAllSweeps(): {
|
|
116
117
|
id: string;
|
|
@@ -417,11 +418,13 @@ declare function getCurrentTubeLine(): IObjectData;
|
|
|
417
418
|
* Renders a polygon from an array of coordinates
|
|
418
419
|
* @param {Vector3} path - Array of coordinates
|
|
419
420
|
* @returns {void}
|
|
421
|
+
* @deprecated - Use renderPolygon
|
|
420
422
|
*/
|
|
421
423
|
declare function renderPolygonFromPath(path: Array<Vector3>): void;
|
|
422
424
|
/**
|
|
423
425
|
* Renders a polygon from an array of coordinates or an object containing an array of coordinates
|
|
424
426
|
* @param {PartitionPayload|Array<Vector3>} payload
|
|
427
|
+
* @param {boolean} updatePolygon - Update an existing polygon instance. Defaults to false
|
|
425
428
|
* @returns {void}
|
|
426
429
|
*/
|
|
427
430
|
declare function renderPolygon(payload: PartitionPayload | Array<Vector3>, updatePolygon?: boolean): IShowcaseObject;
|
|
@@ -448,6 +451,32 @@ declare function toggleWallVisibility(component: MpSdk.Scene.IComponent, name: s
|
|
|
448
451
|
* @returns
|
|
449
452
|
*/
|
|
450
453
|
declare function getChildrenOfModel(component: MpSdk.Scene.IComponent): any;
|
|
454
|
+
/**
|
|
455
|
+
* Toggle the visibility of the vertice rings. This requires the rings to be rendered in the space to work
|
|
456
|
+
* @param visibility - Default is false
|
|
457
|
+
*/
|
|
458
|
+
declare function toggleVerticeRingVisibility(visibility?: boolean): void;
|
|
459
|
+
/**
|
|
460
|
+
* Sets the global offset value of the y axis of a rendered polygon.
|
|
461
|
+
* @param {number} offset
|
|
462
|
+
* @returns
|
|
463
|
+
*/
|
|
464
|
+
declare function setPolygonFloorOffset(offset: number): void;
|
|
465
|
+
/**
|
|
466
|
+
* Returns the value of the global floor offset
|
|
467
|
+
* @returns
|
|
468
|
+
*/
|
|
469
|
+
declare function getPolygonFloorOffset(): number;
|
|
470
|
+
/**
|
|
471
|
+
* Set the value of the base height or y-axis of the vertex of a polygon
|
|
472
|
+
* @param baseHeight
|
|
473
|
+
* @returns
|
|
474
|
+
*/
|
|
475
|
+
declare function setFloorBaseHeight(baseHeight: number): void;
|
|
476
|
+
/**
|
|
477
|
+
* Clear the value of the base height for floors of polygons
|
|
478
|
+
*/
|
|
479
|
+
declare function clearFloorBaseHeight(): void;
|
|
451
480
|
declare function setTagIcon(payload: {
|
|
452
481
|
tag: MpSdk.Tag.TagData;
|
|
453
482
|
iconName: string;
|
|
@@ -591,4 +620,4 @@ declare function unFollowParticipant(unFollowParticipant: any): void;
|
|
|
591
620
|
* @param roomNodes Array of room nodes
|
|
592
621
|
*/
|
|
593
622
|
declare function setSpaceRoomNodes(roomNodes: Array<RoomNode>): Promise<void>;
|
|
594
|
-
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, _roomNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, 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, setSpaceRoomNodes, getSpaceId, getCurrentPolygon };
|
|
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, _roomNodes, 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, setSpaceRoomNodes, getSpaceId, getCurrentPolygon };
|
package/lib/architwin.js
CHANGED
|
@@ -202,7 +202,7 @@ 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;
|
|
205
|
+
let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath, _verticeComponentsCollection = [], _highestYaxisPoint, _polygonFloorOffset = 0.15, _autoLevelFloorEnabled = true, _floorBaseHeight;
|
|
206
206
|
let _intersectionData, _tubes, _verticeEmitPath, _verticeEditEmitPath;
|
|
207
207
|
let _navigationInputNode;
|
|
208
208
|
let _navigationComponent;
|
|
@@ -213,6 +213,8 @@ let _tubeLinePath;
|
|
|
213
213
|
// let _iframeSrc = '/bundle/showcase.html?m=&applicationKey=a3ae8341bd8f44899eba16df86307d7d&newtags=1&play=1'
|
|
214
214
|
// ROOM CREATION
|
|
215
215
|
let _roomNodes = undefined;
|
|
216
|
+
//Keybindings flags
|
|
217
|
+
let isCtrlPressed = false, lastKeyPressed = null;
|
|
216
218
|
// end here
|
|
217
219
|
// =========================================== INITIALIZATION ===========================================
|
|
218
220
|
/**
|
|
@@ -454,6 +456,7 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
|
|
|
454
456
|
yield handleParamValuesInSpaceUrl(url);
|
|
455
457
|
createNavigationControlComponent();
|
|
456
458
|
createVerticeClickSpy();
|
|
459
|
+
setupKeybindingEventListeners(showcase);
|
|
457
460
|
let pointerTexturePath = '';
|
|
458
461
|
if ('bundlePath' in config) {
|
|
459
462
|
pointerTexturePath = 'https://cdn.jsdelivr.net/npm/architwin@latest/static/objective.png';
|
|
@@ -633,6 +636,15 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
|
|
|
633
636
|
}
|
|
634
637
|
_atwin.Mode.current.subscribe((mode) => {
|
|
635
638
|
_currentViewMode = mode;
|
|
639
|
+
if (mode == 'mode.floorplan') {
|
|
640
|
+
log.info("_verticeComponentsCollection ", _verticeComponentsCollection);
|
|
641
|
+
toggleVerticeRingVisibility(true);
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
if (_verticeComponentsCollection && _verticeComponentsCollection.length > 0) {
|
|
645
|
+
toggleVerticeRingVisibility();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
636
648
|
});
|
|
637
649
|
_atwin.Pointer.intersection.subscribe(function (intersection) {
|
|
638
650
|
// log.info('intersection', intersection)
|
|
@@ -1815,6 +1827,9 @@ function getCameraPosition() {
|
|
|
1815
1827
|
function getCurrentSweepPosition() {
|
|
1816
1828
|
return _currentSweep.position;
|
|
1817
1829
|
}
|
|
1830
|
+
function getCurrentFloor() {
|
|
1831
|
+
return _currentFloor;
|
|
1832
|
+
}
|
|
1818
1833
|
// gets all Sweeps in loaded Space
|
|
1819
1834
|
function getSweeps() {
|
|
1820
1835
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -5073,6 +5088,7 @@ function getCurrentTubeLine() {
|
|
|
5073
5088
|
* Renders a polygon from an array of coordinates
|
|
5074
5089
|
* @param {Vector3} path - Array of coordinates
|
|
5075
5090
|
* @returns {void}
|
|
5091
|
+
* @deprecated - Use renderPolygon
|
|
5076
5092
|
*/
|
|
5077
5093
|
function renderPolygonFromPath(path) {
|
|
5078
5094
|
if (!path || path.length <= 0) {
|
|
@@ -5129,6 +5145,7 @@ function renderPolygonFromPath(path) {
|
|
|
5129
5145
|
/**
|
|
5130
5146
|
* Renders a polygon from an array of coordinates or an object containing an array of coordinates
|
|
5131
5147
|
* @param {PartitionPayload|Array<Vector3>} payload
|
|
5148
|
+
* @param {boolean} updatePolygon - Update an existing polygon instance. Defaults to false
|
|
5132
5149
|
* @returns {void}
|
|
5133
5150
|
*/
|
|
5134
5151
|
function renderPolygon(payload, updatePolygon = false) {
|
|
@@ -5162,6 +5179,7 @@ function renderPolygon(payload, updatePolygon = false) {
|
|
|
5162
5179
|
polyNode.start();
|
|
5163
5180
|
//Add an input path so that we can easily update the polygon component.
|
|
5164
5181
|
_sceneObject.addInputPath(polyComponent, 'path', `path_${showcaseObj.id}`);
|
|
5182
|
+
_sceneObject.addInputPath(polyComponent, 'visible', `visible_${showcaseObj.id}`);
|
|
5165
5183
|
const newObj = {
|
|
5166
5184
|
object: showcaseObj,
|
|
5167
5185
|
node: polyNode,
|
|
@@ -5178,20 +5196,22 @@ function renderPolygon(payload, updatePolygon = false) {
|
|
|
5178
5196
|
log.error("Error renderPolygon ", error);
|
|
5179
5197
|
}
|
|
5180
5198
|
}
|
|
5181
|
-
|
|
5199
|
+
else {
|
|
5182
5200
|
const index = _3DXObjects.findIndex(item => item.object.id == _currentPolygon.object.id);
|
|
5183
|
-
_currentPolygon.node = polyNode
|
|
5184
|
-
_currentPolygon.component = polyComponent
|
|
5201
|
+
// _currentPolygon.node = polyNode
|
|
5202
|
+
// _currentPolygon.component = polyComponent
|
|
5185
5203
|
_currentPolygon.object.object_data.uuid = generateUUID();
|
|
5186
5204
|
_currentPolygon.object.object_data.json_data = {
|
|
5187
5205
|
vertexPath: payload
|
|
5188
5206
|
};
|
|
5189
5207
|
_3DXObjects[index] = _currentPolygon;
|
|
5190
|
-
if (payload.length
|
|
5208
|
+
if (payload.length >= 3) {
|
|
5191
5209
|
console.log(" _3DXObjects[index] ", _3DXObjects[index]);
|
|
5192
5210
|
setPolygonPath(_3DXObjects[index].object.id, payload);
|
|
5193
5211
|
}
|
|
5194
5212
|
}
|
|
5213
|
+
if (updatePolygon) {
|
|
5214
|
+
}
|
|
5195
5215
|
}
|
|
5196
5216
|
else {
|
|
5197
5217
|
polyNode = _sceneObject.addNode();
|
|
@@ -5260,6 +5280,7 @@ function addVerticeControls(component, index) {
|
|
|
5260
5280
|
index,
|
|
5261
5281
|
position: Object.assign({}, component.inputs.path[index]),
|
|
5262
5282
|
});
|
|
5283
|
+
_verticeComponentsCollection.push(verticeComponent);
|
|
5263
5284
|
const editVertice = _sceneObject.addEmitPath(verticeComponent, "changed");
|
|
5264
5285
|
_sceneObject.spyOnEvent({
|
|
5265
5286
|
path: editVertice,
|
|
@@ -5288,7 +5309,7 @@ function addVerticeControls(component, index) {
|
|
|
5288
5309
|
},
|
|
5289
5310
|
});
|
|
5290
5311
|
}
|
|
5291
|
-
function createVerticeControls(component) {
|
|
5312
|
+
function createVerticeControls(component, isDeleting = false) {
|
|
5292
5313
|
if (!component) {
|
|
5293
5314
|
log.error("component is undefined");
|
|
5294
5315
|
return;
|
|
@@ -5303,6 +5324,19 @@ function createVerticeControls(component) {
|
|
|
5303
5324
|
for (let i = 0; i <= sections; i++) {
|
|
5304
5325
|
addVerticeControls(component, i);
|
|
5305
5326
|
}
|
|
5327
|
+
if (_currentPolygon) {
|
|
5328
|
+
//@ts-expect-error
|
|
5329
|
+
if (isDeleting && component.inputs.path.length <= 2) {
|
|
5330
|
+
//@ts-expect-error
|
|
5331
|
+
_currentPolygon.component.groupedMesh.visible = false;
|
|
5332
|
+
//@ts-expect-error
|
|
5333
|
+
}
|
|
5334
|
+
else if (isDeleting == false && component.inputs.path.length > 2) {
|
|
5335
|
+
log.info(" _currentPolygon.component ", _currentPolygon.component);
|
|
5336
|
+
//@ts-expect-error
|
|
5337
|
+
_currentPolygon.component.groupedMesh.visible = true;
|
|
5338
|
+
}
|
|
5339
|
+
}
|
|
5306
5340
|
verticeNode.start();
|
|
5307
5341
|
}
|
|
5308
5342
|
function createVerticeClickSpy() {
|
|
@@ -5323,40 +5357,91 @@ function createVerticeClickSpy() {
|
|
|
5323
5357
|
onEvent(event_data) {
|
|
5324
5358
|
log.info("ClickSpy");
|
|
5325
5359
|
// If user is in drawMode and has not yet clicked...
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
if (
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5360
|
+
log.info("isCtrlPressed ", isCtrlPressed);
|
|
5361
|
+
if (isCtrlPressed) {
|
|
5362
|
+
if (_drawPolygonMode) {
|
|
5363
|
+
// If no node is active
|
|
5364
|
+
if (_thisVertexNode === undefined) {
|
|
5365
|
+
let start = Object.assign({}, _intersectionData.position);
|
|
5366
|
+
if (_floorBaseHeight !== undefined) {
|
|
5367
|
+
start.y += (_floorBaseHeight + _polygonFloorOffset);
|
|
5368
|
+
}
|
|
5369
|
+
if (_autoLevelFloorEnabled) {
|
|
5370
|
+
if (!_highestYaxisPoint) {
|
|
5371
|
+
_highestYaxisPoint = _intersectionData.position.y;
|
|
5372
|
+
}
|
|
5373
|
+
if (start.y > _highestYaxisPoint) {
|
|
5374
|
+
_highestYaxisPoint = _intersectionData.position.y;
|
|
5375
|
+
}
|
|
5376
|
+
start.y += (_highestYaxisPoint + _polygonFloorOffset);
|
|
5377
|
+
}
|
|
5378
|
+
// Generate Tag ID from position
|
|
5379
|
+
const r = (x) => Math.round(x * 100) / 100;
|
|
5380
|
+
let thisName = "x" + r(start.x) + "y" + r(start.y) + "z" + r(start.z);
|
|
5381
|
+
//@ts-expect-error
|
|
5382
|
+
[_thisVertexNode, _thisVertexComponent] = addVertex(thisName, [start]);
|
|
5383
|
+
_thisVertexPath.push(start);
|
|
5384
|
+
log.info("_thisVertexPath ", _thisVertexPath);
|
|
5385
|
+
if (visualize) {
|
|
5386
|
+
_activeVertex.inputs.collider = false;
|
|
5387
|
+
}
|
|
5388
|
+
createVerticeControls(_thisVertexComponent);
|
|
5341
5389
|
}
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5390
|
+
else {
|
|
5391
|
+
if (!_highestYaxisPoint) {
|
|
5392
|
+
_highestYaxisPoint = _intersectionData.position.y;
|
|
5393
|
+
}
|
|
5394
|
+
if (_intersectionData.position.y > _highestYaxisPoint) {
|
|
5395
|
+
_highestYaxisPoint = _intersectionData.position.y;
|
|
5396
|
+
}
|
|
5397
|
+
_intersectionData.position.y += (_highestYaxisPoint + _polygonFloorOffset);
|
|
5398
|
+
_thisVertexPath.push(Object.assign({}, _intersectionData.position));
|
|
5399
|
+
_thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5400
|
+
// Show Vertices
|
|
5401
|
+
createVerticeControls(_thisVertexComponent);
|
|
5402
|
+
}
|
|
5403
|
+
dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, {
|
|
5404
|
+
position: _intersectionData.position,
|
|
5405
|
+
path: _thisVertexPath
|
|
5406
|
+
});
|
|
5349
5407
|
}
|
|
5350
|
-
dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, {
|
|
5351
|
-
position: _intersectionData.position,
|
|
5352
|
-
path: _thisVertexPath
|
|
5353
|
-
});
|
|
5354
5408
|
}
|
|
5355
5409
|
},
|
|
5356
5410
|
};
|
|
5357
5411
|
//_sceneObject.spyOnEvent(new VerticeClickSpy(_verticeEmitPath,dispatchSpaceEvent))
|
|
5358
5412
|
_sceneObject.spyOnEvent(click_spy);
|
|
5359
5413
|
}
|
|
5414
|
+
/**
|
|
5415
|
+
* Removes a vertex sphere from the space. If no argument is passed it will remove the last vertex that has been added
|
|
5416
|
+
* @param {number} index - (optional) Index of an element of vertex path
|
|
5417
|
+
* @returns
|
|
5418
|
+
*/
|
|
5419
|
+
function deleteVertex(index) {
|
|
5420
|
+
log.info("deleteVertex()");
|
|
5421
|
+
if (!_thisVertexComponent) {
|
|
5422
|
+
log.error("An active vertex component is required");
|
|
5423
|
+
return;
|
|
5424
|
+
}
|
|
5425
|
+
if (!_thisVertexPath || _thisVertexPath.length <= 0) {
|
|
5426
|
+
log.error("Vertex path is empty or undefined");
|
|
5427
|
+
return;
|
|
5428
|
+
}
|
|
5429
|
+
if (index !== undefined) {
|
|
5430
|
+
_thisVertexPath = _thisVertexPath.slice(index, 1);
|
|
5431
|
+
_thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5432
|
+
// Rerender Vertices
|
|
5433
|
+
createVerticeControls(_thisVertexComponent, true);
|
|
5434
|
+
}
|
|
5435
|
+
else {
|
|
5436
|
+
//const newPath = _thisVertexPath
|
|
5437
|
+
log.info("_thisVertexPath before ", _thisVertexPath);
|
|
5438
|
+
_thisVertexPath.pop();
|
|
5439
|
+
log.info("_thisVertexPath after ", _thisVertexPath);
|
|
5440
|
+
_thisVertexComponent.inputs.path = [..._thisVertexPath];
|
|
5441
|
+
// Rerender Vertices
|
|
5442
|
+
createVerticeControls(_thisVertexComponent, true);
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5360
5445
|
function startDraw() {
|
|
5361
5446
|
//Disable certain features in space when drawing is active
|
|
5362
5447
|
_atwin.Measurements.toggleMode(false);
|
|
@@ -5371,7 +5456,7 @@ function startDraw() {
|
|
|
5371
5456
|
_thisVertexNode = undefined;
|
|
5372
5457
|
_thisVertexComponent = undefined;
|
|
5373
5458
|
_thisVertexPath = new Array();
|
|
5374
|
-
toggleSpaceNavigation(false)
|
|
5459
|
+
//toggleSpaceNavigation(false)
|
|
5375
5460
|
}
|
|
5376
5461
|
function exitDraw() {
|
|
5377
5462
|
//Enabled MP features when exiting draw mode
|
|
@@ -5390,6 +5475,7 @@ function exitDraw() {
|
|
|
5390
5475
|
_drawPolygonMode = false;
|
|
5391
5476
|
_currentPolygon = undefined;
|
|
5392
5477
|
_polygonShapePath = undefined;
|
|
5478
|
+
_verticeComponentsCollection = [];
|
|
5393
5479
|
_atwin.Pointer.resetTexture();
|
|
5394
5480
|
}
|
|
5395
5481
|
function cancelDraw() {
|
|
@@ -5424,6 +5510,7 @@ function addVertex(name, path) {
|
|
|
5424
5510
|
path: _activeVertexPath,
|
|
5425
5511
|
onEvent(eventData) {
|
|
5426
5512
|
if (editMode) {
|
|
5513
|
+
log.info("_activeVertexPath event triggered");
|
|
5427
5514
|
//@ts-expect-error
|
|
5428
5515
|
if (_activeVertex != eventData.component) {
|
|
5429
5516
|
// Set previously active tube to inactive
|
|
@@ -5520,7 +5607,105 @@ function getChildrenOfModel(component) {
|
|
|
5520
5607
|
const children = component.mesh.children;
|
|
5521
5608
|
return children;
|
|
5522
5609
|
}
|
|
5610
|
+
/**
|
|
5611
|
+
* Toggle the visibility of the vertice rings. This requires the rings to be rendered in the space to work
|
|
5612
|
+
* @param visibility - Default is false
|
|
5613
|
+
*/
|
|
5614
|
+
function toggleVerticeRingVisibility(visibility = false) {
|
|
5615
|
+
if (!_verticeComponentsCollection || _verticeComponentsCollection.length <= 0) {
|
|
5616
|
+
log.error("No actively visible vertices to invoke this function");
|
|
5617
|
+
return;
|
|
5618
|
+
}
|
|
5619
|
+
try {
|
|
5620
|
+
_verticeComponentsCollection.forEach((component) => {
|
|
5621
|
+
//@ts-expect-error
|
|
5622
|
+
if (component.mesh.children) {
|
|
5623
|
+
//@ts-expect-error
|
|
5624
|
+
component.mesh.children.forEach(comp => {
|
|
5625
|
+
if (comp.name == 'ring') {
|
|
5626
|
+
comp.visible = visibility;
|
|
5627
|
+
}
|
|
5628
|
+
});
|
|
5629
|
+
}
|
|
5630
|
+
});
|
|
5631
|
+
}
|
|
5632
|
+
catch (error) {
|
|
5633
|
+
log.error("Error toggling ring visibility ", error);
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5636
|
+
/**
|
|
5637
|
+
* Sets the global offset value of the y axis of a rendered polygon.
|
|
5638
|
+
* @param {number} offset
|
|
5639
|
+
* @returns
|
|
5640
|
+
*/
|
|
5641
|
+
function setPolygonFloorOffset(offset) {
|
|
5642
|
+
log.info("setPolygonFloorOffset()");
|
|
5643
|
+
if (offset == undefined) {
|
|
5644
|
+
log.error("Parameter offset is undefined");
|
|
5645
|
+
return;
|
|
5646
|
+
}
|
|
5647
|
+
if (typeof offset !== 'number') {
|
|
5648
|
+
log.error("Parameter offset is not a number");
|
|
5649
|
+
return;
|
|
5650
|
+
}
|
|
5651
|
+
_polygonFloorOffset = offset;
|
|
5652
|
+
}
|
|
5653
|
+
/**
|
|
5654
|
+
* Returns the value of the global floor offset
|
|
5655
|
+
* @returns
|
|
5656
|
+
*/
|
|
5657
|
+
function getPolygonFloorOffset() {
|
|
5658
|
+
log.info("getPolygonFloorOffset()");
|
|
5659
|
+
return _polygonFloorOffset;
|
|
5660
|
+
}
|
|
5661
|
+
/**
|
|
5662
|
+
* Set the value of the base height or y-axis of the vertex of a polygon
|
|
5663
|
+
* @param baseHeight
|
|
5664
|
+
* @returns
|
|
5665
|
+
*/
|
|
5666
|
+
function setFloorBaseHeight(baseHeight) {
|
|
5667
|
+
log.info("setFloorBaseHeight()");
|
|
5668
|
+
if (!baseHeight || isNaN(baseHeight)) {
|
|
5669
|
+
log.error("baseHeight is undefined or NaN");
|
|
5670
|
+
return;
|
|
5671
|
+
}
|
|
5672
|
+
_floorBaseHeight;
|
|
5673
|
+
}
|
|
5674
|
+
/**
|
|
5675
|
+
* Clear the value of the base height for floors of polygons
|
|
5676
|
+
*/
|
|
5677
|
+
function clearFloorBaseHeight() {
|
|
5678
|
+
_floorBaseHeight = undefined;
|
|
5679
|
+
}
|
|
5523
5680
|
//===================== END VERTEX DRAWING METHODS =========================//
|
|
5681
|
+
//===================== START KEYBINDINGS =========================//
|
|
5682
|
+
function handleKeyDown(event) {
|
|
5683
|
+
if (event.ctrlKey) {
|
|
5684
|
+
log.info("Ctrl key down");
|
|
5685
|
+
isCtrlPressed = true;
|
|
5686
|
+
toggleSpaceNavigation(false);
|
|
5687
|
+
}
|
|
5688
|
+
if (isCtrlPressed && event.key === 'z' && lastKeyPressed === 'Control') {
|
|
5689
|
+
log.info("Ctrl + Z works");
|
|
5690
|
+
deleteVertex();
|
|
5691
|
+
}
|
|
5692
|
+
lastKeyPressed = event.key;
|
|
5693
|
+
}
|
|
5694
|
+
function handleKeyUp(event) {
|
|
5695
|
+
if (event.key === "Control") {
|
|
5696
|
+
log.info("Ctrl key down");
|
|
5697
|
+
isCtrlPressed = false;
|
|
5698
|
+
toggleSpaceNavigation(true);
|
|
5699
|
+
}
|
|
5700
|
+
}
|
|
5701
|
+
function setupKeybindingEventListeners(iframe) {
|
|
5702
|
+
log.info("setupKeybindingEventListeners()");
|
|
5703
|
+
iframe.contentDocument.body.addEventListener('keydown', handleKeyDown);
|
|
5704
|
+
iframe.contentDocument.body.addEventListener('keyup', handleKeyUp);
|
|
5705
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
5706
|
+
window.addEventListener('keyup', handleKeyUp);
|
|
5707
|
+
}
|
|
5708
|
+
//===================== END KEYBINDING =========================//
|
|
5524
5709
|
//===================== START TAGS =========================//
|
|
5525
5710
|
// set tag icon
|
|
5526
5711
|
function setTagIcon(payload) {
|
|
@@ -6507,7 +6692,7 @@ _roomNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActio
|
|
|
6507
6692
|
//sweeps
|
|
6508
6693
|
getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps,
|
|
6509
6694
|
// camera
|
|
6510
|
-
getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails,
|
|
6695
|
+
getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, getCurrentFloor, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails,
|
|
6511
6696
|
// objects
|
|
6512
6697
|
getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject,
|
|
6513
6698
|
// deleteObjectFromSpace,
|
|
@@ -6556,7 +6741,7 @@ initToolbarUI, themeManager,
|
|
|
6556
6741
|
//utils
|
|
6557
6742
|
convertToEuler, disableSweeps, enableSweep, disableSweep,
|
|
6558
6743
|
//Draw polygon
|
|
6559
|
-
tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel,
|
|
6744
|
+
tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight,
|
|
6560
6745
|
// Room creation
|
|
6561
6746
|
setSpaceRoomNodes,
|
|
6562
6747
|
// others
|
|
@@ -100,11 +100,22 @@ i18n
|
|
|
100
100
|
"RoomTree": "Room Tree",
|
|
101
101
|
"Report": "Report",
|
|
102
102
|
"ALL": "ALL",
|
|
103
|
-
"FloorLevel": "Floor
|
|
103
|
+
"FloorLevel": "Floor Offset",
|
|
104
|
+
"AutoLevel": "Auto Level",
|
|
104
105
|
"Line": "Line",
|
|
105
106
|
"Name": "Name",
|
|
106
|
-
"
|
|
107
|
-
"NothingToReport": "Nothing to report. Please create a partition."
|
|
107
|
+
"NoRoomSaved": "No room to save",
|
|
108
|
+
"NothingToReport": "Nothing to report. Please create a partition.",
|
|
109
|
+
"ConfirmDeletePartition": "Are you sure you want to delete this partition? This action cannot be reversed.",
|
|
110
|
+
"ConfirmDeleteRoom": "Are you sure you want to delete this room? This action cannot be reversed.",
|
|
111
|
+
"SuccessRoomSaved": "Successfully saved room",
|
|
112
|
+
"SuccessRoomDeleted": "Successfully deleted room",
|
|
113
|
+
"NoRoomDeleted": "No room to delete",
|
|
114
|
+
"SuccessPartitionAddSpace": "Successfully added a partition to the space",
|
|
115
|
+
"SuccessPartitionDelete": "Successfully deleted partition",
|
|
116
|
+
"NoPartitionDeleted": "No partition to delete",
|
|
117
|
+
"SuccessBaseHeight": "Successfully set floor base height",
|
|
118
|
+
"MarkBaseHeight": "Click to mark an area as your desired base height"
|
|
108
119
|
}
|
|
109
120
|
},
|
|
110
121
|
ja: {
|
|
@@ -199,10 +210,13 @@ i18n
|
|
|
199
210
|
"Floor": "床",
|
|
200
211
|
"Wall": "壁",
|
|
201
212
|
"ClickEditName": "クリック",
|
|
202
|
-
"FloorLevel": "
|
|
213
|
+
"FloorLevel": "フロアオフセット",
|
|
214
|
+
"AutoLevel": "自動レベル",
|
|
203
215
|
"Line": "線",
|
|
204
216
|
"Name": "名前",
|
|
205
|
-
"NothingToReport": "Nothing to report. Please create a partition."
|
|
217
|
+
"NothingToReport": "Nothing to report. Please create a partition.",
|
|
218
|
+
"SuccessBaseHeight": "床ベースの高さの設定に成功しました",
|
|
219
|
+
"MarkBaseHeight": "クリックして、希望するベース高さとして領域をマークします"
|
|
206
220
|
}
|
|
207
221
|
}
|
|
208
222
|
},
|
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
import { FORM_MODE, RoomNode, PolygonData } from "../../../../types";
|
|
2
2
|
export declare function renderRoomFormPane(): HTMLDivElement;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Toggles the state of the partition drawing functionality.
|
|
5
|
+
* If drawing is not active, it starts the drawing process.
|
|
6
|
+
* Otherwise, it cancels the current drawing, updates partition data,
|
|
7
|
+
* and displays the relevant UI elements for partitions.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toggleDrawPartitionButton(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Displays the partition form based on the current form mode.
|
|
12
|
+
* Handles different UI behaviors for edit and add modes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function displayPartitionFormMode(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Clears the partition form by resetting UI elements and internal data.
|
|
17
|
+
* - Navigates back to the partition list view.
|
|
18
|
+
* - Cancels any ongoing drawing actions.
|
|
19
|
+
* - Hides relevant UI elements like wall height, delete button, and partition container.
|
|
20
|
+
* - Resets the form and clears data related to the current partition, room, and polygon.
|
|
21
|
+
*/
|
|
22
|
+
export declare function clearPartitionForm(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the form data for creating or editing a room partition.
|
|
25
|
+
* - Collects values from form inputs (name, floor level, memo).
|
|
26
|
+
* - Constructs a payload object containing the room data, including the space UUID and polygon data.
|
|
27
|
+
* - Updates the polygon data for each partition in the currentPartitionDataArray to reflect the new floor level.
|
|
28
|
+
* - If there is existing room data (currentEditRoomData), it returns that data with updated values.
|
|
29
|
+
*
|
|
30
|
+
* @returns {RoomNode} The room data object with partition and floor details.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getPartitionFormData(): RoomNode;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the saving mode for the partition form.
|
|
35
|
+
* - If saving is enabled, `isSaving` is set to true, indicating that the form is in saving mode.
|
|
36
|
+
* - If saving is disabled, `isSaving` is set to false.
|
|
37
|
+
*
|
|
38
|
+
* @param {boolean} savingEnabled - True to enable saving mode, false to disable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function setPartitionSavingMode(savingEnabled: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the current saving mode for the partition form.
|
|
43
|
+
*
|
|
44
|
+
* @returns {boolean} - Returns true if saving mode is enabled, false otherwise.
|
|
45
|
+
*/
|
|
9
46
|
export declare function getPartitionSavingMode(): boolean;
|
|
10
|
-
|
|
11
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Sets the form mode for the partition form.
|
|
49
|
+
* - The form mode can be one of the predefined FORM_MODE values (e.g., CREATE, EDIT, etc.).
|
|
50
|
+
*
|
|
51
|
+
* @param {FORM_MODE} formType - The type of form mode to set.
|
|
52
|
+
*/
|
|
53
|
+
export declare function setPartitionFormMode(formType: FORM_MODE): void;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the current form mode for the partition form.
|
|
56
|
+
*
|
|
57
|
+
* @returns {FORM_MODE} - The current form mode.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getPartitionFormMode(): FORM_MODE;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the polygon data for the current partition, including rounding numeric values
|
|
62
|
+
* to two decimal places and assigning UUIDs to the floor and walls.
|
|
63
|
+
*
|
|
64
|
+
* @param {PolygonData} payload - The polygon data to set, including floor and walls.
|
|
65
|
+
*/
|
|
12
66
|
export declare function setPolygonData(payload: PolygonData): void;
|
|
67
|
+
export declare function getNewlyAddedPartition(): Array<RoomNode>;
|
|
68
|
+
export declare function getDeletedSavedPartitionArray(): Array<RoomNode>;
|