3dviewer-sdk 1.0.22 → 1.0.23
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/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +31 -1
- package/dist/index.mjs +31 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -40,6 +40,7 @@ declare enum ViewerMessageType {
|
|
|
40
40
|
STATES_OBJECTS_GET_LIST = "viewer-states-objects-get-list",
|
|
41
41
|
STATES_OBJECTS_LIST = "viewer-states-objects-list",
|
|
42
42
|
TREE_SELECT_NODE = "viewer-tree-select-node",
|
|
43
|
+
TREE_SET_NODE_VISIBILITY = "viewer-tree-set-node-visibility",
|
|
43
44
|
TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
|
|
44
45
|
TREE_NODE_IDS = "viewer-tree-node-ids",
|
|
45
46
|
TREE_GET_NODES = "viewer-tree-get-nodes",
|
|
@@ -539,6 +540,9 @@ declare class ModelTreeModule {
|
|
|
539
540
|
constructor(viewer: Viewer3D);
|
|
540
541
|
open(): void;
|
|
541
542
|
selectNode(nodeId: string | number): void;
|
|
543
|
+
setNodeVisibility(nodeIds: Array<string | number>, visible: boolean): void;
|
|
544
|
+
hideNode(nodeIds: Array<string | number>): void;
|
|
545
|
+
showNode(nodeIds: Array<string | number>): void;
|
|
542
546
|
getNodeIds(options?: GetNodeIdsOptions): Promise<string[]>;
|
|
543
547
|
getNodes(options?: GetNodesOptions): Promise<ModelTreeNode[]>;
|
|
544
548
|
getTree(options?: GetNodesOptions): Promise<ModelTreeHierarchyNode[]>;
|
|
@@ -546,6 +550,7 @@ declare class ModelTreeModule {
|
|
|
546
550
|
private resolveTimeoutMs;
|
|
547
551
|
private postPanelOpen;
|
|
548
552
|
private postTreeSelectNode;
|
|
553
|
+
private postTreeSetNodeVisibility;
|
|
549
554
|
private postTreeGetNodeIds;
|
|
550
555
|
private postTreeGetNodes;
|
|
551
556
|
}
|
|
@@ -592,6 +597,7 @@ type ObjectPropertiesGetCurrentOptions = ObjectPropertiesWatchOptions & {
|
|
|
592
597
|
type ObjectPropertiesChangedEvent = ObjectPropertiesChangedPayload;
|
|
593
598
|
declare class ObjectPropertiesModule {
|
|
594
599
|
private viewer;
|
|
600
|
+
private pendingGetCurrent;
|
|
595
601
|
on: {
|
|
596
602
|
change: (cb: (payload: ObjectPropertiesChangedEvent) => void) => () => void;
|
|
597
603
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare enum ViewerMessageType {
|
|
|
40
40
|
STATES_OBJECTS_GET_LIST = "viewer-states-objects-get-list",
|
|
41
41
|
STATES_OBJECTS_LIST = "viewer-states-objects-list",
|
|
42
42
|
TREE_SELECT_NODE = "viewer-tree-select-node",
|
|
43
|
+
TREE_SET_NODE_VISIBILITY = "viewer-tree-set-node-visibility",
|
|
43
44
|
TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
|
|
44
45
|
TREE_NODE_IDS = "viewer-tree-node-ids",
|
|
45
46
|
TREE_GET_NODES = "viewer-tree-get-nodes",
|
|
@@ -539,6 +540,9 @@ declare class ModelTreeModule {
|
|
|
539
540
|
constructor(viewer: Viewer3D);
|
|
540
541
|
open(): void;
|
|
541
542
|
selectNode(nodeId: string | number): void;
|
|
543
|
+
setNodeVisibility(nodeIds: Array<string | number>, visible: boolean): void;
|
|
544
|
+
hideNode(nodeIds: Array<string | number>): void;
|
|
545
|
+
showNode(nodeIds: Array<string | number>): void;
|
|
542
546
|
getNodeIds(options?: GetNodeIdsOptions): Promise<string[]>;
|
|
543
547
|
getNodes(options?: GetNodesOptions): Promise<ModelTreeNode[]>;
|
|
544
548
|
getTree(options?: GetNodesOptions): Promise<ModelTreeHierarchyNode[]>;
|
|
@@ -546,6 +550,7 @@ declare class ModelTreeModule {
|
|
|
546
550
|
private resolveTimeoutMs;
|
|
547
551
|
private postPanelOpen;
|
|
548
552
|
private postTreeSelectNode;
|
|
553
|
+
private postTreeSetNodeVisibility;
|
|
549
554
|
private postTreeGetNodeIds;
|
|
550
555
|
private postTreeGetNodes;
|
|
551
556
|
}
|
|
@@ -592,6 +597,7 @@ type ObjectPropertiesGetCurrentOptions = ObjectPropertiesWatchOptions & {
|
|
|
592
597
|
type ObjectPropertiesChangedEvent = ObjectPropertiesChangedPayload;
|
|
593
598
|
declare class ObjectPropertiesModule {
|
|
594
599
|
private viewer;
|
|
600
|
+
private pendingGetCurrent;
|
|
595
601
|
on: {
|
|
596
602
|
change: (cb: (payload: ObjectPropertiesChangedEvent) => void) => () => void;
|
|
597
603
|
};
|
package/dist/index.js
CHANGED
|
@@ -960,6 +960,24 @@ var ModelTreeModule = class {
|
|
|
960
960
|
nodeId: String(nodeId)
|
|
961
961
|
});
|
|
962
962
|
}
|
|
963
|
+
setNodeVisibility(nodeIds, visible) {
|
|
964
|
+
const normalizedNodeIds = Array.from(
|
|
965
|
+
new Set(
|
|
966
|
+
nodeIds.map((nodeId) => String(nodeId).trim()).filter((nodeId) => nodeId !== "")
|
|
967
|
+
)
|
|
968
|
+
);
|
|
969
|
+
if (normalizedNodeIds.length === 0) return;
|
|
970
|
+
this.postTreeSetNodeVisibility({
|
|
971
|
+
nodeIds: normalizedNodeIds,
|
|
972
|
+
visible
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
hideNode(nodeIds) {
|
|
976
|
+
this.setNodeVisibility(nodeIds, false);
|
|
977
|
+
}
|
|
978
|
+
showNode(nodeIds) {
|
|
979
|
+
this.setNodeVisibility(nodeIds, true);
|
|
980
|
+
}
|
|
963
981
|
getNodeIds(options) {
|
|
964
982
|
const requestId = createRequestId3("tree");
|
|
965
983
|
const timeoutMs = this.resolveTimeoutMs(options);
|
|
@@ -1020,6 +1038,9 @@ var ModelTreeModule = class {
|
|
|
1020
1038
|
postTreeSelectNode(payload) {
|
|
1021
1039
|
this.viewer.postToViewer("viewer-tree-select-node" /* TREE_SELECT_NODE */, payload);
|
|
1022
1040
|
}
|
|
1041
|
+
postTreeSetNodeVisibility(payload) {
|
|
1042
|
+
this.viewer.postToViewer("viewer-tree-set-node-visibility" /* TREE_SET_NODE_VISIBILITY */, payload);
|
|
1043
|
+
}
|
|
1023
1044
|
postTreeGetNodeIds(payload) {
|
|
1024
1045
|
this.viewer.postToViewer("viewer-tree-get-node-ids" /* TREE_GET_NODE_IDS */, payload);
|
|
1025
1046
|
}
|
|
@@ -1165,19 +1186,28 @@ var ObjectPropertiesModule = class {
|
|
|
1165
1186
|
}
|
|
1166
1187
|
getCurrent(options) {
|
|
1167
1188
|
var _a;
|
|
1189
|
+
if (this.pendingGetCurrent) {
|
|
1190
|
+
clearTimeout(this.pendingGetCurrent.timer);
|
|
1191
|
+
this.pendingGetCurrent.off();
|
|
1192
|
+
this.pendingGetCurrent.reject(new Error("No object properties"));
|
|
1193
|
+
this.pendingGetCurrent = void 0;
|
|
1194
|
+
}
|
|
1168
1195
|
const requestId = createRequestId5("object_properties_current");
|
|
1169
1196
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1170
1197
|
return new Promise((resolve, reject) => {
|
|
1171
1198
|
const timer = setTimeout(() => {
|
|
1199
|
+
this.pendingGetCurrent = void 0;
|
|
1172
1200
|
off();
|
|
1173
|
-
reject(new Error("
|
|
1201
|
+
reject(new Error("No object properties"));
|
|
1174
1202
|
}, timeoutMs);
|
|
1175
1203
|
const off = this.viewer._on("object-properties:changed", (payload2) => {
|
|
1176
1204
|
if (payload2.requestId !== requestId) return;
|
|
1177
1205
|
clearTimeout(timer);
|
|
1206
|
+
this.pendingGetCurrent = void 0;
|
|
1178
1207
|
off();
|
|
1179
1208
|
resolve(payload2);
|
|
1180
1209
|
});
|
|
1210
|
+
this.pendingGetCurrent = { requestId, off, timer, reject };
|
|
1181
1211
|
const payload = { requestId };
|
|
1182
1212
|
if (typeof (options == null ? void 0 : options.includeSelectionMeta) === "boolean") {
|
|
1183
1213
|
payload.includeSelectionMeta = options.includeSelectionMeta;
|
package/dist/index.mjs
CHANGED
|
@@ -934,6 +934,24 @@ var ModelTreeModule = class {
|
|
|
934
934
|
nodeId: String(nodeId)
|
|
935
935
|
});
|
|
936
936
|
}
|
|
937
|
+
setNodeVisibility(nodeIds, visible) {
|
|
938
|
+
const normalizedNodeIds = Array.from(
|
|
939
|
+
new Set(
|
|
940
|
+
nodeIds.map((nodeId) => String(nodeId).trim()).filter((nodeId) => nodeId !== "")
|
|
941
|
+
)
|
|
942
|
+
);
|
|
943
|
+
if (normalizedNodeIds.length === 0) return;
|
|
944
|
+
this.postTreeSetNodeVisibility({
|
|
945
|
+
nodeIds: normalizedNodeIds,
|
|
946
|
+
visible
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
hideNode(nodeIds) {
|
|
950
|
+
this.setNodeVisibility(nodeIds, false);
|
|
951
|
+
}
|
|
952
|
+
showNode(nodeIds) {
|
|
953
|
+
this.setNodeVisibility(nodeIds, true);
|
|
954
|
+
}
|
|
937
955
|
getNodeIds(options) {
|
|
938
956
|
const requestId = createRequestId3("tree");
|
|
939
957
|
const timeoutMs = this.resolveTimeoutMs(options);
|
|
@@ -994,6 +1012,9 @@ var ModelTreeModule = class {
|
|
|
994
1012
|
postTreeSelectNode(payload) {
|
|
995
1013
|
this.viewer.postToViewer("viewer-tree-select-node" /* TREE_SELECT_NODE */, payload);
|
|
996
1014
|
}
|
|
1015
|
+
postTreeSetNodeVisibility(payload) {
|
|
1016
|
+
this.viewer.postToViewer("viewer-tree-set-node-visibility" /* TREE_SET_NODE_VISIBILITY */, payload);
|
|
1017
|
+
}
|
|
997
1018
|
postTreeGetNodeIds(payload) {
|
|
998
1019
|
this.viewer.postToViewer("viewer-tree-get-node-ids" /* TREE_GET_NODE_IDS */, payload);
|
|
999
1020
|
}
|
|
@@ -1139,19 +1160,28 @@ var ObjectPropertiesModule = class {
|
|
|
1139
1160
|
}
|
|
1140
1161
|
getCurrent(options) {
|
|
1141
1162
|
var _a;
|
|
1163
|
+
if (this.pendingGetCurrent) {
|
|
1164
|
+
clearTimeout(this.pendingGetCurrent.timer);
|
|
1165
|
+
this.pendingGetCurrent.off();
|
|
1166
|
+
this.pendingGetCurrent.reject(new Error("No object properties"));
|
|
1167
|
+
this.pendingGetCurrent = void 0;
|
|
1168
|
+
}
|
|
1142
1169
|
const requestId = createRequestId5("object_properties_current");
|
|
1143
1170
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1144
1171
|
return new Promise((resolve, reject) => {
|
|
1145
1172
|
const timer = setTimeout(() => {
|
|
1173
|
+
this.pendingGetCurrent = void 0;
|
|
1146
1174
|
off();
|
|
1147
|
-
reject(new Error("
|
|
1175
|
+
reject(new Error("No object properties"));
|
|
1148
1176
|
}, timeoutMs);
|
|
1149
1177
|
const off = this.viewer._on("object-properties:changed", (payload2) => {
|
|
1150
1178
|
if (payload2.requestId !== requestId) return;
|
|
1151
1179
|
clearTimeout(timer);
|
|
1180
|
+
this.pendingGetCurrent = void 0;
|
|
1152
1181
|
off();
|
|
1153
1182
|
resolve(payload2);
|
|
1154
1183
|
});
|
|
1184
|
+
this.pendingGetCurrent = { requestId, off, timer, reject };
|
|
1155
1185
|
const payload = { requestId };
|
|
1156
1186
|
if (typeof (options == null ? void 0 : options.includeSelectionMeta) === "boolean") {
|
|
1157
1187
|
payload.includeSelectionMeta = options.includeSelectionMeta;
|