@inweb/viewer-visualize 25.12.0 → 26.1.0
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/viewer-visualize.js +15881 -15090
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +2914 -2735
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Commands/ApplyModelTransform.d.ts +3 -0
- package/lib/Viewer/Commands/AutoTransformAllModelsToCentralPoint.d.ts +3 -1
- package/lib/Viewer/Commands/ClearMarkup.d.ts +2 -1
- package/lib/Viewer/Commands/ClearSelected.d.ts +2 -1
- package/lib/Viewer/Commands/ClearSlices.d.ts +2 -1
- package/lib/Viewer/Commands/CreatePreview.d.ts +2 -1
- package/lib/Viewer/Commands/Explode.d.ts +3 -1
- package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +2 -1
- package/lib/Viewer/Commands/GetModels.d.ts +2 -1
- package/lib/Viewer/Commands/GetSelected.d.ts +2 -1
- package/lib/Viewer/Commands/HideSelected.d.ts +2 -1
- package/lib/Viewer/Commands/IsolateSelected.d.ts +2 -1
- package/lib/Viewer/Commands/RegenerateAll.d.ts +2 -1
- package/lib/Viewer/Commands/ResetView.d.ts +2 -1
- package/lib/Viewer/Commands/SelectModel.d.ts +2 -1
- package/lib/Viewer/Commands/SetActiveDragger.d.ts +2 -1
- package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +2 -1
- package/lib/Viewer/Commands/SetMarkupColor.d.ts +2 -1
- package/lib/Viewer/Commands/SetSelected.d.ts +2 -1
- package/lib/Viewer/Commands/ShowAll.d.ts +2 -1
- package/lib/Viewer/Commands/ZoomToExtents.d.ts +2 -1
- package/lib/Viewer/Commands/ZoomToObjects.d.ts +2 -1
- package/lib/Viewer/Commands/ZoomToSelected.d.ts +2 -1
- package/lib/Viewer/Commands/index.d.ts +22 -23
- package/lib/Viewer/Components/GestureManagerComponent.d.ts +8 -0
- package/lib/Viewer/Components/RenderLoopComponent.d.ts +9 -0
- package/lib/Viewer/Components/ResizeCanvasComponent.d.ts +9 -0
- package/lib/Viewer/Components/ZoomWheelComponent.d.ts +8 -0
- package/lib/Viewer/Components/index.d.ts +40 -0
- package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +3 -1
- package/lib/Viewer/Draggers/index.d.ts +40 -0
- package/lib/Viewer/Viewer.d.ts +7 -36
- package/lib/index.d.ts +3 -1
- package/package.json +5 -5
- package/src/Viewer/Commands/ApplyModelTransform.ts +1 -4
- package/src/Viewer/Commands/AutoTransformAllModelsToCentralPoint.ts +4 -5
- package/src/Viewer/Commands/ClearMarkup.ts +3 -3
- package/src/Viewer/Commands/ClearSelected.ts +1 -5
- package/src/Viewer/Commands/ClearSlices.ts +3 -2
- package/src/Viewer/Commands/CreatePreview.ts +1 -4
- package/src/Viewer/Commands/Explode.ts +4 -4
- package/src/Viewer/Commands/GetDefaultViewPositions.ts +1 -4
- package/src/Viewer/Commands/GetModels.ts +1 -4
- package/src/Viewer/Commands/GetSelected.ts +1 -4
- package/src/Viewer/Commands/HideSelected.ts +1 -4
- package/src/Viewer/Commands/IsolateSelected.ts +1 -4
- package/src/Viewer/Commands/RegenerateAll.ts +1 -4
- package/src/Viewer/Commands/ResetView.ts +1 -4
- package/src/Viewer/Commands/SelectModel.ts +1 -4
- package/src/Viewer/Commands/SetActiveDragger.ts +2 -3
- package/src/Viewer/Commands/SetDefaultViewPosition.ts +1 -14
- package/src/Viewer/Commands/SetMarkupColor.ts +3 -4
- package/src/Viewer/Commands/SetSelected.ts +1 -4
- package/src/Viewer/Commands/ShowAll.ts +1 -4
- package/src/Viewer/Commands/ZoomToExtents.ts +1 -5
- package/src/Viewer/Commands/ZoomToObjects.ts +1 -4
- package/src/Viewer/Commands/ZoomToSelected.ts +1 -4
- package/src/Viewer/Commands/index.ts +89 -23
- package/src/Viewer/Components/GestureManagerComponent.ts +42 -0
- package/src/Viewer/Components/RenderLoopComponent.ts +44 -0
- package/src/Viewer/Components/ResizeCanvasComponent.ts +44 -0
- package/src/Viewer/Components/ZoomWheelComponent.ts +43 -0
- package/src/Viewer/Components/index.ts +76 -0
- package/src/Viewer/Draggers/Actions/OrbitAction.ts +1 -1
- package/src/Viewer/Draggers/Actions/PanAction.ts +1 -1
- package/src/Viewer/Draggers/Actions/ZoomAction.ts +1 -1
- package/src/Viewer/Draggers/Common/Geometry.ts +1 -1
- package/src/Viewer/Draggers/OdaWalkDragger.ts +10 -1
- package/src/Viewer/Draggers/index.ts +91 -0
- package/src/Viewer/Viewer.ts +47 -106
- package/src/index.ts +5 -2
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function hideSelected(viewer: Viewer): void {
|
|
26
|
+
export function hideSelected(viewer: Viewer): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -34,5 +33,3 @@ function hideSelected(viewer: Viewer): void {
|
|
|
34
33
|
viewer.emitEvent({ type: "hide" });
|
|
35
34
|
viewer.emitEvent({ type: "select", data: undefined, handles: [] });
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
commands("VisualizeJS").registerCommand("hideSelected", hideSelected);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function isolateSelected(viewer: Viewer): void {
|
|
26
|
+
export function isolateSelected(viewer: Viewer): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -33,5 +32,3 @@ function isolateSelected(viewer: Viewer): void {
|
|
|
33
32
|
viewer.update();
|
|
34
33
|
viewer.emitEvent({ type: "isolate" });
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
commands("VisualizeJS").registerCommand("isolateSelected", isolateSelected);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function regenerateAll(viewer: Viewer): void {
|
|
26
|
+
export function regenerateAll(viewer: Viewer): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -33,5 +32,3 @@ function regenerateAll(viewer: Viewer): void {
|
|
|
33
32
|
viewer.update();
|
|
34
33
|
viewer.emit({ type: "regenerateall" });
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
commands("VisualizeJS").registerCommand("regenerateAll", regenerateAll);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function resetView(viewer: Viewer): void {
|
|
26
|
+
export function resetView(viewer: Viewer): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
viewer.executeCommand("setActiveDragger");
|
|
@@ -39,5 +38,3 @@ function resetView(viewer: Viewer): void {
|
|
|
39
38
|
|
|
40
39
|
viewer.emit({ type: "resetview" });
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
commands("VisualizeJS").registerCommand("resetView", resetView);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function selectModel(viewer: Viewer, handle: string): void {
|
|
26
|
+
export function selectModel(viewer: Viewer, handle: string): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -48,5 +47,3 @@ function selectModel(viewer: Viewer, handle: string): void {
|
|
|
48
47
|
}
|
|
49
48
|
modelItr.delete();
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
commands("VisualizeJS").registerCommand("selectModel", selectModel);
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
export function setActiveDragger(viewer: Viewer, dragger = "") {
|
|
28
27
|
viewer.setActiveDragger(dragger);
|
|
29
|
-
}
|
|
28
|
+
}
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function setDefaultViewPosition(viewer: Viewer, position = ""): void {
|
|
26
|
+
export function setDefaultViewPosition(viewer: Viewer, position = ""): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visLib = viewer.visLib();
|
|
@@ -36,15 +35,3 @@ function setDefaultViewPosition(viewer: Viewer, position = ""): void {
|
|
|
36
35
|
viewer.update();
|
|
37
36
|
viewer.emit({ type: "viewposition", data: position });
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
commands("VisualizeJS").registerCommand("setDefaultViewPosition", setDefaultViewPosition);
|
|
41
|
-
commands("VisualizeJS").registerCommand("k3DViewTop", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
|
|
42
|
-
commands("VisualizeJS").registerCommand("k3DViewBottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
|
|
43
|
-
commands("VisualizeJS").registerCommand("k3DViewLeft", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
|
|
44
|
-
commands("VisualizeJS").registerCommand("k3DViewRight", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
|
|
45
|
-
commands("VisualizeJS").registerCommand("k3DViewFront", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
|
|
46
|
-
commands("VisualizeJS").registerCommand("k3DViewBack", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
|
|
47
|
-
commands("VisualizeJS").registerCommand("k3DViewSE", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
|
|
48
|
-
commands("VisualizeJS").registerCommand("k3DViewSW", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
|
|
49
|
-
commands("VisualizeJS").registerCommand("k3DViewNE", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
|
|
50
|
-
commands("VisualizeJS").registerCommand("k3DViewNW", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
viewer.setMarkupColor(r, g, b);
|
|
29
|
-
}
|
|
26
|
+
export function setMarkupColor(viewer: Viewer, r = 255, g = 0, b = 0) {
|
|
27
|
+
viewer.markup.setMarkupColor(r, g, b);
|
|
28
|
+
}
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function setSelected(viewer: Viewer, handles: string[] = []): void {
|
|
26
|
+
export function setSelected(viewer: Viewer, handles: string[] = []): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visLib = viewer.visLib();
|
|
@@ -43,5 +42,3 @@ function setSelected(viewer: Viewer, handles: string[] = []): void {
|
|
|
43
42
|
|
|
44
43
|
selectionSet.delete();
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
commands("VisualizeJS").registerCommand("setSelected", setSelected);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function showAll(viewer: Viewer): void {
|
|
26
|
+
export function showAll(viewer: Viewer): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -33,5 +32,3 @@ function showAll(viewer: Viewer): void {
|
|
|
33
32
|
viewer.update();
|
|
34
33
|
viewer.emitEvent({ type: "showall" });
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
commands("VisualizeJS").registerCommand("showAll", showAll);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function zoomToExtents(viewer: Viewer, force = false, animate = viewer.options.cameraAnimation): void {
|
|
26
|
+
export function zoomToExtents(viewer: Viewer, force = false, animate = viewer.options.cameraAnimation): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -39,6 +38,3 @@ function zoomToExtents(viewer: Viewer, force = false, animate = viewer.options.c
|
|
|
39
38
|
viewer.update();
|
|
40
39
|
viewer.emitEvent({ type: "zoom" });
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
commands("VisualizeJS").registerCommand("zoomToExtents", zoomToExtents);
|
|
44
|
-
commands("VisualizeJS").registerCommandAlias("zoomToExtents", "zoomExtents");
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function zoomToObjects(viewer: Viewer, handles: string[] = []): void {
|
|
26
|
+
export function zoomToObjects(viewer: Viewer, handles: string[] = []): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visLib = viewer.visLib();
|
|
@@ -44,5 +43,3 @@ function zoomToObjects(viewer: Viewer, handles: string[] = []): void {
|
|
|
44
43
|
|
|
45
44
|
selectionSet.delete();
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
commands("VisualizeJS").registerCommand("zoomToObjects", zoomToObjects);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import { commands } from "@inweb/viewer-core";
|
|
25
24
|
import { Viewer } from "../Viewer";
|
|
26
25
|
|
|
27
|
-
function zoomToSelected(viewer: Viewer): void {
|
|
26
|
+
export function zoomToSelected(viewer: Viewer): void {
|
|
28
27
|
if (!viewer.visualizeJs) return;
|
|
29
28
|
|
|
30
29
|
const visViewer = viewer.visViewer();
|
|
@@ -36,5 +35,3 @@ function zoomToSelected(viewer: Viewer): void {
|
|
|
36
35
|
viewer.update();
|
|
37
36
|
viewer.emitEvent({ type: "zoom" });
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
|
|
@@ -21,26 +21,92 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import "
|
|
25
|
-
|
|
26
|
-
import "./
|
|
27
|
-
import "./
|
|
28
|
-
import "./
|
|
29
|
-
import "./
|
|
30
|
-
import "./
|
|
31
|
-
import "./
|
|
32
|
-
import "./
|
|
33
|
-
import "./
|
|
34
|
-
import "./
|
|
35
|
-
import "./
|
|
36
|
-
import "./
|
|
37
|
-
import "./
|
|
38
|
-
import "./
|
|
39
|
-
import "./
|
|
40
|
-
import "./
|
|
41
|
-
import "./
|
|
42
|
-
import "./
|
|
43
|
-
import "./
|
|
44
|
-
import "./
|
|
45
|
-
import "./
|
|
46
|
-
import "./
|
|
24
|
+
import { ICommandsRegistry, commandsRegistry } from "@inweb/viewer-core";
|
|
25
|
+
|
|
26
|
+
import { applyModelTransform } from "./ApplyModelTransform";
|
|
27
|
+
import { clearMarkup } from "./ClearMarkup";
|
|
28
|
+
import { clearSelected } from "./ClearSelected";
|
|
29
|
+
import { clearSlices } from "./ClearSlices";
|
|
30
|
+
import { createPreview } from "./CreatePreview";
|
|
31
|
+
import { explode, collect } from "./Explode";
|
|
32
|
+
import { getDefaultViewPositions } from "./GetDefaultViewPositions";
|
|
33
|
+
import { getModels } from "./GetModels";
|
|
34
|
+
import { getSelected } from "./GetSelected";
|
|
35
|
+
import { hideSelected } from "./HideSelected";
|
|
36
|
+
import { isolateSelected } from "./IsolateSelected";
|
|
37
|
+
import { regenerateAll } from "./RegenerateAll";
|
|
38
|
+
import { resetView } from "./ResetView";
|
|
39
|
+
import { selectModel } from "./SelectModel";
|
|
40
|
+
import { setActiveDragger } from "./SetActiveDragger";
|
|
41
|
+
import { setDefaultViewPosition } from "./SetDefaultViewPosition";
|
|
42
|
+
import { setMarkupColor } from "./SetMarkupColor";
|
|
43
|
+
import { setSelected } from "./SetSelected";
|
|
44
|
+
import { showAll } from "./ShowAll";
|
|
45
|
+
import { zoomToExtents } from "./ZoomToExtents";
|
|
46
|
+
import { zoomToObjects } from "./ZoomToObjects";
|
|
47
|
+
import { zoomToSelected } from "./ZoomToSelected";
|
|
48
|
+
import { autoTransformAllModelsToCentralPoint } from "./AutoTransformAllModelsToCentralPoint";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A commands registry. Use this registry to register custom commands.
|
|
52
|
+
*
|
|
53
|
+
* To implement custom command:
|
|
54
|
+
*
|
|
55
|
+
* 1. Define a command handler with a first `viewer` parameter.
|
|
56
|
+
* 2. Register command handler in the commands registry by calling the {@link commands.registerCommand}.
|
|
57
|
+
*
|
|
58
|
+
* @example <caption>Implementing a custom command.</caption>
|
|
59
|
+
* import { commands, Viewer } from "@inweb/viewer-visualize";
|
|
60
|
+
*
|
|
61
|
+
* function commandHandler(viewer: Viewer, name = "world"): void {
|
|
62
|
+
* console.log(`Hello ${name}!!!`);
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* commands.registerCommand("sayHello", commandHandler);
|
|
66
|
+
*
|
|
67
|
+
* @example <caption>Calling a custom command.</caption>
|
|
68
|
+
* viewer.executeCommand("sayHello", "user");
|
|
69
|
+
*/
|
|
70
|
+
export const commands: ICommandsRegistry = commandsRegistry("visualizejs");
|
|
71
|
+
|
|
72
|
+
// build-in commands
|
|
73
|
+
|
|
74
|
+
commands.registerCommand("applyModelTransform", applyModelTransform);
|
|
75
|
+
commands.registerCommand("clearMarkup", clearMarkup);
|
|
76
|
+
commands.registerCommand("clearSelected", clearSelected);
|
|
77
|
+
commands.registerCommand("clearSlices", clearSlices);
|
|
78
|
+
commands.registerCommand("createPreview", createPreview);
|
|
79
|
+
commands.registerCommand("explode", explode);
|
|
80
|
+
commands.registerCommand("collect", collect);
|
|
81
|
+
commands.registerCommand("getDefaultViewPositions", getDefaultViewPositions);
|
|
82
|
+
commands.registerCommand("getModels", getModels);
|
|
83
|
+
commands.registerCommand("getSelected", getSelected);
|
|
84
|
+
commands.registerCommand("hideSelected", hideSelected);
|
|
85
|
+
commands.registerCommand("isolateSelected", isolateSelected);
|
|
86
|
+
commands.registerCommand("regenerateAll", regenerateAll);
|
|
87
|
+
commands.registerCommand("resetView", resetView);
|
|
88
|
+
commands.registerCommand("selectModel", selectModel);
|
|
89
|
+
commands.registerCommand("setActiveDragger", setActiveDragger);
|
|
90
|
+
commands.registerCommand("setDefaultViewPosition", setDefaultViewPosition);
|
|
91
|
+
commands.registerCommand("setMarkupColor", setMarkupColor);
|
|
92
|
+
commands.registerCommand("setSelected", setSelected);
|
|
93
|
+
commands.registerCommand("showAll", showAll);
|
|
94
|
+
commands.registerCommand("zoomToExtents", zoomToExtents);
|
|
95
|
+
commands.registerCommand("zoomToObjects", zoomToObjects);
|
|
96
|
+
commands.registerCommand("zoomToSelected", zoomToSelected);
|
|
97
|
+
commands.registerCommand("autoTransformAllModelsToCentralPoint", autoTransformAllModelsToCentralPoint);
|
|
98
|
+
|
|
99
|
+
commands.registerCommand("k3DViewTop", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
|
|
100
|
+
commands.registerCommand("k3DViewBottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
|
|
101
|
+
commands.registerCommand("k3DViewLeft", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
|
|
102
|
+
commands.registerCommand("k3DViewRight", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
|
|
103
|
+
commands.registerCommand("k3DViewFront", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
|
|
104
|
+
commands.registerCommand("k3DViewBack", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
|
|
105
|
+
commands.registerCommand("k3DViewSE", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
|
|
106
|
+
commands.registerCommand("k3DViewSW", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
|
|
107
|
+
commands.registerCommand("k3DViewNE", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
|
|
108
|
+
commands.registerCommand("k3DViewNW", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
|
|
109
|
+
|
|
110
|
+
commands.registerCommandAlias("clearMarkup", "clearOverlay");
|
|
111
|
+
commands.registerCommandAlias("clearSelected", "unselect");
|
|
112
|
+
commands.registerCommandAlias("zoomToExtents", "zoomExtents");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { IComponent } from "@inweb/viewer-core";
|
|
25
|
+
import type { Viewer } from "../Viewer";
|
|
26
|
+
import { GestureManager } from "../Draggers/Common/GestureManager";
|
|
27
|
+
|
|
28
|
+
export class GestureManagerComponent implements IComponent {
|
|
29
|
+
protected viewer: Viewer;
|
|
30
|
+
private gestureManager: GestureManager;
|
|
31
|
+
|
|
32
|
+
constructor(viewer: Viewer) {
|
|
33
|
+
this.viewer = viewer;
|
|
34
|
+
this.gestureManager = new GestureManager(viewer);
|
|
35
|
+
this.gestureManager.initialize();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
dispose() {
|
|
39
|
+
this.gestureManager.dispose();
|
|
40
|
+
this.gestureManager = undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { IComponent } from "@inweb/viewer-core";
|
|
25
|
+
import type { Viewer } from "../Viewer";
|
|
26
|
+
|
|
27
|
+
export class RenderLoopComponent implements IComponent {
|
|
28
|
+
protected viewer: Viewer;
|
|
29
|
+
protected requestId: number;
|
|
30
|
+
|
|
31
|
+
constructor(viewer: Viewer) {
|
|
32
|
+
this.viewer = viewer;
|
|
33
|
+
this.animate();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
dispose() {
|
|
37
|
+
cancelAnimationFrame(this.requestId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
animate = (time = 0) => {
|
|
41
|
+
this.requestId = requestAnimationFrame(this.animate);
|
|
42
|
+
this.viewer.render(time);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { IComponent } from "@inweb/viewer-core";
|
|
25
|
+
import type { Viewer } from "../Viewer";
|
|
26
|
+
|
|
27
|
+
export class ResizeCanvasComponent implements IComponent {
|
|
28
|
+
protected viewer: Viewer;
|
|
29
|
+
protected resizeObserver: ResizeObserver;
|
|
30
|
+
|
|
31
|
+
constructor(viewer: Viewer) {
|
|
32
|
+
this.viewer = viewer;
|
|
33
|
+
this.resizeObserver = new ResizeObserver(this.resizeViewer);
|
|
34
|
+
this.resizeObserver.observe(viewer.canvas.parentElement);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
dispose() {
|
|
38
|
+
this.resizeObserver.disconnect();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
resizeViewer = () => {
|
|
42
|
+
this.viewer.resize();
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { IComponent } from "@inweb/viewer-core";
|
|
25
|
+
import type { Viewer } from "../Viewer";
|
|
26
|
+
import { OdZoomWheelDragger } from "../Draggers/OdZoomWheelDragger";
|
|
27
|
+
|
|
28
|
+
export class ZoomWheelComponent implements IComponent {
|
|
29
|
+
protected viewer: Viewer;
|
|
30
|
+
private zoomWheelDragger: OdZoomWheelDragger;
|
|
31
|
+
|
|
32
|
+
constructor(viewer: Viewer) {
|
|
33
|
+
this.viewer = viewer;
|
|
34
|
+
this.zoomWheelDragger = new OdZoomWheelDragger(viewer);
|
|
35
|
+
this.zoomWheelDragger.name = "ZoomWheel";
|
|
36
|
+
this.zoomWheelDragger.initialize();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
dispose() {
|
|
40
|
+
this.zoomWheelDragger.dispose();
|
|
41
|
+
this.zoomWheelDragger = undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { IComponentsRegistry, componentsRegistry } from "@inweb/viewer-core";
|
|
25
|
+
|
|
26
|
+
import { RenderLoopComponent } from "./RenderLoopComponent";
|
|
27
|
+
import { ResizeCanvasComponent } from "./ResizeCanvasComponent";
|
|
28
|
+
import { ZoomWheelComponent } from "./ZoomWheelComponent";
|
|
29
|
+
import { GestureManagerComponent } from "./GestureManagerComponent";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Viewer components registry. Use this registry to register custom components.
|
|
33
|
+
*
|
|
34
|
+
* To implement custom component:
|
|
35
|
+
*
|
|
36
|
+
* 1. Define a component class implements {@link IComponent}.
|
|
37
|
+
* 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
|
|
38
|
+
* 3. Define the component logic in the event listeners. For example, listen for the `mousedown`
|
|
39
|
+
* event and select objects when the left mouse button is pressed.
|
|
40
|
+
* 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.
|
|
41
|
+
* 5. Register component provider in the components registry by calling the
|
|
42
|
+
* {@link components.registerComponent}.
|
|
43
|
+
*
|
|
44
|
+
* @example <caption>Implementing a custom component.</caption>
|
|
45
|
+
* import { IComponent, components, Viewer } from "@inweb/viewer-visualize";
|
|
46
|
+
*
|
|
47
|
+
* class MyComponent implements IComponent {
|
|
48
|
+
* protected viewer: Viewer;
|
|
49
|
+
*
|
|
50
|
+
* constructor(viewer: Viewer) {
|
|
51
|
+
* this.viewer = viewer;
|
|
52
|
+
* this.viewer.addEventListener("mousedown", this.onMouseDown);
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* override dispose() {
|
|
56
|
+
* this.viewer.removeEventListener("mousedown", this.onMouseDown);
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* onMouseDown = (event: PointerEvent) => {
|
|
60
|
+
* // place custom logic here
|
|
61
|
+
* };
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* components.registerComponent(
|
|
65
|
+
* "MyComponent",
|
|
66
|
+
* (viewer): IComponent => new MyComponent(viewer)
|
|
67
|
+
* );
|
|
68
|
+
*/
|
|
69
|
+
export const components: IComponentsRegistry = componentsRegistry("visualizejs");
|
|
70
|
+
|
|
71
|
+
// build-in components
|
|
72
|
+
|
|
73
|
+
components.registerComponent("ResizeCanvasComponent", (viewer) => new ResizeCanvasComponent(viewer));
|
|
74
|
+
components.registerComponent("RenderLoopComponent", (viewer) => new RenderLoopComponent(viewer));
|
|
75
|
+
components.registerComponent("ZoomWheelComponent", (viewer) => new ZoomWheelComponent(viewer));
|
|
76
|
+
components.registerComponent("GestureManagerComponent", (viewer) => new GestureManagerComponent(viewer));
|