3dviewer-sdk 1.0.7 → 1.0.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/dist/contracts/messages.d.ts +6 -0
- package/dist/contracts/messages.js +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +49 -1
- package/dist/index.mjs +49 -1
- package/dist/modules/files.module.js +24 -1
- package/dist/modules/toolbar.module.d.ts +11 -1
- package/dist/modules/toolbar.module.js +30 -0
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export declare enum ViewerMessageType {
|
|
|
20
20
|
ZOOM_WINDOW = "viewer-zoom-window",
|
|
21
21
|
ZOOM_FIT = "viewer-zoom-fit",
|
|
22
22
|
TOOLBAR_CONFIG = "viewer-toolbar-config",
|
|
23
|
+
TOOLBAR_VISIBILITY = "viewer-toolbar-visibility",
|
|
23
24
|
PANEL_OPEN = "viewer-panel-open",
|
|
24
25
|
PANEL_CLOSE = "viewer-panel-close",
|
|
25
26
|
CUTTING_PLANE_ACTION = "viewer-cutting-plane-action",
|
|
@@ -63,6 +64,11 @@ export declare type DrawModeValue = "shaded" | "wireframe" | "hidden-line" | "sh
|
|
|
63
64
|
export declare type DrawModePayload = {
|
|
64
65
|
mode: DrawModeValue;
|
|
65
66
|
};
|
|
67
|
+
export declare type ToolbarVisibilityTarget = "all" | "left" | "center" | "right";
|
|
68
|
+
export declare type ToolbarVisibilityPayload = {
|
|
69
|
+
visible: boolean;
|
|
70
|
+
target?: ToolbarVisibilityTarget;
|
|
71
|
+
};
|
|
66
72
|
export declare type ExplodePayload = {
|
|
67
73
|
magnitude: number;
|
|
68
74
|
};
|
|
@@ -22,6 +22,7 @@ export var ViewerMessageType;
|
|
|
22
22
|
ViewerMessageType["ZOOM_WINDOW"] = "viewer-zoom-window";
|
|
23
23
|
ViewerMessageType["ZOOM_FIT"] = "viewer-zoom-fit";
|
|
24
24
|
ViewerMessageType["TOOLBAR_CONFIG"] = "viewer-toolbar-config";
|
|
25
|
+
ViewerMessageType["TOOLBAR_VISIBILITY"] = "viewer-toolbar-visibility";
|
|
25
26
|
ViewerMessageType["PANEL_OPEN"] = "viewer-panel-open";
|
|
26
27
|
ViewerMessageType["PANEL_CLOSE"] = "viewer-panel-close";
|
|
27
28
|
ViewerMessageType["CUTTING_PLANE_ACTION"] = "viewer-cutting-plane-action";
|
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,7 @@ declare enum ViewerMessageType {
|
|
|
20
20
|
ZOOM_WINDOW = "viewer-zoom-window",
|
|
21
21
|
ZOOM_FIT = "viewer-zoom-fit",
|
|
22
22
|
TOOLBAR_CONFIG = "viewer-toolbar-config",
|
|
23
|
+
TOOLBAR_VISIBILITY = "viewer-toolbar-visibility",
|
|
23
24
|
PANEL_OPEN = "viewer-panel-open",
|
|
24
25
|
PANEL_CLOSE = "viewer-panel-close",
|
|
25
26
|
CUTTING_PLANE_ACTION = "viewer-cutting-plane-action",
|
|
@@ -41,6 +42,7 @@ declare enum ViewerMessageType {
|
|
|
41
42
|
PAN_CHANGE = "viewer-pan-change"
|
|
42
43
|
}
|
|
43
44
|
type LanguageCode = "en" | "vn";
|
|
45
|
+
type ToolbarVisibilityTarget = "all" | "left" | "center" | "right";
|
|
44
46
|
type MarkupAction = "line" | "arrow" | "circle" | "ellipse" | "rectangle" | "polygon" | "polyline" | "textbox" | "note" | "callout" | "cloud" | "freehand";
|
|
45
47
|
type MarkupOperationResultPayload = {
|
|
46
48
|
requestId: string;
|
|
@@ -373,6 +375,15 @@ declare class ToolbarModule {
|
|
|
373
375
|
disableAllPdf(): void;
|
|
374
376
|
enableAll3D(): void;
|
|
375
377
|
enableAllPdf(): void;
|
|
378
|
+
hideToolbar(): void;
|
|
379
|
+
showToolbar(): void;
|
|
380
|
+
setToolbarVisible(visible: boolean, target?: ToolbarVisibilityTarget): void;
|
|
381
|
+
hideLeftToolbar(): void;
|
|
382
|
+
showLeftToolbar(): void;
|
|
383
|
+
hideCenterToolbar(): void;
|
|
384
|
+
showCenterToolbar(): void;
|
|
385
|
+
hideRightToolbar(): void;
|
|
386
|
+
showRightToolbar(): void;
|
|
376
387
|
openClippingPlanes(): void;
|
|
377
388
|
closeClippingPlanes(): void;
|
|
378
389
|
openSetting(): void;
|
|
@@ -406,6 +417,7 @@ declare class ToolbarModule {
|
|
|
406
417
|
cuttingReversePlaneY(): void;
|
|
407
418
|
cuttingReversePlaneZ(): void;
|
|
408
419
|
private postConfig;
|
|
420
|
+
private postToolbarVisibility;
|
|
409
421
|
private postPanelOpen;
|
|
410
422
|
private postPanelClose;
|
|
411
423
|
private postCuttingAction;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare enum ViewerMessageType {
|
|
|
20
20
|
ZOOM_WINDOW = "viewer-zoom-window",
|
|
21
21
|
ZOOM_FIT = "viewer-zoom-fit",
|
|
22
22
|
TOOLBAR_CONFIG = "viewer-toolbar-config",
|
|
23
|
+
TOOLBAR_VISIBILITY = "viewer-toolbar-visibility",
|
|
23
24
|
PANEL_OPEN = "viewer-panel-open",
|
|
24
25
|
PANEL_CLOSE = "viewer-panel-close",
|
|
25
26
|
CUTTING_PLANE_ACTION = "viewer-cutting-plane-action",
|
|
@@ -41,6 +42,7 @@ declare enum ViewerMessageType {
|
|
|
41
42
|
PAN_CHANGE = "viewer-pan-change"
|
|
42
43
|
}
|
|
43
44
|
type LanguageCode = "en" | "vn";
|
|
45
|
+
type ToolbarVisibilityTarget = "all" | "left" | "center" | "right";
|
|
44
46
|
type MarkupAction = "line" | "arrow" | "circle" | "ellipse" | "rectangle" | "polygon" | "polyline" | "textbox" | "note" | "callout" | "cloud" | "freehand";
|
|
45
47
|
type MarkupOperationResultPayload = {
|
|
46
48
|
requestId: string;
|
|
@@ -373,6 +375,15 @@ declare class ToolbarModule {
|
|
|
373
375
|
disableAllPdf(): void;
|
|
374
376
|
enableAll3D(): void;
|
|
375
377
|
enableAllPdf(): void;
|
|
378
|
+
hideToolbar(): void;
|
|
379
|
+
showToolbar(): void;
|
|
380
|
+
setToolbarVisible(visible: boolean, target?: ToolbarVisibilityTarget): void;
|
|
381
|
+
hideLeftToolbar(): void;
|
|
382
|
+
showLeftToolbar(): void;
|
|
383
|
+
hideCenterToolbar(): void;
|
|
384
|
+
showCenterToolbar(): void;
|
|
385
|
+
hideRightToolbar(): void;
|
|
386
|
+
showRightToolbar(): void;
|
|
376
387
|
openClippingPlanes(): void;
|
|
377
388
|
closeClippingPlanes(): void;
|
|
378
389
|
openSetting(): void;
|
|
@@ -406,6 +417,7 @@ declare class ToolbarModule {
|
|
|
406
417
|
cuttingReversePlaneY(): void;
|
|
407
418
|
cuttingReversePlaneZ(): void;
|
|
408
419
|
private postConfig;
|
|
420
|
+
private postToolbarVisibility;
|
|
409
421
|
private postPanelOpen;
|
|
410
422
|
private postPanelClose;
|
|
411
423
|
private postCuttingAction;
|
package/dist/index.js
CHANGED
|
@@ -274,12 +274,30 @@ var FilesModule = class {
|
|
|
274
274
|
}
|
|
275
275
|
// Resolve viewer route path (e.g. /mainviewer).
|
|
276
276
|
resolveViewerPath() {
|
|
277
|
-
const
|
|
277
|
+
const configuredPath = this.config.viewerPath || this.viewer.getOptions().viewerPath;
|
|
278
|
+
if (!configuredPath) {
|
|
279
|
+
const viewerUrl = this.viewer.getOptions().url;
|
|
280
|
+
if (viewerUrl) {
|
|
281
|
+
try {
|
|
282
|
+
const pathname = new URL(viewerUrl, window.location.href).pathname;
|
|
283
|
+
if (pathname && pathname !== "/") return pathname;
|
|
284
|
+
} catch {
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const p = (configuredPath || "/mainviewer").trim();
|
|
278
289
|
if (!p) return "/mainviewer";
|
|
279
290
|
return p.startsWith("/") ? p : `/${p}`;
|
|
280
291
|
}
|
|
281
292
|
// Viewer host used to open iframe after conversion completes.
|
|
282
293
|
resolveViewerOrigin() {
|
|
294
|
+
const viewerUrl = this.viewer.getOptions().url;
|
|
295
|
+
if (viewerUrl) {
|
|
296
|
+
try {
|
|
297
|
+
return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
}
|
|
283
301
|
return this.normalizeBaseUrl(DEFAULT_VIEWER_ORIGIN);
|
|
284
302
|
}
|
|
285
303
|
// Build conversion service root from API base URL.
|
|
@@ -614,6 +632,33 @@ var ToolbarModule = class {
|
|
|
614
632
|
enableAllPdf() {
|
|
615
633
|
this.clearDisabledPdf();
|
|
616
634
|
}
|
|
635
|
+
hideToolbar() {
|
|
636
|
+
this.setToolbarVisible(false);
|
|
637
|
+
}
|
|
638
|
+
showToolbar() {
|
|
639
|
+
this.setToolbarVisible(true);
|
|
640
|
+
}
|
|
641
|
+
setToolbarVisible(visible, target = "all") {
|
|
642
|
+
this.postToolbarVisibility({ visible, target });
|
|
643
|
+
}
|
|
644
|
+
hideLeftToolbar() {
|
|
645
|
+
this.setToolbarVisible(false, "left");
|
|
646
|
+
}
|
|
647
|
+
showLeftToolbar() {
|
|
648
|
+
this.setToolbarVisible(true, "left");
|
|
649
|
+
}
|
|
650
|
+
hideCenterToolbar() {
|
|
651
|
+
this.setToolbarVisible(false, "center");
|
|
652
|
+
}
|
|
653
|
+
showCenterToolbar() {
|
|
654
|
+
this.setToolbarVisible(true, "center");
|
|
655
|
+
}
|
|
656
|
+
hideRightToolbar() {
|
|
657
|
+
this.setToolbarVisible(false, "right");
|
|
658
|
+
}
|
|
659
|
+
showRightToolbar() {
|
|
660
|
+
this.setToolbarVisible(true, "right");
|
|
661
|
+
}
|
|
617
662
|
openClippingPlanes() {
|
|
618
663
|
this.postPanelOpen({ panel: "clipping-commands", format: "3d" });
|
|
619
664
|
}
|
|
@@ -728,6 +773,9 @@ var ToolbarModule = class {
|
|
|
728
773
|
postConfig(payload) {
|
|
729
774
|
this.viewer.postToViewer("viewer-toolbar-config" /* TOOLBAR_CONFIG */, payload);
|
|
730
775
|
}
|
|
776
|
+
postToolbarVisibility(payload) {
|
|
777
|
+
this.viewer.postToViewer("viewer-toolbar-visibility" /* TOOLBAR_VISIBILITY */, payload);
|
|
778
|
+
}
|
|
731
779
|
postPanelOpen(payload) {
|
|
732
780
|
this.viewer.postToViewer("viewer-panel-open" /* PANEL_OPEN */, payload);
|
|
733
781
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -248,12 +248,30 @@ var FilesModule = class {
|
|
|
248
248
|
}
|
|
249
249
|
// Resolve viewer route path (e.g. /mainviewer).
|
|
250
250
|
resolveViewerPath() {
|
|
251
|
-
const
|
|
251
|
+
const configuredPath = this.config.viewerPath || this.viewer.getOptions().viewerPath;
|
|
252
|
+
if (!configuredPath) {
|
|
253
|
+
const viewerUrl = this.viewer.getOptions().url;
|
|
254
|
+
if (viewerUrl) {
|
|
255
|
+
try {
|
|
256
|
+
const pathname = new URL(viewerUrl, window.location.href).pathname;
|
|
257
|
+
if (pathname && pathname !== "/") return pathname;
|
|
258
|
+
} catch {
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const p = (configuredPath || "/mainviewer").trim();
|
|
252
263
|
if (!p) return "/mainviewer";
|
|
253
264
|
return p.startsWith("/") ? p : `/${p}`;
|
|
254
265
|
}
|
|
255
266
|
// Viewer host used to open iframe after conversion completes.
|
|
256
267
|
resolveViewerOrigin() {
|
|
268
|
+
const viewerUrl = this.viewer.getOptions().url;
|
|
269
|
+
if (viewerUrl) {
|
|
270
|
+
try {
|
|
271
|
+
return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
|
|
272
|
+
} catch {
|
|
273
|
+
}
|
|
274
|
+
}
|
|
257
275
|
return this.normalizeBaseUrl(DEFAULT_VIEWER_ORIGIN);
|
|
258
276
|
}
|
|
259
277
|
// Build conversion service root from API base URL.
|
|
@@ -588,6 +606,33 @@ var ToolbarModule = class {
|
|
|
588
606
|
enableAllPdf() {
|
|
589
607
|
this.clearDisabledPdf();
|
|
590
608
|
}
|
|
609
|
+
hideToolbar() {
|
|
610
|
+
this.setToolbarVisible(false);
|
|
611
|
+
}
|
|
612
|
+
showToolbar() {
|
|
613
|
+
this.setToolbarVisible(true);
|
|
614
|
+
}
|
|
615
|
+
setToolbarVisible(visible, target = "all") {
|
|
616
|
+
this.postToolbarVisibility({ visible, target });
|
|
617
|
+
}
|
|
618
|
+
hideLeftToolbar() {
|
|
619
|
+
this.setToolbarVisible(false, "left");
|
|
620
|
+
}
|
|
621
|
+
showLeftToolbar() {
|
|
622
|
+
this.setToolbarVisible(true, "left");
|
|
623
|
+
}
|
|
624
|
+
hideCenterToolbar() {
|
|
625
|
+
this.setToolbarVisible(false, "center");
|
|
626
|
+
}
|
|
627
|
+
showCenterToolbar() {
|
|
628
|
+
this.setToolbarVisible(true, "center");
|
|
629
|
+
}
|
|
630
|
+
hideRightToolbar() {
|
|
631
|
+
this.setToolbarVisible(false, "right");
|
|
632
|
+
}
|
|
633
|
+
showRightToolbar() {
|
|
634
|
+
this.setToolbarVisible(true, "right");
|
|
635
|
+
}
|
|
591
636
|
openClippingPlanes() {
|
|
592
637
|
this.postPanelOpen({ panel: "clipping-commands", format: "3d" });
|
|
593
638
|
}
|
|
@@ -702,6 +747,9 @@ var ToolbarModule = class {
|
|
|
702
747
|
postConfig(payload) {
|
|
703
748
|
this.viewer.postToViewer("viewer-toolbar-config" /* TOOLBAR_CONFIG */, payload);
|
|
704
749
|
}
|
|
750
|
+
postToolbarVisibility(payload) {
|
|
751
|
+
this.viewer.postToViewer("viewer-toolbar-visibility" /* TOOLBAR_VISIBILITY */, payload);
|
|
752
|
+
}
|
|
705
753
|
postPanelOpen(payload) {
|
|
706
754
|
this.viewer.postToViewer("viewer-panel-open" /* PANEL_OPEN */, payload);
|
|
707
755
|
}
|
|
@@ -134,13 +134,36 @@ export class FilesModule {
|
|
|
134
134
|
}
|
|
135
135
|
// Resolve viewer route path (e.g. /mainviewer).
|
|
136
136
|
resolveViewerPath() {
|
|
137
|
-
const
|
|
137
|
+
const configuredPath = this.config.viewerPath || this.viewer.getOptions().viewerPath;
|
|
138
|
+
if (!configuredPath) {
|
|
139
|
+
const viewerUrl = this.viewer.getOptions().url;
|
|
140
|
+
if (viewerUrl) {
|
|
141
|
+
try {
|
|
142
|
+
const pathname = new URL(viewerUrl, window.location.href).pathname;
|
|
143
|
+
if (pathname && pathname !== "/")
|
|
144
|
+
return pathname;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// Fallback to default path below.
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const p = (configuredPath || "/mainviewer").trim();
|
|
138
152
|
if (!p)
|
|
139
153
|
return "/mainviewer";
|
|
140
154
|
return p.startsWith("/") ? p : `/${p}`;
|
|
141
155
|
}
|
|
142
156
|
// Viewer host used to open iframe after conversion completes.
|
|
143
157
|
resolveViewerOrigin() {
|
|
158
|
+
const viewerUrl = this.viewer.getOptions().url;
|
|
159
|
+
if (viewerUrl) {
|
|
160
|
+
try {
|
|
161
|
+
return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Fallback to default origin below.
|
|
165
|
+
}
|
|
166
|
+
}
|
|
144
167
|
return this.normalizeBaseUrl(DEFAULT_VIEWER_ORIGIN);
|
|
145
168
|
}
|
|
146
169
|
// Build conversion service root from API base URL.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Viewer3D } from "../viewer";
|
|
2
|
-
import { type SheetListItem } from "../contracts/messages";
|
|
2
|
+
import { type SheetListItem, type ToolbarVisibilityTarget } from "../contracts/messages";
|
|
3
3
|
export declare type ToolbarFormat = "3d" | "pdf";
|
|
4
4
|
export declare type GetSheetsOptions = {
|
|
5
5
|
timeoutMs?: number;
|
|
@@ -42,6 +42,15 @@ export declare class ToolbarModule {
|
|
|
42
42
|
disableAllPdf(): void;
|
|
43
43
|
enableAll3D(): void;
|
|
44
44
|
enableAllPdf(): void;
|
|
45
|
+
hideToolbar(): void;
|
|
46
|
+
showToolbar(): void;
|
|
47
|
+
setToolbarVisible(visible: boolean, target?: ToolbarVisibilityTarget): void;
|
|
48
|
+
hideLeftToolbar(): void;
|
|
49
|
+
showLeftToolbar(): void;
|
|
50
|
+
hideCenterToolbar(): void;
|
|
51
|
+
showCenterToolbar(): void;
|
|
52
|
+
hideRightToolbar(): void;
|
|
53
|
+
showRightToolbar(): void;
|
|
45
54
|
openClippingPlanes(): void;
|
|
46
55
|
closeClippingPlanes(): void;
|
|
47
56
|
openSetting(): void;
|
|
@@ -75,6 +84,7 @@ export declare class ToolbarModule {
|
|
|
75
84
|
cuttingReversePlaneY(): void;
|
|
76
85
|
cuttingReversePlaneZ(): void;
|
|
77
86
|
private postConfig;
|
|
87
|
+
private postToolbarVisibility;
|
|
78
88
|
private postPanelOpen;
|
|
79
89
|
private postPanelClose;
|
|
80
90
|
private postCuttingAction;
|
|
@@ -86,6 +86,33 @@ export class ToolbarModule {
|
|
|
86
86
|
enableAllPdf() {
|
|
87
87
|
this.clearDisabledPdf();
|
|
88
88
|
}
|
|
89
|
+
hideToolbar() {
|
|
90
|
+
this.setToolbarVisible(false);
|
|
91
|
+
}
|
|
92
|
+
showToolbar() {
|
|
93
|
+
this.setToolbarVisible(true);
|
|
94
|
+
}
|
|
95
|
+
setToolbarVisible(visible, target = "all") {
|
|
96
|
+
this.postToolbarVisibility({ visible, target });
|
|
97
|
+
}
|
|
98
|
+
hideLeftToolbar() {
|
|
99
|
+
this.setToolbarVisible(false, "left");
|
|
100
|
+
}
|
|
101
|
+
showLeftToolbar() {
|
|
102
|
+
this.setToolbarVisible(true, "left");
|
|
103
|
+
}
|
|
104
|
+
hideCenterToolbar() {
|
|
105
|
+
this.setToolbarVisible(false, "center");
|
|
106
|
+
}
|
|
107
|
+
showCenterToolbar() {
|
|
108
|
+
this.setToolbarVisible(true, "center");
|
|
109
|
+
}
|
|
110
|
+
hideRightToolbar() {
|
|
111
|
+
this.setToolbarVisible(false, "right");
|
|
112
|
+
}
|
|
113
|
+
showRightToolbar() {
|
|
114
|
+
this.setToolbarVisible(true, "right");
|
|
115
|
+
}
|
|
89
116
|
openClippingPlanes() {
|
|
90
117
|
this.postPanelOpen({ panel: "clipping-commands", format: "3d" });
|
|
91
118
|
}
|
|
@@ -201,6 +228,9 @@ export class ToolbarModule {
|
|
|
201
228
|
postConfig(payload) {
|
|
202
229
|
this.viewer.postToViewer(ViewerMessageType.TOOLBAR_CONFIG, payload);
|
|
203
230
|
}
|
|
231
|
+
postToolbarVisibility(payload) {
|
|
232
|
+
this.viewer.postToViewer(ViewerMessageType.TOOLBAR_VISIBILITY, payload);
|
|
233
|
+
}
|
|
204
234
|
postPanelOpen(payload) {
|
|
205
235
|
this.viewer.postToViewer(ViewerMessageType.PANEL_OPEN, payload);
|
|
206
236
|
}
|