@inweb/viewer-visualize 26.1.2 → 26.1.4
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 +554 -586
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +77 -78
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Commands/index.d.ts +8 -14
- package/lib/Viewer/Components/index.d.ts +20 -20
- package/lib/Viewer/Draggers/index.d.ts +19 -25
- package/lib/Viewer/Viewer.d.ts +55 -58
- package/package.json +6 -6
- package/src/Viewer/Commands/GetSelected.ts +2 -2
- package/src/Viewer/Commands/index.ts +8 -14
- package/src/Viewer/Components/index.ts +20 -20
- package/src/Viewer/Draggers/index.ts +19 -25
- package/src/Viewer/Viewer.ts +56 -60
|
@@ -7,22 +7,16 @@ import { ICommandsRegistry } from "@inweb/viewer-core";
|
|
|
7
7
|
* 1. Define a command handler with a first `viewer` parameter.
|
|
8
8
|
* 2. Register command handler in the commands registry by calling the {@link commands.registerCommand}.
|
|
9
9
|
*
|
|
10
|
-
* @example Implementing a custom command
|
|
10
|
+
* @example <caption>Implementing a custom command.</caption>
|
|
11
|
+
* import { commands, Viewer } from "@inweb/viewer-visualize";
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* function commandHandler(viewer: Viewer, name = "world"): void {
|
|
14
|
+
* console.log(`Hello ${name}!!!`);
|
|
15
|
+
* }
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
* console.log(`Hello ${name}!!!`);
|
|
17
|
-
* }
|
|
17
|
+
* commands.registerCommand("sayHello", commandHandler);
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @example Calling a custom command.
|
|
23
|
-
*
|
|
24
|
-
* ```javascript
|
|
25
|
-
* viewer.executeCommand("sayHello", "user");
|
|
26
|
-
* ```
|
|
19
|
+
* @example <caption>Calling a custom command.</caption>
|
|
20
|
+
* viewer.executeCommand("sayHello", "user");
|
|
27
21
|
*/
|
|
28
22
|
export declare const commands: ICommandsRegistry;
|
|
@@ -6,35 +6,35 @@ import { IComponentsRegistry } from "@inweb/viewer-core";
|
|
|
6
6
|
*
|
|
7
7
|
* 1. Define a component class implements {@link IComponent}.
|
|
8
8
|
* 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
|
|
9
|
-
* 3. Define the component logic in the event listeners. For example, listen for the `mousedown`
|
|
10
|
-
* select objects when the left mouse button is pressed.
|
|
9
|
+
* 3. Define the component logic in the event listeners. For example, listen for the `mousedown`
|
|
10
|
+
* event and select objects when the left mouse button is pressed.
|
|
11
11
|
* 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.
|
|
12
12
|
* 5. Register component provider in the components registry by calling the
|
|
13
13
|
* {@link components.registerComponent}.
|
|
14
14
|
*
|
|
15
|
-
* @example Implementing a custom component
|
|
15
|
+
* @example <caption>Implementing a custom component.</caption>
|
|
16
|
+
* import { IComponent, components, Viewer } from "@inweb/viewer-visualize";
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* class MyComponent implements IComponent {
|
|
19
|
+
* protected viewer: Viewer;
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* constructor(viewer: Viewer) {
|
|
22
|
+
* this.viewer = viewer;
|
|
23
|
+
* this.viewer.addEventListener("mousedown", this.onMouseDown);
|
|
24
|
+
* }
|
|
22
25
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* }
|
|
26
|
+
* override dispose() {
|
|
27
|
+
* this.viewer.removeEventListener("mousedown", this.onMouseDown);
|
|
28
|
+
* }
|
|
27
29
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
+
* onMouseDown = (event: PointerEvent) => {
|
|
31
|
+
* // place custom logic here
|
|
32
|
+
* };
|
|
30
33
|
* }
|
|
31
34
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* components.registerComponent( "MyComponent", (viewer): IComponent => new MyComponent(viewer));
|
|
38
|
-
* ```
|
|
35
|
+
* components.registerComponent(
|
|
36
|
+
* "MyComponent",
|
|
37
|
+
* (viewer): IComponent => new MyComponent(viewer)
|
|
38
|
+
* );
|
|
39
39
|
*/
|
|
40
40
|
export declare const components: IComponentsRegistry;
|
|
@@ -6,41 +6,35 @@ import { IDraggersRegistry } from "@inweb/viewer-core";
|
|
|
6
6
|
*
|
|
7
7
|
* 1. Define a dragger class implements {@link IDragger}.
|
|
8
8
|
* 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
|
|
9
|
-
* 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`
|
|
10
|
-
* zoom in/out when the left mouse button is pressed.
|
|
9
|
+
* 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`
|
|
10
|
+
* event and zoom in/out when the left mouse button is pressed.
|
|
11
11
|
* 4. Override {@link IDragger.dispose} and remove mouse event listeners from the viewer.
|
|
12
12
|
* 5. Register dragger provider in the draggers registry by calling the {@link draggers.registerDragger}.
|
|
13
13
|
*
|
|
14
|
-
* @example Implementing a custom dragger
|
|
14
|
+
* @example <caption>Implementing a custom dragger.</caption>
|
|
15
|
+
* import { IDragger, draggers, Viewer } from "@inweb/viewer-visualize";
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* class MyDragger implements IDragger {
|
|
18
|
+
* protected viewer: Viewer;
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* constructor(viewer: Viewer) {
|
|
21
|
+
* this.viewer = viewer;
|
|
22
|
+
* this.viewer.addEventListener("pointermove", this.onPointerMove);
|
|
23
|
+
* }
|
|
21
24
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* }
|
|
25
|
+
* override dispose() {
|
|
26
|
+
* this.viewer.removeEventListener("pointermove", this.onPointerMove);
|
|
27
|
+
* }
|
|
26
28
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
+
* onPointerMove = (event: PointerEvent) => {
|
|
30
|
+
* // place custom logic here
|
|
31
|
+
* };
|
|
29
32
|
* }
|
|
30
33
|
*
|
|
31
|
-
*
|
|
32
|
-
* // place custom logic here
|
|
33
|
-
* };
|
|
34
|
-
* }
|
|
35
|
-
*
|
|
36
|
-
* draggers.registerDragger("MyDragger", (viewer): IDragger => new MyDragger(viewer));
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @example Activating a custom dragger.
|
|
34
|
+
* draggers.registerDragger("MyDragger", (viewer): IDragger => new MyDragger(viewer));
|
|
40
35
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* ```
|
|
36
|
+
* @example <caption>Activating a custom dragger.</caption>
|
|
37
|
+
* viewer.setActiveDragger("MyDragger");
|
|
44
38
|
*/
|
|
45
39
|
declare const draggers: IDraggersRegistry;
|
|
46
40
|
export { draggers };
|
package/lib/Viewer/Viewer.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { CanvasEventMap, Dragger, IComponent, IDragger, IOptions, IViewer, IView
|
|
|
4
4
|
import { IMarkup, IWorldTransform } from "@inweb/markup";
|
|
5
5
|
import { MarkupType } from "./Markup/MarkupFactory";
|
|
6
6
|
/**
|
|
7
|
-
* 3D viewer powered by
|
|
8
|
-
* library.
|
|
7
|
+
* 3D viewer powered by
|
|
8
|
+
* {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS} library.
|
|
9
9
|
*/
|
|
10
10
|
export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap> implements IViewer, IWorldTransform {
|
|
11
11
|
private _activeDragger;
|
|
@@ -27,18 +27,18 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
27
27
|
_abortControllerForReferences: AbortController | undefined;
|
|
28
28
|
client: Client | undefined;
|
|
29
29
|
/**
|
|
30
|
-
* @param client - The `Client` instance that is used to load model reference files from the
|
|
31
|
-
* Server. Do not specify `Client` if you need a standalone viewer instance to
|
|
32
|
-
* the web or from local computer.
|
|
30
|
+
* @param client - The `Client` instance that is used to load model reference files from the
|
|
31
|
+
* Open Cloud Server. Do not specify `Client` if you need a standalone viewer instance to
|
|
32
|
+
* view `VSFX` files from the web or from local computer.
|
|
33
33
|
* @param params - An object containing viewer configuration parameters.
|
|
34
|
-
* @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
|
|
35
|
-
* instance, or specify `undefined` or blank to use the default URL defined by
|
|
36
|
-
* library you are using.
|
|
37
|
-
* @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If
|
|
38
|
-
* auto-update is disabled, you need to register an `update` event handler and update
|
|
39
|
-
* `VisualizeJS` viewer and active dragger manually. Default is `true`.
|
|
40
|
-
* @param params.markupType - The type of the markup core: `Visualize` (deprecated) or
|
|
41
|
-
* is `Konva`.
|
|
34
|
+
* @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
|
|
35
|
+
* library instance, or specify `undefined` or blank to use the default URL defined by
|
|
36
|
+
* `Viewer.visualize` library you are using.
|
|
37
|
+
* @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If
|
|
38
|
+
* the auto-update is disabled, you need to register an `update` event handler and update
|
|
39
|
+
* the `VisualizeJS` viewer and active dragger manually. Default is `true`.
|
|
40
|
+
* @param params.markupType - The type of the markup core: `Visualize` (deprecated) or
|
|
41
|
+
* `Konva`. Default is `Konva`.
|
|
42
42
|
*/
|
|
43
43
|
constructor(client?: Client, params?: {
|
|
44
44
|
visualizeJsUrl?: string;
|
|
@@ -65,9 +65,9 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
65
65
|
* Changes the viewer parameters.
|
|
66
66
|
*
|
|
67
67
|
* @param params - An object containing new parameters.
|
|
68
|
-
* @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
|
|
69
|
-
* instance or specify `undefined` or blank to use the default URL defined by
|
|
70
|
-
* library you are using.
|
|
68
|
+
* @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
|
|
69
|
+
* library instance or specify `undefined` or blank to use the default URL defined by
|
|
70
|
+
* `Viewer.visualize` library you are using.
|
|
71
71
|
*/
|
|
72
72
|
configure(params: {
|
|
73
73
|
visualizeJsUrl?: string;
|
|
@@ -82,10 +82,10 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
82
82
|
* - {@link InitializeProgressEvent | initializeprogress}
|
|
83
83
|
*
|
|
84
84
|
* @param canvas -
|
|
85
|
-
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
86
|
-
* `VisualizeJS`.
|
|
87
|
-
* @param onProgress - A callback function that handles events measuring progress of loading
|
|
88
|
-
* `VisualizeJS` library.
|
|
85
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
86
|
+
* for `VisualizeJS`.
|
|
87
|
+
* @param onProgress - A callback function that handles events measuring progress of loading
|
|
88
|
+
* of the `VisualizeJS` library.
|
|
89
89
|
*/
|
|
90
90
|
initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
|
|
91
91
|
dispose(): this;
|
|
@@ -98,24 +98,24 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
98
98
|
/**
|
|
99
99
|
* Updates the viewer.
|
|
100
100
|
*
|
|
101
|
-
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register
|
|
102
|
-
* `update` event handler and update the `Visualize` viewer and active dragger manually.
|
|
101
|
+
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register
|
|
102
|
+
* an `update` event handler and update the `Visualize` viewer and active dragger manually.
|
|
103
103
|
*
|
|
104
104
|
* Fires:
|
|
105
105
|
*
|
|
106
106
|
* - {@link UpdateEvent | update}
|
|
107
107
|
*
|
|
108
|
-
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
109
|
-
* Default is `false`.
|
|
108
|
+
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
109
|
+
* animation frame. Default is `false`.
|
|
110
110
|
*/
|
|
111
111
|
update(force?: boolean): void;
|
|
112
112
|
private scheduleUpdateAsync;
|
|
113
113
|
/**
|
|
114
|
-
* Updates the viewer asynchronously without locking the user interface. Used to update the
|
|
115
|
-
* after changes that require a long rendering time.
|
|
114
|
+
* Updates the viewer asynchronously without locking the user interface. Used to update the
|
|
115
|
+
* viewer after changes that require a long rendering time.
|
|
116
116
|
*
|
|
117
|
-
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register
|
|
118
|
-
* `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
|
|
117
|
+
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register
|
|
118
|
+
* an `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
|
|
119
119
|
*
|
|
120
120
|
* Fires:
|
|
121
121
|
*
|
|
@@ -126,18 +126,18 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
126
126
|
*/
|
|
127
127
|
updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
|
|
128
128
|
/**
|
|
129
|
-
* Returns `VisualizeJS`
|
|
130
|
-
* instance.
|
|
129
|
+
* Returns `VisualizeJS`
|
|
130
|
+
* {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
|
|
131
131
|
*/
|
|
132
132
|
get visualizeJs(): any;
|
|
133
133
|
/**
|
|
134
|
-
* Returns `VisualizeJS`
|
|
135
|
-
* instance.
|
|
134
|
+
* Returns `VisualizeJS`
|
|
135
|
+
* {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
|
|
136
136
|
*/
|
|
137
137
|
visLib(): any;
|
|
138
138
|
/**
|
|
139
|
-
* Returns `VisualizeJS`
|
|
140
|
-
* instance.
|
|
139
|
+
* Returns `VisualizeJS`
|
|
140
|
+
* {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer} instance.
|
|
141
141
|
*/
|
|
142
142
|
visViewer(): any;
|
|
143
143
|
syncOpenCloudVisualStyle(isInitializing: boolean): this;
|
|
@@ -194,15 +194,15 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
194
194
|
*
|
|
195
195
|
* The file geometry data on the server must be converted to `VSFX` format.
|
|
196
196
|
*
|
|
197
|
-
* To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode
|
|
198
|
-
* opening (see example below).
|
|
197
|
+
* To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode
|
|
198
|
+
* before opening (see example below).
|
|
199
199
|
*
|
|
200
|
-
* This method requires a `Client` instance to be specified when creating the viewer to load
|
|
201
|
-
* reference files from the Open Cloud Server. For a standalone viewer instance use
|
|
200
|
+
* This method requires a `Client` instance to be specified when creating the viewer to load
|
|
201
|
+
* model reference files from the Open Cloud Server. For a standalone viewer instance use
|
|
202
202
|
* {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
|
|
203
203
|
*
|
|
204
|
-
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
205
|
-
* file, you must manually activate the required dragger.
|
|
204
|
+
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
205
|
+
* opening the file, you must manually activate the required dragger.
|
|
206
206
|
*
|
|
207
207
|
* Fires:
|
|
208
208
|
*
|
|
@@ -214,17 +214,14 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
214
214
|
* - {@link GeometryEndEvent | geometryend}
|
|
215
215
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
216
216
|
*
|
|
217
|
-
* @example Using partial streaming mode to open a large file from a server
|
|
217
|
+
* @example <caption>Using partial streaming mode to open a large file from a server.</caption>
|
|
218
|
+
* viewer.options.enableStreamingMode = true;
|
|
219
|
+
* viewer.options.enablePartialMode = true;
|
|
220
|
+
* await viewer.open(file);
|
|
218
221
|
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* await viewer.open(file);
|
|
223
|
-
* ```
|
|
224
|
-
*
|
|
225
|
-
* @param file - File, assembly or specific model to load. If a `File` instance with multiple models is
|
|
226
|
-
* specified, the default model will be loaded. If there is no default model, first availiable model
|
|
227
|
-
* will be loaded.
|
|
222
|
+
* @param file - File, assembly or specific model to load. If a `File` instance with multiple
|
|
223
|
+
* models is specified, the default model will be loaded. If there is no default model,
|
|
224
|
+
* first availiable model will be loaded.
|
|
228
225
|
*/
|
|
229
226
|
open(file: File | Assembly | Model): Promise<this>;
|
|
230
227
|
/**
|
|
@@ -233,8 +230,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
233
230
|
* This method does not support {@link IOptions.enableStreamingMode | streaming} or
|
|
234
231
|
* {@link IOptions.enablePartialMode | partial streaming} mode.
|
|
235
232
|
*
|
|
236
|
-
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
237
|
-
* file, you must manually activate the required dragger.
|
|
233
|
+
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
234
|
+
* opening the file, you must manually activate the required dragger.
|
|
238
235
|
*
|
|
239
236
|
* Fires:
|
|
240
237
|
*
|
|
@@ -254,8 +251,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
254
251
|
* This method does not support {@link IOptions.enableStreamingMode | streaming} or
|
|
255
252
|
* {@link IOptions.enablePartialMode | partial streaming} mode.
|
|
256
253
|
*
|
|
257
|
-
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
258
|
-
* file, you must manually activate the required dragger.
|
|
254
|
+
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
255
|
+
* opening the file, you must manually activate the required dragger.
|
|
259
256
|
*
|
|
260
257
|
* Fires:
|
|
261
258
|
*
|
|
@@ -307,8 +304,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
307
304
|
private getSelection;
|
|
308
305
|
private setSelection;
|
|
309
306
|
/**
|
|
310
|
-
* Executes the command denoted by the given command. If the command is not found, tries to
|
|
311
|
-
* dragger with the specified name.
|
|
307
|
+
* Executes the command denoted by the given command. If the command is not found, tries to
|
|
308
|
+
* set active dragger with the specified name.
|
|
312
309
|
*
|
|
313
310
|
* The following commands are available by default:
|
|
314
311
|
*
|
|
@@ -340,8 +337,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
340
337
|
*
|
|
341
338
|
* @param id - Command ID or dragger name.
|
|
342
339
|
* @param args - Parameters passed to the command handler function.
|
|
343
|
-
* @returns Returns the result of the command handler function or new active dragger
|
|
344
|
-
* `undefined` if neither the command nor the dragger exists.
|
|
340
|
+
* @returns Returns the result of the command handler function or new active dragger
|
|
341
|
+
* instance. Returns `undefined` if neither the command nor the dragger exists.
|
|
345
342
|
*/
|
|
346
343
|
executeCommand(id: string, ...args: any[]): any;
|
|
347
344
|
deviceAutoRegeneration(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "26.1.
|
|
3
|
+
"version": "26.1.4",
|
|
4
4
|
"description": "JavaScript library for rendering CAD and BIM files in a browser using VisualizeJS",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"docs": "typedoc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@inweb/client": "~26.1.
|
|
33
|
-
"@inweb/eventemitter2": "~26.1.
|
|
34
|
-
"@inweb/markup": "~26.1.
|
|
35
|
-
"@inweb/viewer-core": "~26.1.
|
|
32
|
+
"@inweb/client": "~26.1.4",
|
|
33
|
+
"@inweb/eventemitter2": "~26.1.4",
|
|
34
|
+
"@inweb/markup": "~26.1.4",
|
|
35
|
+
"@inweb/viewer-core": "~26.1.4"
|
|
36
36
|
},
|
|
37
|
-
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/
|
|
37
|
+
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/26.1/Visualize.js"
|
|
38
38
|
}
|
|
@@ -39,8 +39,8 @@ export function getSelected(viewer: Viewer): string[] {
|
|
|
39
39
|
entityId.getType() === 1
|
|
40
40
|
? entityId.openObject()
|
|
41
41
|
: entityId.getType() === 2
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
? entityId.openObjectAsInsert()
|
|
43
|
+
: null;
|
|
44
44
|
|
|
45
45
|
if (entityPtr) {
|
|
46
46
|
const handle = entityPtr.getNativeDatabaseHandle();
|
|
@@ -55,23 +55,17 @@ import { autoTransformAllModelsToCentralPoint } from "./AutoTransformAllModelsTo
|
|
|
55
55
|
* 1. Define a command handler with a first `viewer` parameter.
|
|
56
56
|
* 2. Register command handler in the commands registry by calling the {@link commands.registerCommand}.
|
|
57
57
|
*
|
|
58
|
-
* @example Implementing a custom command
|
|
58
|
+
* @example <caption>Implementing a custom command.</caption>
|
|
59
|
+
* import { commands, Viewer } from "@inweb/viewer-visualize";
|
|
59
60
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
61
|
+
* function commandHandler(viewer: Viewer, name = "world"): void {
|
|
62
|
+
* console.log(`Hello ${name}!!!`);
|
|
63
|
+
* }
|
|
62
64
|
*
|
|
63
|
-
*
|
|
64
|
-
* console.log(`Hello ${name}!!!`);
|
|
65
|
-
* }
|
|
65
|
+
* commands.registerCommand("sayHello", commandHandler);
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @example Calling a custom command.
|
|
71
|
-
*
|
|
72
|
-
* ```javascript
|
|
73
|
-
* viewer.executeCommand("sayHello", "user");
|
|
74
|
-
* ```
|
|
67
|
+
* @example <caption>Calling a custom command.</caption>
|
|
68
|
+
* viewer.executeCommand("sayHello", "user");
|
|
75
69
|
*/
|
|
76
70
|
export const commands: ICommandsRegistry = commandsRegistry("visualizejs");
|
|
77
71
|
|
|
@@ -35,36 +35,36 @@ import { GestureManagerComponent } from "./GestureManagerComponent";
|
|
|
35
35
|
*
|
|
36
36
|
* 1. Define a component class implements {@link IComponent}.
|
|
37
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
|
-
* select objects when the left mouse button is pressed.
|
|
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
40
|
* 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.
|
|
41
41
|
* 5. Register component provider in the components registry by calling the
|
|
42
42
|
* {@link components.registerComponent}.
|
|
43
43
|
*
|
|
44
|
-
* @example Implementing a custom component
|
|
44
|
+
* @example <caption>Implementing a custom component.</caption>
|
|
45
|
+
* import { IComponent, components, Viewer } from "@inweb/viewer-visualize";
|
|
45
46
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
47
|
+
* class MyComponent implements IComponent {
|
|
48
|
+
* protected viewer: Viewer;
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
50
|
+
* constructor(viewer: Viewer) {
|
|
51
|
+
* this.viewer = viewer;
|
|
52
|
+
* this.viewer.addEventListener("mousedown", this.onMouseDown);
|
|
53
|
+
* }
|
|
51
54
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* }
|
|
55
|
+
* override dispose() {
|
|
56
|
+
* this.viewer.removeEventListener("mousedown", this.onMouseDown);
|
|
57
|
+
* }
|
|
56
58
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
+
* onMouseDown = (event: PointerEvent) => {
|
|
60
|
+
* // place custom logic here
|
|
61
|
+
* };
|
|
59
62
|
* }
|
|
60
63
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* components.registerComponent( "MyComponent", (viewer): IComponent => new MyComponent(viewer));
|
|
67
|
-
* ```
|
|
64
|
+
* components.registerComponent(
|
|
65
|
+
* "MyComponent",
|
|
66
|
+
* (viewer): IComponent => new MyComponent(viewer)
|
|
67
|
+
* );
|
|
68
68
|
*/
|
|
69
69
|
export const components: IComponentsRegistry = componentsRegistry("visualizejs");
|
|
70
70
|
|
|
@@ -42,41 +42,35 @@ import { OrbitAroundBuildingDragger } from "./OrbitAroundBuildingDragger";
|
|
|
42
42
|
*
|
|
43
43
|
* 1. Define a dragger class implements {@link IDragger}.
|
|
44
44
|
* 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
|
|
45
|
-
* 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`
|
|
46
|
-
* zoom in/out when the left mouse button is pressed.
|
|
45
|
+
* 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`
|
|
46
|
+
* event and zoom in/out when the left mouse button is pressed.
|
|
47
47
|
* 4. Override {@link IDragger.dispose} and remove mouse event listeners from the viewer.
|
|
48
48
|
* 5. Register dragger provider in the draggers registry by calling the {@link draggers.registerDragger}.
|
|
49
49
|
*
|
|
50
|
-
* @example Implementing a custom dragger
|
|
50
|
+
* @example <caption>Implementing a custom dragger.</caption>
|
|
51
|
+
* import { IDragger, draggers, Viewer } from "@inweb/viewer-visualize";
|
|
51
52
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
53
|
+
* class MyDragger implements IDragger {
|
|
54
|
+
* protected viewer: Viewer;
|
|
54
55
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
56
|
+
* constructor(viewer: Viewer) {
|
|
57
|
+
* this.viewer = viewer;
|
|
58
|
+
* this.viewer.addEventListener("pointermove", this.onPointerMove);
|
|
59
|
+
* }
|
|
57
60
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* }
|
|
61
|
+
* override dispose() {
|
|
62
|
+
* this.viewer.removeEventListener("pointermove", this.onPointerMove);
|
|
63
|
+
* }
|
|
62
64
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
+
* onPointerMove = (event: PointerEvent) => {
|
|
66
|
+
* // place custom logic here
|
|
67
|
+
* };
|
|
65
68
|
* }
|
|
66
69
|
*
|
|
67
|
-
*
|
|
68
|
-
* // place custom logic here
|
|
69
|
-
* };
|
|
70
|
-
* }
|
|
71
|
-
*
|
|
72
|
-
* draggers.registerDragger("MyDragger", (viewer): IDragger => new MyDragger(viewer));
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @example Activating a custom dragger.
|
|
70
|
+
* draggers.registerDragger("MyDragger", (viewer): IDragger => new MyDragger(viewer));
|
|
76
71
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* ```
|
|
72
|
+
* @example <caption>Activating a custom dragger.</caption>
|
|
73
|
+
* viewer.setActiveDragger("MyDragger");
|
|
80
74
|
*/
|
|
81
75
|
const draggers: IDraggersRegistry = draggersRegistry("visualizejs");
|
|
82
76
|
|