@inweb/viewer-core 25.10.1 → 25.11.1
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-core.js +8 -0
- package/dist/viewer-core.js.map +1 -1
- package/dist/viewer-core.module.js +9 -1
- package/dist/viewer-core.module.js.map +1 -1
- package/lib/options/IOptions.d.ts +15 -6
- package/lib/options/Options.d.ts +2 -0
- package/lib/viewer/IViewer.d.ts +86 -1
- package/lib/viewer/ViewerEvents.d.ts +102 -6
- package/package.json +3 -3
- package/src/options/IOptions.ts +17 -6
- package/src/options/Options.ts +9 -0
- package/src/viewer/IViewer.ts +97 -1
- package/src/viewer/ViewerEvents.ts +117 -6
package/dist/viewer-core.js
CHANGED
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
enableZoomWheel: true,
|
|
132
132
|
enableGestures: true,
|
|
133
133
|
geometryType: "vsfx",
|
|
134
|
+
rulerUnit: "Default",
|
|
134
135
|
};
|
|
135
136
|
}
|
|
136
137
|
|
|
@@ -407,6 +408,13 @@
|
|
|
407
408
|
this._data.geometryType = value;
|
|
408
409
|
this.change();
|
|
409
410
|
}
|
|
411
|
+
get rulerUnit() {
|
|
412
|
+
return this._data.rulerUnit;
|
|
413
|
+
}
|
|
414
|
+
set rulerUnit(value) {
|
|
415
|
+
this._data.rulerUnit = value;
|
|
416
|
+
this.change();
|
|
417
|
+
}
|
|
410
418
|
}
|
|
411
419
|
|
|
412
420
|
///////////////////////////////////////////////////////////////////////////////
|
package/dist/viewer-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer-core.js","sources":["../src/commands/Commands.ts","../src/options/IOptions.ts","../src/options/Options.ts","../src/viewer/CanvasEvents.ts","../src/viewer/IDragger.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IViewer } from \"../viewer/IViewer\";\nimport { ICommand, ICommandHandler, ICommandDescription, ICommandsMap, ICommands } from \"./ICommands\";\n\nclass Commands implements ICommands {\n private readonly _commands = new Map<string, ICommand>();\n\n registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void {\n this._commands.set(id, { id, handler, thisArg, description });\n }\n\n registerCommandAlias(id: string, alias: string): void {\n this.registerCommand(alias, (viewer: IViewer, ...args) => this.executeCommand(id, viewer, ...args));\n }\n\n getCommand(id: string): ICommand | undefined {\n return this._commands.get(id);\n }\n\n getCommands(): ICommandsMap {\n const map = new Map<string, ICommand>();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n\n executeCommand(id: string, viewer: IViewer, ...args: any[]): any {\n const command = this._commands.get(id);\n if (!command) {\n if (viewer) {\n const isDraggerCommand = viewer.draggers.includes(id);\n if (isDraggerCommand) return viewer.setActiveDragger(id);\n }\n\n console.warn(`Command '${id}' not found`);\n return undefined;\n }\n\n const { handler, thisArg } = command;\n const result = handler.apply(thisArg, [viewer, ...args]);\n\n viewer?.emit({ type: \"command\", data: id, args });\n\n return result;\n }\n}\n\nconst _commands = new Map<string, Commands>();\n\n/**\n * Returns the command manager for the specified viewer type.\n *\n * @param viewerType - Viewer type. Predefined viewer types are:\n *\n * - VisualizeJS - The `VisualizeJS` powered viewer.\n * - ThreeJS - The `Three.js` powered viewer.\n */\nfunction commands(viewerType = \"\"): ICommands {\n let result = _commands.get(viewerType);\n if (!result) {\n result = new Commands();\n _commands.set(viewerType, result);\n }\n return result;\n}\n\ncommands(\"\").registerCommand(\"noop\", () => {});\ncommands(\"VisualizeJS\").registerCommand(\"noop\", () => {});\ncommands(\"ThreeJS\").registerCommand(\"noop\", () => {});\n\nexport { commands };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport interface RGB {\n red: number;\n green: number;\n blue: number;\n}\n\n/**\n * Viewer options interface.\n */\nexport interface IOptions {\n /**\n * Show the world coordinate system axes in the bottom-left corner of the viewer.\n *\n * @defaultValue true\n */\n showWCS?: boolean;\n\n /**\n * Enable camera animation.\n *\n * @defaultValue true\n */\n cameraAnimation?: boolean;\n\n /**\n * Enable anti-aliasing using FXAA.\n *\n * @defaultValue true\n */\n antialiasing?: boolean;\n\n /**\n * Show ground shadows below the model.\n *\n * @defaultValue false\n */\n groundShadow?: boolean;\n\n /**\n * Enable ambient shadows.\n *\n * @defaultValue false\n */\n shadows?: boolean;\n\n /**\n * Camera speed on X axis.\n *\n * @defaultValue 4\n */\n cameraAxisXSpeed?: number;\n\n /**\n * Camera speed on Y axis.\n *\n * @defaultValue 1\n */\n cameraAxisYSpeed?: number;\n\n /**\n * Enable ambient occlusion.\n *\n * @defaultValue false\n */\n ambientOcclusion?: boolean;\n\n /**\n * Enable streaming of drawings from the server.\n *\n * If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only\n * update once the loading is complete, which may take a while.\n *\n * If streaming is enabled, {@link enablePartialMode | partial download} mode may be enabled as well.\n *\n * @defaultValue true\n */\n enableStreamingMode?: boolean;\n\n /**\n * Enable partial load mode to be able open large drawing.\n *\n * In partial loading mode, the viewer keeps only visible objects in memory and loads other\n * objects when the zoom or viewpoint changes.\n *\n * Only used if {@link enableStreamingMode | streaming} is enabled. If partial mode is\n * enabled, then {@link sceneGraph | scene graph} will be disabled.\n *\n * @defaultValue false\n */\n enablePartialMode?: boolean;\n\n /**\n * The size of the memory buffer for graphics data, in bytes.\n *\n * @defaultValue 3294967296\n */\n memoryLimit?: number;\n\n /**\n * Cutting planes fill color.\n *\n * @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }\n */\n cuttingPlaneFillColor?: RGB;\n\n /**\n * Edges highlight color.\n */\n edgesColor?: { r: number; g: number; b: number };\n\n /**\n * Faces highlight color.\n */\n facesColor?: { r: number; g: number; b: number };\n\n /**\n * Show highlighted edges.\n */\n edgesVisibility?: boolean;\n\n /**\n * Show highlighted edges over drawing.\n */\n edgesOverlap?: boolean;\n\n /**\n * Show highlighted faces over drawing.\n */\n facesOverlap?: boolean;\n\n /**\n * Highlighted faces transparency value, from 0 to 255.\n */\n facesTransparancy?: number;\n\n /**\n * Enable custom highlight settings.\n */\n enableCustomHighlight?: boolean;\n\n /**\n * Enable scene graph.\n *\n * Scene graph increases perfomance improvement, but consumes memory. Large drawings can take\n * up a lot of memory. If scene graph is enabled, then\n * {@link enablePartialMode | partial load mode} will be disabled.\n */\n sceneGraph: boolean;\n\n /**\n * Show the edges of the model:\n *\n * - `false` - No model edges are displayed. Usefull for less memory consumption.\n * - `true` - Display isolines.\n */\n edgeModel: boolean;\n\n /**\n * Reverse the mouse wheel direction for zooming:\n *\n * - `false` - Moving the wheel up zooms in, moving down zooms out.\n * - `true` - Moving the wheel up zooms out, moving down zooms in.\n */\n reverseZoomWheel: boolean;\n\n /**\n * Enable mouse wheel zooming.\n */\n enableZoomWheel: boolean;\n\n /**\n * Enable touch gestures.\n *\n * This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled,\n * since gestures contains touch zoom.\n */\n enableGestures: boolean;\n\n /**\n * Deprecated since `25.8`.\n */\n geometryType?: string;\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset.\n */\n resetToDefaults?: (fields?: string[]) => void;\n}\n\nexport function defaultOptions(): IOptions {\n return {\n showWCS: true,\n cameraAnimation: true,\n antialiasing: true,\n groundShadow: false,\n shadows: false,\n cameraAxisXSpeed: 4,\n cameraAxisYSpeed: 1,\n ambientOcclusion: false,\n enableStreamingMode: true,\n enablePartialMode: false,\n memoryLimit: 3294967296,\n cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },\n edgesColor: { r: 0xff, g: 0x98, b: 0x00 },\n facesColor: { r: 0xff, g: 0x98, b: 0x00 },\n edgesVisibility: true,\n edgesOverlap: true,\n facesOverlap: false,\n facesTransparancy: 200,\n enableCustomHighlight: true,\n sceneGraph: false,\n edgeModel: true,\n reverseZoomWheel: false,\n enableZoomWheel: true,\n enableGestures: true,\n geometryType: \"vsfx\",\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\nimport { IOptions, RGB, defaultOptions } from \"./IOptions\";\n\nexport class Options implements IOptions {\n protected _emitter?: EventEmitter2;\n protected _data: IOptions;\n\n constructor(emitter?: EventEmitter2) {\n this._emitter = emitter;\n this._data = defaultOptions();\n this.loadFromStorage();\n }\n\n static defaults(): IOptions {\n return defaultOptions();\n }\n\n notifierChangeEvent(): void {\n console.warn(\n \"Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.\"\n );\n this.change();\n }\n\n change(): void {\n if (this._emitter !== undefined) {\n this.saveToStorage();\n this._emitter.emit({ type: \"optionschange\", data: this });\n }\n }\n\n saveToStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n localStorage.setItem(\"od-client-settings\", JSON.stringify(this.data));\n } catch (error) {\n console.error(\"Cannot save client settings.\", error);\n }\n }\n\n loadFromStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n const item = localStorage.getItem(\"od-client-settings\");\n if (item) {\n const data = JSON.parse(item);\n this.data = { ...data };\n }\n } catch (error) {\n console.error(\"Cannot load client settings.\", error);\n }\n }\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset. Specify `undefined` to reset all.\n */\n resetToDefaults(fields?: string[]): void {\n if (fields !== undefined) {\n const defaults = Options.defaults();\n const resetData = fields.reduce((acc, field) => {\n acc[field] = defaults[field];\n return acc;\n }, {});\n this.data = { ...this.data, ...resetData };\n } else {\n this.data = { ...this.data, ...Options.defaults() };\n }\n }\n\n get data(): IOptions {\n return this._data;\n }\n\n set data(value: IOptions) {\n const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;\n const sceneGraph = enablePartialMode ? false : value.sceneGraph;\n this._data = { ...Options.defaults(), ...this._data, ...value, enablePartialMode, sceneGraph };\n this.change();\n }\n\n get showWCS(): boolean {\n return this._data.showWCS;\n }\n\n set showWCS(value: boolean) {\n this._data.showWCS = value;\n this.change();\n }\n\n get cameraAnimation(): boolean {\n return this._data.cameraAnimation;\n }\n\n set cameraAnimation(value: boolean) {\n this._data.cameraAnimation = value;\n this.change();\n }\n\n get antialiasing(): boolean {\n return this._data.antialiasing;\n }\n\n set antialiasing(value: boolean) {\n this._data.antialiasing = value;\n this.change();\n }\n\n get groundShadow(): boolean {\n return this._data.groundShadow;\n }\n\n set groundShadow(value: boolean) {\n this._data.groundShadow = value;\n this.change();\n }\n\n get shadows(): boolean {\n return this._data.shadows;\n }\n\n set shadows(value: boolean) {\n this._data.shadows = value;\n this.change();\n }\n\n get cameraAxisXSpeed(): number {\n return this._data.cameraAxisXSpeed;\n }\n\n set cameraAxisXSpeed(value: number) {\n this._data.cameraAxisXSpeed = value;\n this.change();\n }\n\n get cameraAxisYSpeed(): number {\n return this._data.cameraAxisYSpeed;\n }\n\n set cameraAxisYSpeed(value: number) {\n this.cameraAxisYSpeed = value;\n this.change();\n }\n\n get ambientOcclusion(): boolean {\n return this._data.ambientOcclusion;\n }\n\n set ambientOcclusion(value: boolean) {\n this._data.ambientOcclusion = value;\n this.change();\n }\n\n get enableStreamingMode(): boolean {\n return this._data.enableStreamingMode;\n }\n\n set enableStreamingMode(value: boolean) {\n this._data.enableStreamingMode = value;\n if (!value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get enablePartialMode(): boolean {\n return this._data.enablePartialMode;\n }\n\n set enablePartialMode(value: boolean) {\n this._data.enablePartialMode = value;\n if (value) {\n this._data.enableStreamingMode = true;\n this._data.sceneGraph = false;\n }\n this.change();\n }\n\n get memoryLimit(): number {\n return this._data.memoryLimit;\n }\n\n set memoryLimit(value: number) {\n this._data.memoryLimit = value;\n this.change();\n }\n\n get cuttingPlaneFillColor(): RGB {\n return this._data.cuttingPlaneFillColor;\n }\n\n set cuttingPlaneFillColor(value: RGB) {\n this._data.cuttingPlaneFillColor = value;\n this.change();\n }\n\n get edgesColor() {\n return this._data.edgesColor;\n }\n\n set edgesColor(value) {\n this._data.edgesColor = value;\n this.change();\n }\n\n get facesColor() {\n return this._data.facesColor;\n }\n\n set facesColor(value) {\n this._data.facesColor = value;\n this.change();\n }\n\n get edgesVisibility() {\n return this._data.edgesVisibility;\n }\n\n set edgesVisibility(value) {\n this._data.edgesVisibility = value;\n this.change();\n }\n\n get edgesOverlap() {\n return this._data.edgesOverlap;\n }\n\n set edgesOverlap(value) {\n this._data.edgesOverlap = value;\n this.change();\n }\n\n get facesOverlap() {\n return this._data.facesOverlap;\n }\n\n set facesOverlap(value) {\n this._data.facesOverlap = value;\n this.change();\n }\n\n get facesTransparancy() {\n return this._data.facesTransparancy;\n }\n\n set facesTransparancy(value) {\n this._data.facesTransparancy = value;\n this.change();\n }\n\n get enableCustomHighlight() {\n return this._data.enableCustomHighlight;\n }\n\n set enableCustomHighlight(value) {\n this._data.enableCustomHighlight = value;\n this.change();\n }\n\n get sceneGraph() {\n return this._data.sceneGraph;\n }\n\n set sceneGraph(value) {\n this._data.sceneGraph = value;\n if (value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get edgeModel() {\n return Boolean(this._data.edgeModel);\n }\n\n set edgeModel(value) {\n this._data.edgeModel = Boolean(value);\n this.change();\n }\n\n get reverseZoomWheel() {\n return this._data.reverseZoomWheel;\n }\n\n set reverseZoomWheel(value: boolean) {\n this._data.reverseZoomWheel = !!value;\n this.change();\n }\n\n get enableZoomWheel() {\n return this._data.enableZoomWheel;\n }\n\n set enableZoomWheel(value: boolean) {\n this._data.enableZoomWheel = !!value;\n this.change();\n }\n\n get enableGestures() {\n return this._data.enableGestures;\n }\n\n set enableGestures(value: boolean) {\n this._data.enableGestures = !!value;\n this.change();\n }\n\n get geometryType() {\n return this._data.geometryType;\n }\n\n set geometryType(value: string) {\n this._data.geometryType = value;\n this.change();\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport const CanvasEvents = [\n \"click\",\n \"contextmenu\",\n \"dblclick\",\n \"mousedown\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseup\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerup\",\n \"touchcancel\",\n \"touchend\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n];\n\nexport const CANVAS_EVENTS = CanvasEvents;\n\n/**\n * Canvas Events.\n *\n * @event\n */\nexport interface CanvasEventMap {\n /**\n * Event that fires on mouse click.\n */\n click: MouseEvent;\n\n /**\n * Event that fires when the user attempts to open a context menu.\n */\n contextmenu: PointerEvent;\n\n /**\n * Event that fires on mouse double click.\n */\n dblclick: MouseEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n mousedown: MouseEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n mouseleave: MouseEvent;\n\n /**\n * Event that fires on mouse move.\n */\n mousemove: MouseEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n mouseup: MouseEvent;\n\n /**\n * Event is fired when the browser determines that there are unlikely to be any more pointer events.\n */\n pointercancel: PointerEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n pointerdown: PointerEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n pointerleave: PointerEvent;\n\n /**\n * Event that fires on mouse move.\n */\n pointermove: PointerEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n pointerup: PointerEvent;\n\n /**\n * Event that fires touch is canceled.\n */\n touchcancel: TouchEvent;\n\n /**\n * Event that fires touch is ended.\n */\n touchend: TouchEvent;\n\n /**\n * Event that fires touch is moving.\n */\n touchmove: TouchEvent;\n\n /**\n * Event that fires when touch is started.\n */\n touchstart: TouchEvent;\n\n /**\n * Event that fires when mouse wheel is moving.\n */\n wheel: MouseEvent;\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { IViewer } from \"./IViewer\";\n\n/**\n * Defines the dragger of the viewer.\n */\nexport interface IDragger {\n /**\n * The name of the dragger. Use this name to activate dragger using\n * {@link Viewer.setActiveDragger | Viewer.setActiveDragger()}\n */\n name: string;\n\n /**\n * Initializes the dragger instance. Call {@link dispose | dispose()} to release allocated resources.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is activated. Do not\n * call this directly.\n */\n initialize(): void;\n\n /**\n * Releases resources allocated in the {@link initialize | initialize()}.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is deactivated. Do\n * not call this directly.\n */\n dispose(): void;\n\n /**\n * Updates the dragger preview if exists.\n *\n * This is internal method, called by the {@link Viewer} when it updates. Do not call this\n * method directly unless you are manually updating the viewer.\n */\n updatePreview(): void;\n}\n\n/**\n * Base class for the viewer draggers.\n *\n * To create your own dragger:\n *\n * 1. Define a dragger class inherited from Dragger.\n * 2. Override {@link initialize | initialize()} method to add mouse event listeners using\n * {@link Viewer.addEventListener | Viewer.addEventListener()}.\n * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`\n * event and zoom in/out when the left mouse button is pressed.\n * 4. Override {@link dispose | dispose()} method to remove mouse event listeners\n * {@link Viewer.removeEventListener | Viewer.removeEventListener()}.\n * 5. Register dragger class for the viewer instance.\n */\nexport class Dragger implements IDragger {\n name = \"\";\n\n constructor(viewer: IViewer) {}\n\n initialize(): void {}\n\n dispose(): void {}\n\n updatePreview(): void {}\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAKA,MAAM,QAAQ,CAAA;IAAd,IAAA,WAAA,GAAA;IACmB,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;SAuC1D;IArCC,IAAA,eAAe,CAAC,EAAU,EAAE,OAAwB,EAAE,WAAiC,EAAE,OAAa,EAAA;IACpG,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;SAC/D;QAED,oBAAoB,CAAC,EAAU,EAAE,KAAa,EAAA;YAC5C,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,MAAe,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;SACrG;IAED,IAAA,UAAU,CAAC,EAAU,EAAA;YACnB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAA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|
|
1
|
+
{"version":3,"file":"viewer-core.js","sources":["../src/commands/Commands.ts","../src/options/IOptions.ts","../src/options/Options.ts","../src/viewer/CanvasEvents.ts","../src/viewer/IDragger.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IViewer } from \"../viewer/IViewer\";\nimport { ICommand, ICommandHandler, ICommandDescription, ICommandsMap, ICommands } from \"./ICommands\";\n\nclass Commands implements ICommands {\n private readonly _commands = new Map<string, ICommand>();\n\n registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void {\n this._commands.set(id, { id, handler, thisArg, description });\n }\n\n registerCommandAlias(id: string, alias: string): void {\n this.registerCommand(alias, (viewer: IViewer, ...args) => this.executeCommand(id, viewer, ...args));\n }\n\n getCommand(id: string): ICommand | undefined {\n return this._commands.get(id);\n }\n\n getCommands(): ICommandsMap {\n const map = new Map<string, ICommand>();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n\n executeCommand(id: string, viewer: IViewer, ...args: any[]): any {\n const command = this._commands.get(id);\n if (!command) {\n if (viewer) {\n const isDraggerCommand = viewer.draggers.includes(id);\n if (isDraggerCommand) return viewer.setActiveDragger(id);\n }\n\n console.warn(`Command '${id}' not found`);\n return undefined;\n }\n\n const { handler, thisArg } = command;\n const result = handler.apply(thisArg, [viewer, ...args]);\n\n viewer?.emit({ type: \"command\", data: id, args });\n\n return result;\n }\n}\n\nconst _commands = new Map<string, Commands>();\n\n/**\n * Returns the command manager for the specified viewer type.\n *\n * @param viewerType - Viewer type. Predefined viewer types are:\n *\n * - VisualizeJS - The `VisualizeJS` powered viewer.\n * - ThreeJS - The `Three.js` powered viewer.\n */\nfunction commands(viewerType = \"\"): ICommands {\n let result = _commands.get(viewerType);\n if (!result) {\n result = new Commands();\n _commands.set(viewerType, result);\n }\n return result;\n}\n\ncommands(\"\").registerCommand(\"noop\", () => {});\ncommands(\"VisualizeJS\").registerCommand(\"noop\", () => {});\ncommands(\"ThreeJS\").registerCommand(\"noop\", () => {});\n\nexport { commands };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport interface RGB {\n red: number;\n green: number;\n blue: number;\n}\n\n/**\n * Viewer options interface.\n */\nexport interface IOptions {\n /**\n * Show the world coordinate system axes in the bottom-left corner of the viewer.\n *\n * @defaultValue true\n */\n showWCS?: boolean;\n\n /**\n * Enable camera animation.\n *\n * @defaultValue true\n */\n cameraAnimation?: boolean;\n\n /**\n * Enable anti-aliasing using FXAA.\n *\n * @defaultValue true\n */\n antialiasing?: boolean;\n\n /**\n * Show ground shadows below the model.\n *\n * @defaultValue false\n */\n groundShadow?: boolean;\n\n /**\n * Enable ambient shadows.\n *\n * @defaultValue false\n */\n shadows?: boolean;\n\n /**\n * Camera speed on X axis.\n *\n * @defaultValue 4\n */\n cameraAxisXSpeed?: number;\n\n /**\n * Camera speed on Y axis.\n *\n * @defaultValue 1\n */\n cameraAxisYSpeed?: number;\n\n /**\n * Enable ambient occlusion.\n *\n * @defaultValue false\n */\n ambientOcclusion?: boolean;\n\n /**\n * Enable streaming of drawings from the server.\n *\n * If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only\n * update once the loading is complete, which may take a while.\n *\n * If streaming is enabled, {@link enablePartialMode | partial streaming} mode may be enabled as well.\n *\n * @defaultValue true\n */\n enableStreamingMode?: boolean;\n\n /**\n * Enable partial streaming mode to be able open large drawing.\n *\n * In partial streaming mode, the viewer keeps only visible objects in memory and loads other\n * objects when the camera changes.\n *\n * Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is\n * enabled, then {@link sceneGraph | scene graph} will be disabled.\n *\n * @defaultValue false\n */\n enablePartialMode?: boolean;\n\n /**\n * The size of the memory buffer for graphics data, in bytes.\n *\n * @defaultValue 3294967296\n */\n memoryLimit?: number;\n\n /**\n * Cutting planes fill color.\n *\n * @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }\n */\n cuttingPlaneFillColor?: RGB;\n\n /**\n * Edges highlight color.\n */\n edgesColor?: { r: number; g: number; b: number };\n\n /**\n * Faces highlight color.\n */\n facesColor?: { r: number; g: number; b: number };\n\n /**\n * Show highlighted edges.\n */\n edgesVisibility?: boolean;\n\n /**\n * Show highlighted edges over drawing.\n */\n edgesOverlap?: boolean;\n\n /**\n * Show highlighted faces over drawing.\n */\n facesOverlap?: boolean;\n\n /**\n * Highlighted faces transparency value, from 0 to 255.\n */\n facesTransparancy?: number;\n\n /**\n * Enable custom highlight settings.\n */\n enableCustomHighlight?: boolean;\n\n /**\n * Enable scene graph.\n *\n * Scene graph increases perfomance improvement, but consumes memory. Large drawings can take\n * up a lot of memory. If scene graph is enabled, then\n * {@link enablePartialMode | partial streaming} mode will be disabled.\n */\n sceneGraph: boolean;\n\n /**\n * Show the edges of the model:\n *\n * - `false` - No model edges are displayed. Usefull for less memory consumption.\n * - `true` - Display isolines.\n */\n edgeModel: boolean;\n\n /**\n * Reverse the mouse wheel direction for zooming:\n *\n * - `false` - Moving the wheel up zooms in, moving down zooms out.\n * - `true` - Moving the wheel up zooms out, moving down zooms in.\n */\n reverseZoomWheel: boolean;\n\n /**\n * Enable mouse wheel zooming.\n */\n enableZoomWheel: boolean;\n\n /**\n * Enable touch gestures.\n *\n * This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled,\n * since gestures contains touch zoom.\n */\n enableGestures: boolean;\n\n /**\n * Deprecated since `25.8`.\n */\n geometryType?: string;\n\n /**\n * Ruler unit.\n *\n * Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards,\n * Kilometers, Miles, Micrometers, MicroInches\n *\n * @defaultValue Default\n */\n rulerUnit: string;\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset.\n */\n resetToDefaults?: (fields?: string[]) => void;\n}\n\nexport function defaultOptions(): IOptions {\n return {\n showWCS: true,\n cameraAnimation: true,\n antialiasing: true,\n groundShadow: false,\n shadows: false,\n cameraAxisXSpeed: 4,\n cameraAxisYSpeed: 1,\n ambientOcclusion: false,\n enableStreamingMode: true,\n enablePartialMode: false,\n memoryLimit: 3294967296,\n cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },\n edgesColor: { r: 0xff, g: 0x98, b: 0x00 },\n facesColor: { r: 0xff, g: 0x98, b: 0x00 },\n edgesVisibility: true,\n edgesOverlap: true,\n facesOverlap: false,\n facesTransparancy: 200,\n enableCustomHighlight: true,\n sceneGraph: false,\n edgeModel: true,\n reverseZoomWheel: false,\n enableZoomWheel: true,\n enableGestures: true,\n geometryType: \"vsfx\",\n rulerUnit: \"Default\",\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\nimport { IOptions, RGB, defaultOptions } from \"./IOptions\";\n\nexport class Options implements IOptions {\n protected _emitter?: EventEmitter2;\n protected _data: IOptions;\n\n constructor(emitter?: EventEmitter2) {\n this._emitter = emitter;\n this._data = defaultOptions();\n this.loadFromStorage();\n }\n\n static defaults(): IOptions {\n return defaultOptions();\n }\n\n notifierChangeEvent(): void {\n console.warn(\n \"Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.\"\n );\n this.change();\n }\n\n change(): void {\n if (this._emitter !== undefined) {\n this.saveToStorage();\n this._emitter.emit({ type: \"optionschange\", data: this });\n }\n }\n\n saveToStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n localStorage.setItem(\"od-client-settings\", JSON.stringify(this.data));\n } catch (error) {\n console.error(\"Cannot save client settings.\", error);\n }\n }\n\n loadFromStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n const item = localStorage.getItem(\"od-client-settings\");\n if (item) {\n const data = JSON.parse(item);\n this.data = { ...data };\n }\n } catch (error) {\n console.error(\"Cannot load client settings.\", error);\n }\n }\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset. Specify `undefined` to reset all.\n */\n resetToDefaults(fields?: string[]): void {\n if (fields !== undefined) {\n const defaults = Options.defaults();\n const resetData = fields.reduce((acc, field) => {\n acc[field] = defaults[field];\n return acc;\n }, {});\n this.data = { ...this.data, ...resetData };\n } else {\n this.data = { ...this.data, ...Options.defaults() };\n }\n }\n\n get data(): IOptions {\n return this._data;\n }\n\n set data(value: IOptions) {\n const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;\n const sceneGraph = enablePartialMode ? false : value.sceneGraph;\n this._data = { ...Options.defaults(), ...this._data, ...value, enablePartialMode, sceneGraph };\n this.change();\n }\n\n get showWCS(): boolean {\n return this._data.showWCS;\n }\n\n set showWCS(value: boolean) {\n this._data.showWCS = value;\n this.change();\n }\n\n get cameraAnimation(): boolean {\n return this._data.cameraAnimation;\n }\n\n set cameraAnimation(value: boolean) {\n this._data.cameraAnimation = value;\n this.change();\n }\n\n get antialiasing(): boolean {\n return this._data.antialiasing;\n }\n\n set antialiasing(value: boolean) {\n this._data.antialiasing = value;\n this.change();\n }\n\n get groundShadow(): boolean {\n return this._data.groundShadow;\n }\n\n set groundShadow(value: boolean) {\n this._data.groundShadow = value;\n this.change();\n }\n\n get shadows(): boolean {\n return this._data.shadows;\n }\n\n set shadows(value: boolean) {\n this._data.shadows = value;\n this.change();\n }\n\n get cameraAxisXSpeed(): number {\n return this._data.cameraAxisXSpeed;\n }\n\n set cameraAxisXSpeed(value: number) {\n this._data.cameraAxisXSpeed = value;\n this.change();\n }\n\n get cameraAxisYSpeed(): number {\n return this._data.cameraAxisYSpeed;\n }\n\n set cameraAxisYSpeed(value: number) {\n this.cameraAxisYSpeed = value;\n this.change();\n }\n\n get ambientOcclusion(): boolean {\n return this._data.ambientOcclusion;\n }\n\n set ambientOcclusion(value: boolean) {\n this._data.ambientOcclusion = value;\n this.change();\n }\n\n get enableStreamingMode(): boolean {\n return this._data.enableStreamingMode;\n }\n\n set enableStreamingMode(value: boolean) {\n this._data.enableStreamingMode = value;\n if (!value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get enablePartialMode(): boolean {\n return this._data.enablePartialMode;\n }\n\n set enablePartialMode(value: boolean) {\n this._data.enablePartialMode = value;\n if (value) {\n this._data.enableStreamingMode = true;\n this._data.sceneGraph = false;\n }\n this.change();\n }\n\n get memoryLimit(): number {\n return this._data.memoryLimit;\n }\n\n set memoryLimit(value: number) {\n this._data.memoryLimit = value;\n this.change();\n }\n\n get cuttingPlaneFillColor(): RGB {\n return this._data.cuttingPlaneFillColor;\n }\n\n set cuttingPlaneFillColor(value: RGB) {\n this._data.cuttingPlaneFillColor = value;\n this.change();\n }\n\n get edgesColor() {\n return this._data.edgesColor;\n }\n\n set edgesColor(value) {\n this._data.edgesColor = value;\n this.change();\n }\n\n get facesColor() {\n return this._data.facesColor;\n }\n\n set facesColor(value) {\n this._data.facesColor = value;\n this.change();\n }\n\n get edgesVisibility() {\n return this._data.edgesVisibility;\n }\n\n set edgesVisibility(value) {\n this._data.edgesVisibility = value;\n this.change();\n }\n\n get edgesOverlap() {\n return this._data.edgesOverlap;\n }\n\n set edgesOverlap(value) {\n this._data.edgesOverlap = value;\n this.change();\n }\n\n get facesOverlap() {\n return this._data.facesOverlap;\n }\n\n set facesOverlap(value) {\n this._data.facesOverlap = value;\n this.change();\n }\n\n get facesTransparancy() {\n return this._data.facesTransparancy;\n }\n\n set facesTransparancy(value) {\n this._data.facesTransparancy = value;\n this.change();\n }\n\n get enableCustomHighlight() {\n return this._data.enableCustomHighlight;\n }\n\n set enableCustomHighlight(value) {\n this._data.enableCustomHighlight = value;\n this.change();\n }\n\n get sceneGraph() {\n return this._data.sceneGraph;\n }\n\n set sceneGraph(value) {\n this._data.sceneGraph = value;\n if (value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get edgeModel() {\n return Boolean(this._data.edgeModel);\n }\n\n set edgeModel(value) {\n this._data.edgeModel = Boolean(value);\n this.change();\n }\n\n get reverseZoomWheel() {\n return this._data.reverseZoomWheel;\n }\n\n set reverseZoomWheel(value: boolean) {\n this._data.reverseZoomWheel = !!value;\n this.change();\n }\n\n get enableZoomWheel() {\n return this._data.enableZoomWheel;\n }\n\n set enableZoomWheel(value: boolean) {\n this._data.enableZoomWheel = !!value;\n this.change();\n }\n\n get enableGestures() {\n return this._data.enableGestures;\n }\n\n set enableGestures(value: boolean) {\n this._data.enableGestures = !!value;\n this.change();\n }\n\n get geometryType() {\n return this._data.geometryType;\n }\n\n set geometryType(value: string) {\n this._data.geometryType = value;\n this.change();\n }\n\n get rulerUnit(): string {\n return this._data.rulerUnit;\n }\n\n set rulerUnit(value: string) {\n this._data.rulerUnit = value;\n this.change();\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport const CanvasEvents = [\n \"click\",\n \"contextmenu\",\n \"dblclick\",\n \"mousedown\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseup\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerup\",\n \"touchcancel\",\n \"touchend\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n];\n\nexport const CANVAS_EVENTS = CanvasEvents;\n\n/**\n * Canvas Events.\n *\n * @event\n */\nexport interface CanvasEventMap {\n /**\n * Event that fires on mouse click.\n */\n click: MouseEvent;\n\n /**\n * Event that fires when the user attempts to open a context menu.\n */\n contextmenu: PointerEvent;\n\n /**\n * Event that fires on mouse double click.\n */\n dblclick: MouseEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n mousedown: MouseEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n mouseleave: MouseEvent;\n\n /**\n * Event that fires on mouse move.\n */\n mousemove: MouseEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n mouseup: MouseEvent;\n\n /**\n * Event is fired when the browser determines that there are unlikely to be any more pointer events.\n */\n pointercancel: PointerEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n pointerdown: PointerEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n pointerleave: PointerEvent;\n\n /**\n * Event that fires on mouse move.\n */\n pointermove: PointerEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n pointerup: PointerEvent;\n\n /**\n * Event that fires touch is canceled.\n */\n touchcancel: TouchEvent;\n\n /**\n * Event that fires touch is ended.\n */\n touchend: TouchEvent;\n\n /**\n * Event that fires touch is moving.\n */\n touchmove: TouchEvent;\n\n /**\n * Event that fires when touch is started.\n */\n touchstart: TouchEvent;\n\n /**\n * Event that fires when mouse wheel is moving.\n */\n wheel: MouseEvent;\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { IViewer } from \"./IViewer\";\n\n/**\n * Defines the dragger of the viewer.\n */\nexport interface IDragger {\n /**\n * The name of the dragger. Use this name to activate dragger using\n * {@link Viewer.setActiveDragger | Viewer.setActiveDragger()}\n */\n name: string;\n\n /**\n * Initializes the dragger instance. Call {@link dispose | dispose()} to release allocated resources.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is activated. Do not\n * call this directly.\n */\n initialize(): void;\n\n /**\n * Releases resources allocated in the {@link initialize | initialize()}.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is deactivated. Do\n * not call this directly.\n */\n dispose(): void;\n\n /**\n * Updates the dragger preview if exists.\n *\n * This is internal method, called by the {@link Viewer} when it updates. Do not call this\n * method directly unless you are manually updating the viewer.\n */\n updatePreview(): void;\n}\n\n/**\n * Base class for the viewer draggers.\n *\n * To create your own dragger:\n *\n * 1. Define a dragger class inherited from Dragger.\n * 2. Override {@link initialize | initialize()} method to add mouse event listeners using\n * {@link Viewer.addEventListener | Viewer.addEventListener()}.\n * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`\n * event and zoom in/out when the left mouse button is pressed.\n * 4. Override {@link dispose | dispose()} method to remove mouse event listeners\n * {@link Viewer.removeEventListener | Viewer.removeEventListener()}.\n * 5. Register dragger class for the viewer instance.\n */\nexport class Dragger implements IDragger {\n name = \"\";\n\n constructor(viewer: IViewer) {}\n\n initialize(): void {}\n\n dispose(): void {}\n\n updatePreview(): void {}\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAKA,MAAM,QAAQ,CAAA;IAAd,IAAA,WAAA,GAAA;IACmB,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;SAuC1D;IArCC,IAAA,eAAe,CAAC,E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;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;IACF;;ICxVD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AAEa,UAAA,YAAY,GAAG;QAC1B,OAAO;QACP,aAAa;QACb,UAAU;QACV,WAAW;QACX,YAAY;QACZ,WAAW;QACX,SAAS;QACT,eAAe;QACf,aAAa;QACb,cAAc;QACd,aAAa;QACb,WAAW;QACX,aAAa;QACb,UAAU;QACV,WAAW;QACX,YAAY;QACZ,OAAO;MACP;AAEK,UAAM,aAAa,GAAG;;IC3C7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAuCA;;;;;;;;;;;;;IAaG;UACU,OAAO,CAAA;IAGlB,IAAA,WAAA,CAAY,MAAe,EAAA;YAF3B,IAAI,CAAA,IAAA,GAAG,EAAE,CAAC;SAEqB;IAE/B,IAAA,UAAU,MAAW;IAErB,IAAA,OAAO,MAAW;IAElB,IAAA,aAAa,MAAW;IACzB;;;;;;;;;;;;;"}
|
|
@@ -97,7 +97,8 @@ function defaultOptions() {
|
|
|
97
97
|
reverseZoomWheel: false,
|
|
98
98
|
enableZoomWheel: true,
|
|
99
99
|
enableGestures: true,
|
|
100
|
-
geometryType: "vsfx"
|
|
100
|
+
geometryType: "vsfx",
|
|
101
|
+
rulerUnit: "Default"
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -357,6 +358,13 @@ class Options {
|
|
|
357
358
|
this._data.geometryType = value;
|
|
358
359
|
this.change();
|
|
359
360
|
}
|
|
361
|
+
get rulerUnit() {
|
|
362
|
+
return this._data.rulerUnit;
|
|
363
|
+
}
|
|
364
|
+
set rulerUnit(value) {
|
|
365
|
+
this._data.rulerUnit = value;
|
|
366
|
+
this.change();
|
|
367
|
+
}
|
|
360
368
|
}
|
|
361
369
|
|
|
362
370
|
const CanvasEvents = [ "click", "contextmenu", "dblclick", "mousedown", "mouseleave", "mousemove", "mouseup", "pointercancel", "pointerdown", "pointerleave", "pointermove", "pointerup", "touchcancel", "touchend", "touchmove", "touchstart", "wheel" ];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer-core.module.js","sources":["../src/commands/Commands.ts","../src/options/IOptions.ts","../src/options/Options.ts","../src/viewer/CanvasEvents.ts","../src/viewer/IDragger.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IViewer } from \"../viewer/IViewer\";\nimport { ICommand, ICommandHandler, ICommandDescription, ICommandsMap, ICommands } from \"./ICommands\";\n\nclass Commands implements ICommands {\n private readonly _commands = new Map<string, ICommand>();\n\n registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void {\n this._commands.set(id, { id, handler, thisArg, description });\n }\n\n registerCommandAlias(id: string, alias: string): void {\n this.registerCommand(alias, (viewer: IViewer, ...args) => this.executeCommand(id, viewer, ...args));\n }\n\n getCommand(id: string): ICommand | undefined {\n return this._commands.get(id);\n }\n\n getCommands(): ICommandsMap {\n const map = new Map<string, ICommand>();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n\n executeCommand(id: string, viewer: IViewer, ...args: any[]): any {\n const command = this._commands.get(id);\n if (!command) {\n if (viewer) {\n const isDraggerCommand = viewer.draggers.includes(id);\n if (isDraggerCommand) return viewer.setActiveDragger(id);\n }\n\n console.warn(`Command '${id}' not found`);\n return undefined;\n }\n\n const { handler, thisArg } = command;\n const result = handler.apply(thisArg, [viewer, ...args]);\n\n viewer?.emit({ type: \"command\", data: id, args });\n\n return result;\n }\n}\n\nconst _commands = new Map<string, Commands>();\n\n/**\n * Returns the command manager for the specified viewer type.\n *\n * @param viewerType - Viewer type. Predefined viewer types are:\n *\n * - VisualizeJS - The `VisualizeJS` powered viewer.\n * - ThreeJS - The `Three.js` powered viewer.\n */\nfunction commands(viewerType = \"\"): ICommands {\n let result = _commands.get(viewerType);\n if (!result) {\n result = new Commands();\n _commands.set(viewerType, result);\n }\n return result;\n}\n\ncommands(\"\").registerCommand(\"noop\", () => {});\ncommands(\"VisualizeJS\").registerCommand(\"noop\", () => {});\ncommands(\"ThreeJS\").registerCommand(\"noop\", () => {});\n\nexport { commands };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport interface RGB {\n red: number;\n green: number;\n blue: number;\n}\n\n/**\n * Viewer options interface.\n */\nexport interface IOptions {\n /**\n * Show the world coordinate system axes in the bottom-left corner of the viewer.\n *\n * @defaultValue true\n */\n showWCS?: boolean;\n\n /**\n * Enable camera animation.\n *\n * @defaultValue true\n */\n cameraAnimation?: boolean;\n\n /**\n * Enable anti-aliasing using FXAA.\n *\n * @defaultValue true\n */\n antialiasing?: boolean;\n\n /**\n * Show ground shadows below the model.\n *\n * @defaultValue false\n */\n groundShadow?: boolean;\n\n /**\n * Enable ambient shadows.\n *\n * @defaultValue false\n */\n shadows?: boolean;\n\n /**\n * Camera speed on X axis.\n *\n * @defaultValue 4\n */\n cameraAxisXSpeed?: number;\n\n /**\n * Camera speed on Y axis.\n *\n * @defaultValue 1\n */\n cameraAxisYSpeed?: number;\n\n /**\n * Enable ambient occlusion.\n *\n * @defaultValue false\n */\n ambientOcclusion?: boolean;\n\n /**\n * Enable streaming of drawings from the server.\n *\n * If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only\n * update once the loading is complete, which may take a while.\n *\n * If streaming is enabled, {@link enablePartialMode | partial download} mode may be enabled as well.\n *\n * @defaultValue true\n */\n enableStreamingMode?: boolean;\n\n /**\n * Enable partial load mode to be able open large drawing.\n *\n * In partial loading mode, the viewer keeps only visible objects in memory and loads other\n * objects when the zoom or viewpoint changes.\n *\n * Only used if {@link enableStreamingMode | streaming} is enabled. If partial mode is\n * enabled, then {@link sceneGraph | scene graph} will be disabled.\n *\n * @defaultValue false\n */\n enablePartialMode?: boolean;\n\n /**\n * The size of the memory buffer for graphics data, in bytes.\n *\n * @defaultValue 3294967296\n */\n memoryLimit?: number;\n\n /**\n * Cutting planes fill color.\n *\n * @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }\n */\n cuttingPlaneFillColor?: RGB;\n\n /**\n * Edges highlight color.\n */\n edgesColor?: { r: number; g: number; b: number };\n\n /**\n * Faces highlight color.\n */\n facesColor?: { r: number; g: number; b: number };\n\n /**\n * Show highlighted edges.\n */\n edgesVisibility?: boolean;\n\n /**\n * Show highlighted edges over drawing.\n */\n edgesOverlap?: boolean;\n\n /**\n * Show highlighted faces over drawing.\n */\n facesOverlap?: boolean;\n\n /**\n * Highlighted faces transparency value, from 0 to 255.\n */\n facesTransparancy?: number;\n\n /**\n * Enable custom highlight settings.\n */\n enableCustomHighlight?: boolean;\n\n /**\n * Enable scene graph.\n *\n * Scene graph increases perfomance improvement, but consumes memory. Large drawings can take\n * up a lot of memory. If scene graph is enabled, then\n * {@link enablePartialMode | partial load mode} will be disabled.\n */\n sceneGraph: boolean;\n\n /**\n * Show the edges of the model:\n *\n * - `false` - No model edges are displayed. Usefull for less memory consumption.\n * - `true` - Display isolines.\n */\n edgeModel: boolean;\n\n /**\n * Reverse the mouse wheel direction for zooming:\n *\n * - `false` - Moving the wheel up zooms in, moving down zooms out.\n * - `true` - Moving the wheel up zooms out, moving down zooms in.\n */\n reverseZoomWheel: boolean;\n\n /**\n * Enable mouse wheel zooming.\n */\n enableZoomWheel: boolean;\n\n /**\n * Enable touch gestures.\n *\n * This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled,\n * since gestures contains touch zoom.\n */\n enableGestures: boolean;\n\n /**\n * Deprecated since `25.8`.\n */\n geometryType?: string;\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset.\n */\n resetToDefaults?: (fields?: string[]) => void;\n}\n\nexport function defaultOptions(): IOptions {\n return {\n showWCS: true,\n cameraAnimation: true,\n antialiasing: true,\n groundShadow: false,\n shadows: false,\n cameraAxisXSpeed: 4,\n cameraAxisYSpeed: 1,\n ambientOcclusion: false,\n enableStreamingMode: true,\n enablePartialMode: false,\n memoryLimit: 3294967296,\n cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },\n edgesColor: { r: 0xff, g: 0x98, b: 0x00 },\n facesColor: { r: 0xff, g: 0x98, b: 0x00 },\n edgesVisibility: true,\n edgesOverlap: true,\n facesOverlap: false,\n facesTransparancy: 200,\n enableCustomHighlight: true,\n sceneGraph: false,\n edgeModel: true,\n reverseZoomWheel: false,\n enableZoomWheel: true,\n enableGestures: true,\n geometryType: \"vsfx\",\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\nimport { IOptions, RGB, defaultOptions } from \"./IOptions\";\n\nexport class Options implements IOptions {\n protected _emitter?: EventEmitter2;\n protected _data: IOptions;\n\n constructor(emitter?: EventEmitter2) {\n this._emitter = emitter;\n this._data = defaultOptions();\n this.loadFromStorage();\n }\n\n static defaults(): IOptions {\n return defaultOptions();\n }\n\n notifierChangeEvent(): void {\n console.warn(\n \"Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.\"\n );\n this.change();\n }\n\n change(): void {\n if (this._emitter !== undefined) {\n this.saveToStorage();\n this._emitter.emit({ type: \"optionschange\", data: this });\n }\n }\n\n saveToStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n localStorage.setItem(\"od-client-settings\", JSON.stringify(this.data));\n } catch (error) {\n console.error(\"Cannot save client settings.\", error);\n }\n }\n\n loadFromStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n const item = localStorage.getItem(\"od-client-settings\");\n if (item) {\n const data = JSON.parse(item);\n this.data = { ...data };\n }\n } catch (error) {\n console.error(\"Cannot load client settings.\", error);\n }\n }\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset. Specify `undefined` to reset all.\n */\n resetToDefaults(fields?: string[]): void {\n if (fields !== undefined) {\n const defaults = Options.defaults();\n const resetData = fields.reduce((acc, field) => {\n acc[field] = defaults[field];\n return acc;\n }, {});\n this.data = { ...this.data, ...resetData };\n } else {\n this.data = { ...this.data, ...Options.defaults() };\n }\n }\n\n get data(): IOptions {\n return this._data;\n }\n\n set data(value: IOptions) {\n const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;\n const sceneGraph = enablePartialMode ? false : value.sceneGraph;\n this._data = { ...Options.defaults(), ...this._data, ...value, enablePartialMode, sceneGraph };\n this.change();\n }\n\n get showWCS(): boolean {\n return this._data.showWCS;\n }\n\n set showWCS(value: boolean) {\n this._data.showWCS = value;\n this.change();\n }\n\n get cameraAnimation(): boolean {\n return this._data.cameraAnimation;\n }\n\n set cameraAnimation(value: boolean) {\n this._data.cameraAnimation = value;\n this.change();\n }\n\n get antialiasing(): boolean {\n return this._data.antialiasing;\n }\n\n set antialiasing(value: boolean) {\n this._data.antialiasing = value;\n this.change();\n }\n\n get groundShadow(): boolean {\n return this._data.groundShadow;\n }\n\n set groundShadow(value: boolean) {\n this._data.groundShadow = value;\n this.change();\n }\n\n get shadows(): boolean {\n return this._data.shadows;\n }\n\n set shadows(value: boolean) {\n this._data.shadows = value;\n this.change();\n }\n\n get cameraAxisXSpeed(): number {\n return this._data.cameraAxisXSpeed;\n }\n\n set cameraAxisXSpeed(value: number) {\n this._data.cameraAxisXSpeed = value;\n this.change();\n }\n\n get cameraAxisYSpeed(): number {\n return this._data.cameraAxisYSpeed;\n }\n\n set cameraAxisYSpeed(value: number) {\n this.cameraAxisYSpeed = value;\n this.change();\n }\n\n get ambientOcclusion(): boolean {\n return this._data.ambientOcclusion;\n }\n\n set ambientOcclusion(value: boolean) {\n this._data.ambientOcclusion = value;\n this.change();\n }\n\n get enableStreamingMode(): boolean {\n return this._data.enableStreamingMode;\n }\n\n set enableStreamingMode(value: boolean) {\n this._data.enableStreamingMode = value;\n if (!value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get enablePartialMode(): boolean {\n return this._data.enablePartialMode;\n }\n\n set enablePartialMode(value: boolean) {\n this._data.enablePartialMode = value;\n if (value) {\n this._data.enableStreamingMode = true;\n this._data.sceneGraph = false;\n }\n this.change();\n }\n\n get memoryLimit(): number {\n return this._data.memoryLimit;\n }\n\n set memoryLimit(value: number) {\n this._data.memoryLimit = value;\n this.change();\n }\n\n get cuttingPlaneFillColor(): RGB {\n return this._data.cuttingPlaneFillColor;\n }\n\n set cuttingPlaneFillColor(value: RGB) {\n this._data.cuttingPlaneFillColor = value;\n this.change();\n }\n\n get edgesColor() {\n return this._data.edgesColor;\n }\n\n set edgesColor(value) {\n this._data.edgesColor = value;\n this.change();\n }\n\n get facesColor() {\n return this._data.facesColor;\n }\n\n set facesColor(value) {\n this._data.facesColor = value;\n this.change();\n }\n\n get edgesVisibility() {\n return this._data.edgesVisibility;\n }\n\n set edgesVisibility(value) {\n this._data.edgesVisibility = value;\n this.change();\n }\n\n get edgesOverlap() {\n return this._data.edgesOverlap;\n }\n\n set edgesOverlap(value) {\n this._data.edgesOverlap = value;\n this.change();\n }\n\n get facesOverlap() {\n return this._data.facesOverlap;\n }\n\n set facesOverlap(value) {\n this._data.facesOverlap = value;\n this.change();\n }\n\n get facesTransparancy() {\n return this._data.facesTransparancy;\n }\n\n set facesTransparancy(value) {\n this._data.facesTransparancy = value;\n this.change();\n }\n\n get enableCustomHighlight() {\n return this._data.enableCustomHighlight;\n }\n\n set enableCustomHighlight(value) {\n this._data.enableCustomHighlight = value;\n this.change();\n }\n\n get sceneGraph() {\n return this._data.sceneGraph;\n }\n\n set sceneGraph(value) {\n this._data.sceneGraph = value;\n if (value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get edgeModel() {\n return Boolean(this._data.edgeModel);\n }\n\n set edgeModel(value) {\n this._data.edgeModel = Boolean(value);\n this.change();\n }\n\n get reverseZoomWheel() {\n return this._data.reverseZoomWheel;\n }\n\n set reverseZoomWheel(value: boolean) {\n this._data.reverseZoomWheel = !!value;\n this.change();\n }\n\n get enableZoomWheel() {\n return this._data.enableZoomWheel;\n }\n\n set enableZoomWheel(value: boolean) {\n this._data.enableZoomWheel = !!value;\n this.change();\n }\n\n get enableGestures() {\n return this._data.enableGestures;\n }\n\n set enableGestures(value: boolean) {\n this._data.enableGestures = !!value;\n this.change();\n }\n\n get geometryType() {\n return this._data.geometryType;\n }\n\n set geometryType(value: string) {\n this._data.geometryType = value;\n this.change();\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport const CanvasEvents = [\n \"click\",\n \"contextmenu\",\n \"dblclick\",\n \"mousedown\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseup\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerup\",\n \"touchcancel\",\n \"touchend\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n];\n\nexport const CANVAS_EVENTS = CanvasEvents;\n\n/**\n * Canvas Events.\n *\n * @event\n */\nexport interface CanvasEventMap {\n /**\n * Event that fires on mouse click.\n */\n click: MouseEvent;\n\n /**\n * Event that fires when the user attempts to open a context menu.\n */\n contextmenu: PointerEvent;\n\n /**\n * Event that fires on mouse double click.\n */\n dblclick: MouseEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n mousedown: MouseEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n mouseleave: MouseEvent;\n\n /**\n * Event that fires on mouse move.\n */\n mousemove: MouseEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n mouseup: MouseEvent;\n\n /**\n * Event is fired when the browser determines that there are unlikely to be any more pointer events.\n */\n pointercancel: PointerEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n pointerdown: PointerEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n pointerleave: PointerEvent;\n\n /**\n * Event that fires on mouse move.\n */\n pointermove: PointerEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n pointerup: PointerEvent;\n\n /**\n * Event that fires touch is canceled.\n */\n touchcancel: TouchEvent;\n\n /**\n * Event that fires touch is ended.\n */\n touchend: TouchEvent;\n\n /**\n * Event that fires touch is moving.\n */\n touchmove: TouchEvent;\n\n /**\n * Event that fires when touch is started.\n */\n touchstart: TouchEvent;\n\n /**\n * Event that fires when mouse wheel is moving.\n */\n wheel: MouseEvent;\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { IViewer } from \"./IViewer\";\n\n/**\n * Defines the dragger of the viewer.\n */\nexport interface IDragger {\n /**\n * The name of the dragger. Use this name to activate dragger using\n * {@link Viewer.setActiveDragger | Viewer.setActiveDragger()}\n */\n name: string;\n\n /**\n * Initializes the dragger instance. Call {@link dispose | dispose()} to release allocated resources.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is activated. Do not\n * call this directly.\n */\n initialize(): void;\n\n /**\n * Releases resources allocated in the {@link initialize | initialize()}.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is deactivated. Do\n * not call this directly.\n */\n dispose(): void;\n\n /**\n * Updates the dragger preview if exists.\n *\n * This is internal method, called by the {@link Viewer} when it updates. Do not call this\n * method directly unless you are manually updating the viewer.\n */\n updatePreview(): void;\n}\n\n/**\n * Base class for the viewer draggers.\n *\n * To create your own dragger:\n *\n * 1. Define a dragger class inherited from Dragger.\n * 2. Override {@link initialize | initialize()} method to add mouse event listeners using\n * {@link Viewer.addEventListener | Viewer.addEventListener()}.\n * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`\n * event and zoom in/out when the left mouse button is pressed.\n * 4. Override {@link dispose | dispose()} method to remove mouse event listeners\n * {@link Viewer.removeEventListener | Viewer.removeEventListener()}.\n * 5. Register dragger class for the viewer instance.\n */\nexport class Dragger implements IDragger {\n name = \"\";\n\n constructor(viewer: IViewer) {}\n\n initialize(): void {}\n\n dispose(): void {}\n\n updatePreview(): void {}\n}\n"],"names":["Commands","constructor","this","_commands","Map","registerCommand","id","handler","description","thisArg","set","registerCommandAlias","alias","viewer","args","executeCommand","getCommand","get","getCommands","map","forEach","value","key","command","isDraggerCommand","draggers","includes","setActiveDragger","console","warn","undefined","result","apply","emit","type","data","commands","viewerType","defaultOptions","showWCS","cameraAnimation","antialiasing","groundShadow","shadows","cameraAxisXSpeed","cameraAxisYSpeed","ambientOcclusion","enableStreamingMode","enablePartialMode","memoryLimit","cuttingPlaneFillColor","red","green","blue","edgesColor","r","g","b","facesColor","edgesVisibility","edgesOverlap","facesOverlap","facesTransparancy","enableCustomHighlight","sceneGraph","edgeModel","reverseZoomWheel","enableZoomWheel","enableGestures","geometryType","Options","emitter","_emitter","_data","loadFromStorage","defaults","notifierChangeEvent","change","saveToStorage","window","localStorage","setItem","JSON","stringify","error","item","getItem","parse","resetToDefaults","fields","resetData","reduce","acc","field","Boolean","CanvasEvents","CANVAS_EVENTS","Dragger","name","initialize","dispose","updatePreview"],"mappings":"AA0BA,MAAMA;IAAN,WAAAC;QACmBC,KAAAC,YAAY,IAAIC;AAuClC;IArCC,eAAAC,CAAgBC,IAAYC,SAA0BC,aAAmCC;QACvFP,KAAKC,UAAUO,IAAIJ,IAAI;YAAEA;YAAIC;YAASE;YAASD;;AAChD;IAED,oBAAAG,CAAqBL,IAAYM;QAC/BV,KAAKG,gBAAgBO,QAAO,CAACC,WAAoBC,SAASZ,KAAKa,eAAeT,IAAIO,WAAWC;AAC9F;IAED,UAAAE,CAAWV;QACT,OAAOJ,KAAKC,UAAUc,IAAIX;AAC3B;IAED,WAAAY;QACE,MAAMC,MAAM,IAAIf;QAChBF,KAAKC,UAAUiB,SAAQ,CAACC,OAAOC,QAAQH,IAAIT,IAAIY,KAAKD;QACpD,OAAOF;AACR;IAED,cAAAJ,CAAeT,IAAYO,WAAoBC;QAC7C,MAAMS,UAAUrB,KAAKC,UAAUc,IAAIX;QACnC,KAAKiB,SAAS;YACZ,IAAIV,QAAQ;gBACV,MAAMW,mBAAmBX,OAAOY,SAASC,SAASpB;gBAClD,IAAIkB,kBAAkB,OAAOX,OAAOc,iBAAiBrB;AACtD;YAEDsB,QAAQC,KAAK,YAAYvB;YACzB,OAAOwB;AACR;QAED,OAAMvB,SAAEA,SAAOE,SAAEA,WAAYc;QAC7B,MAAMQ,SAASxB,QAAQyB,MAAMvB,SAAS,EAACI,WAAWC;QAElDD,mBAAAA,gBAAM,SAAA,IAANA,OAAQoB,KAAK;YAAEC,MAAM;YAAWC,MAAM7B;YA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QACZnB,KAAKuE,MAAMR,YAAY6B,QAAQzE;QAC/BnB,KAAK2E;AACN;IAED,oBAAIX;QACF,OAAOhE,KAAKuE,MAAMP;AACnB;IAED,oBAAIA,CAAiB7C;QACnBnB,KAAKuE,MAAMP,qBAAqB7C;QAChCnB,KAAK2E;AACN;IAED,mBAAIV;QACF,OAAOjE,KAAKuE,MAAMN;AACnB;IAED,mBAAIA,CAAgB9C;QAClBnB,KAAKuE,MAAMN,oBAAoB9C;QAC/BnB,KAAK2E;AACN;IAED,kBAAIT;QACF,OAAOlE,KAAKuE,MAAML;AACnB;IAED,kBAAIA,CAAe/C;QACjBnB,KAAKuE,MAAML,mBAAmB/C;QAC9BnB,KAAK2E;AACN;IAED,gBAAIR;QACF,OAAOnE,KAAKuE,MAAMJ;AACnB;IAED,gBAAIA,CAAahD;QACfnB,KAAKuE,MAAMJ,eAAehD;QAC1BnB,KAAK2E;AACN;;;ACvTU,MAAAkB,eAAe,EAC1B,SACA,eACA,YACA,aACA,cACA,aACA,WACA,iBACA,eACA,gBACA,eACA,aACA,eACA,YACA,aACA,cACA;;AAGK,MAAMC,gBAAgBD;;MC+BhBE;IAGX,WAAAhG,CAAYY;QAFZX,KAAIgG,OAAG;AAEwB;IAE/B,UAAAC,IAAqB;IAErB,OAAAC,IAAkB;IAElB,aAAAC,IAAwB;;;"}
|
|
1
|
+
{"version":3,"file":"viewer-core.module.js","sources":["../src/commands/Commands.ts","../src/options/IOptions.ts","../src/options/Options.ts","../src/viewer/CanvasEvents.ts","../src/viewer/IDragger.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IViewer } from \"../viewer/IViewer\";\nimport { ICommand, ICommandHandler, ICommandDescription, ICommandsMap, ICommands } from \"./ICommands\";\n\nclass Commands implements ICommands {\n private readonly _commands = new Map<string, ICommand>();\n\n registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void {\n this._commands.set(id, { id, handler, thisArg, description });\n }\n\n registerCommandAlias(id: string, alias: string): void {\n this.registerCommand(alias, (viewer: IViewer, ...args) => this.executeCommand(id, viewer, ...args));\n }\n\n getCommand(id: string): ICommand | undefined {\n return this._commands.get(id);\n }\n\n getCommands(): ICommandsMap {\n const map = new Map<string, ICommand>();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n\n executeCommand(id: string, viewer: IViewer, ...args: any[]): any {\n const command = this._commands.get(id);\n if (!command) {\n if (viewer) {\n const isDraggerCommand = viewer.draggers.includes(id);\n if (isDraggerCommand) return viewer.setActiveDragger(id);\n }\n\n console.warn(`Command '${id}' not found`);\n return undefined;\n }\n\n const { handler, thisArg } = command;\n const result = handler.apply(thisArg, [viewer, ...args]);\n\n viewer?.emit({ type: \"command\", data: id, args });\n\n return result;\n }\n}\n\nconst _commands = new Map<string, Commands>();\n\n/**\n * Returns the command manager for the specified viewer type.\n *\n * @param viewerType - Viewer type. Predefined viewer types are:\n *\n * - VisualizeJS - The `VisualizeJS` powered viewer.\n * - ThreeJS - The `Three.js` powered viewer.\n */\nfunction commands(viewerType = \"\"): ICommands {\n let result = _commands.get(viewerType);\n if (!result) {\n result = new Commands();\n _commands.set(viewerType, result);\n }\n return result;\n}\n\ncommands(\"\").registerCommand(\"noop\", () => {});\ncommands(\"VisualizeJS\").registerCommand(\"noop\", () => {});\ncommands(\"ThreeJS\").registerCommand(\"noop\", () => {});\n\nexport { commands };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport interface RGB {\n red: number;\n green: number;\n blue: number;\n}\n\n/**\n * Viewer options interface.\n */\nexport interface IOptions {\n /**\n * Show the world coordinate system axes in the bottom-left corner of the viewer.\n *\n * @defaultValue true\n */\n showWCS?: boolean;\n\n /**\n * Enable camera animation.\n *\n * @defaultValue true\n */\n cameraAnimation?: boolean;\n\n /**\n * Enable anti-aliasing using FXAA.\n *\n * @defaultValue true\n */\n antialiasing?: boolean;\n\n /**\n * Show ground shadows below the model.\n *\n * @defaultValue false\n */\n groundShadow?: boolean;\n\n /**\n * Enable ambient shadows.\n *\n * @defaultValue false\n */\n shadows?: boolean;\n\n /**\n * Camera speed on X axis.\n *\n * @defaultValue 4\n */\n cameraAxisXSpeed?: number;\n\n /**\n * Camera speed on Y axis.\n *\n * @defaultValue 1\n */\n cameraAxisYSpeed?: number;\n\n /**\n * Enable ambient occlusion.\n *\n * @defaultValue false\n */\n ambientOcclusion?: boolean;\n\n /**\n * Enable streaming of drawings from the server.\n *\n * If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only\n * update once the loading is complete, which may take a while.\n *\n * If streaming is enabled, {@link enablePartialMode | partial streaming} mode may be enabled as well.\n *\n * @defaultValue true\n */\n enableStreamingMode?: boolean;\n\n /**\n * Enable partial streaming mode to be able open large drawing.\n *\n * In partial streaming mode, the viewer keeps only visible objects in memory and loads other\n * objects when the camera changes.\n *\n * Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is\n * enabled, then {@link sceneGraph | scene graph} will be disabled.\n *\n * @defaultValue false\n */\n enablePartialMode?: boolean;\n\n /**\n * The size of the memory buffer for graphics data, in bytes.\n *\n * @defaultValue 3294967296\n */\n memoryLimit?: number;\n\n /**\n * Cutting planes fill color.\n *\n * @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }\n */\n cuttingPlaneFillColor?: RGB;\n\n /**\n * Edges highlight color.\n */\n edgesColor?: { r: number; g: number; b: number };\n\n /**\n * Faces highlight color.\n */\n facesColor?: { r: number; g: number; b: number };\n\n /**\n * Show highlighted edges.\n */\n edgesVisibility?: boolean;\n\n /**\n * Show highlighted edges over drawing.\n */\n edgesOverlap?: boolean;\n\n /**\n * Show highlighted faces over drawing.\n */\n facesOverlap?: boolean;\n\n /**\n * Highlighted faces transparency value, from 0 to 255.\n */\n facesTransparancy?: number;\n\n /**\n * Enable custom highlight settings.\n */\n enableCustomHighlight?: boolean;\n\n /**\n * Enable scene graph.\n *\n * Scene graph increases perfomance improvement, but consumes memory. Large drawings can take\n * up a lot of memory. If scene graph is enabled, then\n * {@link enablePartialMode | partial streaming} mode will be disabled.\n */\n sceneGraph: boolean;\n\n /**\n * Show the edges of the model:\n *\n * - `false` - No model edges are displayed. Usefull for less memory consumption.\n * - `true` - Display isolines.\n */\n edgeModel: boolean;\n\n /**\n * Reverse the mouse wheel direction for zooming:\n *\n * - `false` - Moving the wheel up zooms in, moving down zooms out.\n * - `true` - Moving the wheel up zooms out, moving down zooms in.\n */\n reverseZoomWheel: boolean;\n\n /**\n * Enable mouse wheel zooming.\n */\n enableZoomWheel: boolean;\n\n /**\n * Enable touch gestures.\n *\n * This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled,\n * since gestures contains touch zoom.\n */\n enableGestures: boolean;\n\n /**\n * Deprecated since `25.8`.\n */\n geometryType?: string;\n\n /**\n * Ruler unit.\n *\n * Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards,\n * Kilometers, Miles, Micrometers, MicroInches\n *\n * @defaultValue Default\n */\n rulerUnit: string;\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset.\n */\n resetToDefaults?: (fields?: string[]) => void;\n}\n\nexport function defaultOptions(): IOptions {\n return {\n showWCS: true,\n cameraAnimation: true,\n antialiasing: true,\n groundShadow: false,\n shadows: false,\n cameraAxisXSpeed: 4,\n cameraAxisYSpeed: 1,\n ambientOcclusion: false,\n enableStreamingMode: true,\n enablePartialMode: false,\n memoryLimit: 3294967296,\n cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },\n edgesColor: { r: 0xff, g: 0x98, b: 0x00 },\n facesColor: { r: 0xff, g: 0x98, b: 0x00 },\n edgesVisibility: true,\n edgesOverlap: true,\n facesOverlap: false,\n facesTransparancy: 200,\n enableCustomHighlight: true,\n sceneGraph: false,\n edgeModel: true,\n reverseZoomWheel: false,\n enableZoomWheel: true,\n enableGestures: true,\n geometryType: \"vsfx\",\n rulerUnit: \"Default\",\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\nimport { IOptions, RGB, defaultOptions } from \"./IOptions\";\n\nexport class Options implements IOptions {\n protected _emitter?: EventEmitter2;\n protected _data: IOptions;\n\n constructor(emitter?: EventEmitter2) {\n this._emitter = emitter;\n this._data = defaultOptions();\n this.loadFromStorage();\n }\n\n static defaults(): IOptions {\n return defaultOptions();\n }\n\n notifierChangeEvent(): void {\n console.warn(\n \"Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.\"\n );\n this.change();\n }\n\n change(): void {\n if (this._emitter !== undefined) {\n this.saveToStorage();\n this._emitter.emit({ type: \"optionschange\", data: this });\n }\n }\n\n saveToStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n localStorage.setItem(\"od-client-settings\", JSON.stringify(this.data));\n } catch (error) {\n console.error(\"Cannot save client settings.\", error);\n }\n }\n\n loadFromStorage(): void {\n if (typeof window !== \"undefined\")\n try {\n const item = localStorage.getItem(\"od-client-settings\");\n if (item) {\n const data = JSON.parse(item);\n this.data = { ...data };\n }\n } catch (error) {\n console.error(\"Cannot load client settings.\", error);\n }\n }\n\n /**\n * Resets options to default values.\n *\n * @param fields - Name of fields to be reset. Specify `undefined` to reset all.\n */\n resetToDefaults(fields?: string[]): void {\n if (fields !== undefined) {\n const defaults = Options.defaults();\n const resetData = fields.reduce((acc, field) => {\n acc[field] = defaults[field];\n return acc;\n }, {});\n this.data = { ...this.data, ...resetData };\n } else {\n this.data = { ...this.data, ...Options.defaults() };\n }\n }\n\n get data(): IOptions {\n return this._data;\n }\n\n set data(value: IOptions) {\n const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;\n const sceneGraph = enablePartialMode ? false : value.sceneGraph;\n this._data = { ...Options.defaults(), ...this._data, ...value, enablePartialMode, sceneGraph };\n this.change();\n }\n\n get showWCS(): boolean {\n return this._data.showWCS;\n }\n\n set showWCS(value: boolean) {\n this._data.showWCS = value;\n this.change();\n }\n\n get cameraAnimation(): boolean {\n return this._data.cameraAnimation;\n }\n\n set cameraAnimation(value: boolean) {\n this._data.cameraAnimation = value;\n this.change();\n }\n\n get antialiasing(): boolean {\n return this._data.antialiasing;\n }\n\n set antialiasing(value: boolean) {\n this._data.antialiasing = value;\n this.change();\n }\n\n get groundShadow(): boolean {\n return this._data.groundShadow;\n }\n\n set groundShadow(value: boolean) {\n this._data.groundShadow = value;\n this.change();\n }\n\n get shadows(): boolean {\n return this._data.shadows;\n }\n\n set shadows(value: boolean) {\n this._data.shadows = value;\n this.change();\n }\n\n get cameraAxisXSpeed(): number {\n return this._data.cameraAxisXSpeed;\n }\n\n set cameraAxisXSpeed(value: number) {\n this._data.cameraAxisXSpeed = value;\n this.change();\n }\n\n get cameraAxisYSpeed(): number {\n return this._data.cameraAxisYSpeed;\n }\n\n set cameraAxisYSpeed(value: number) {\n this.cameraAxisYSpeed = value;\n this.change();\n }\n\n get ambientOcclusion(): boolean {\n return this._data.ambientOcclusion;\n }\n\n set ambientOcclusion(value: boolean) {\n this._data.ambientOcclusion = value;\n this.change();\n }\n\n get enableStreamingMode(): boolean {\n return this._data.enableStreamingMode;\n }\n\n set enableStreamingMode(value: boolean) {\n this._data.enableStreamingMode = value;\n if (!value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get enablePartialMode(): boolean {\n return this._data.enablePartialMode;\n }\n\n set enablePartialMode(value: boolean) {\n this._data.enablePartialMode = value;\n if (value) {\n this._data.enableStreamingMode = true;\n this._data.sceneGraph = false;\n }\n this.change();\n }\n\n get memoryLimit(): number {\n return this._data.memoryLimit;\n }\n\n set memoryLimit(value: number) {\n this._data.memoryLimit = value;\n this.change();\n }\n\n get cuttingPlaneFillColor(): RGB {\n return this._data.cuttingPlaneFillColor;\n }\n\n set cuttingPlaneFillColor(value: RGB) {\n this._data.cuttingPlaneFillColor = value;\n this.change();\n }\n\n get edgesColor() {\n return this._data.edgesColor;\n }\n\n set edgesColor(value) {\n this._data.edgesColor = value;\n this.change();\n }\n\n get facesColor() {\n return this._data.facesColor;\n }\n\n set facesColor(value) {\n this._data.facesColor = value;\n this.change();\n }\n\n get edgesVisibility() {\n return this._data.edgesVisibility;\n }\n\n set edgesVisibility(value) {\n this._data.edgesVisibility = value;\n this.change();\n }\n\n get edgesOverlap() {\n return this._data.edgesOverlap;\n }\n\n set edgesOverlap(value) {\n this._data.edgesOverlap = value;\n this.change();\n }\n\n get facesOverlap() {\n return this._data.facesOverlap;\n }\n\n set facesOverlap(value) {\n this._data.facesOverlap = value;\n this.change();\n }\n\n get facesTransparancy() {\n return this._data.facesTransparancy;\n }\n\n set facesTransparancy(value) {\n this._data.facesTransparancy = value;\n this.change();\n }\n\n get enableCustomHighlight() {\n return this._data.enableCustomHighlight;\n }\n\n set enableCustomHighlight(value) {\n this._data.enableCustomHighlight = value;\n this.change();\n }\n\n get sceneGraph() {\n return this._data.sceneGraph;\n }\n\n set sceneGraph(value) {\n this._data.sceneGraph = value;\n if (value) this._data.enablePartialMode = false;\n this.change();\n }\n\n get edgeModel() {\n return Boolean(this._data.edgeModel);\n }\n\n set edgeModel(value) {\n this._data.edgeModel = Boolean(value);\n this.change();\n }\n\n get reverseZoomWheel() {\n return this._data.reverseZoomWheel;\n }\n\n set reverseZoomWheel(value: boolean) {\n this._data.reverseZoomWheel = !!value;\n this.change();\n }\n\n get enableZoomWheel() {\n return this._data.enableZoomWheel;\n }\n\n set enableZoomWheel(value: boolean) {\n this._data.enableZoomWheel = !!value;\n this.change();\n }\n\n get enableGestures() {\n return this._data.enableGestures;\n }\n\n set enableGestures(value: boolean) {\n this._data.enableGestures = !!value;\n this.change();\n }\n\n get geometryType() {\n return this._data.geometryType;\n }\n\n set geometryType(value: string) {\n this._data.geometryType = value;\n this.change();\n }\n\n get rulerUnit(): string {\n return this._data.rulerUnit;\n }\n\n set rulerUnit(value: string) {\n this._data.rulerUnit = value;\n this.change();\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nexport const CanvasEvents = [\n \"click\",\n \"contextmenu\",\n \"dblclick\",\n \"mousedown\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseup\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerup\",\n \"touchcancel\",\n \"touchend\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n];\n\nexport const CANVAS_EVENTS = CanvasEvents;\n\n/**\n * Canvas Events.\n *\n * @event\n */\nexport interface CanvasEventMap {\n /**\n * Event that fires on mouse click.\n */\n click: MouseEvent;\n\n /**\n * Event that fires when the user attempts to open a context menu.\n */\n contextmenu: PointerEvent;\n\n /**\n * Event that fires on mouse double click.\n */\n dblclick: MouseEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n mousedown: MouseEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n mouseleave: MouseEvent;\n\n /**\n * Event that fires on mouse move.\n */\n mousemove: MouseEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n mouseup: MouseEvent;\n\n /**\n * Event is fired when the browser determines that there are unlikely to be any more pointer events.\n */\n pointercancel: PointerEvent;\n\n /**\n * Event that fires on mouse button is down.\n */\n pointerdown: PointerEvent;\n\n /**\n * Event that fires on mouse leave.\n */\n pointerleave: PointerEvent;\n\n /**\n * Event that fires on mouse move.\n */\n pointermove: PointerEvent;\n\n /**\n * Event that fires on mouse button is up.\n */\n pointerup: PointerEvent;\n\n /**\n * Event that fires touch is canceled.\n */\n touchcancel: TouchEvent;\n\n /**\n * Event that fires touch is ended.\n */\n touchend: TouchEvent;\n\n /**\n * Event that fires touch is moving.\n */\n touchmove: TouchEvent;\n\n /**\n * Event that fires when touch is started.\n */\n touchstart: TouchEvent;\n\n /**\n * Event that fires when mouse wheel is moving.\n */\n wheel: MouseEvent;\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { IViewer } from \"./IViewer\";\n\n/**\n * Defines the dragger of the viewer.\n */\nexport interface IDragger {\n /**\n * The name of the dragger. Use this name to activate dragger using\n * {@link Viewer.setActiveDragger | Viewer.setActiveDragger()}\n */\n name: string;\n\n /**\n * Initializes the dragger instance. Call {@link dispose | dispose()} to release allocated resources.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is activated. Do not\n * call this directly.\n */\n initialize(): void;\n\n /**\n * Releases resources allocated in the {@link initialize | initialize()}.\n *\n * This is internal method, called by the {@link Viewer} when the dragger is deactivated. Do\n * not call this directly.\n */\n dispose(): void;\n\n /**\n * Updates the dragger preview if exists.\n *\n * This is internal method, called by the {@link Viewer} when it updates. Do not call this\n * method directly unless you are manually updating the viewer.\n */\n updatePreview(): void;\n}\n\n/**\n * Base class for the viewer draggers.\n *\n * To create your own dragger:\n *\n * 1. Define a dragger class inherited from Dragger.\n * 2. Override {@link initialize | initialize()} method to add mouse event listeners using\n * {@link Viewer.addEventListener | Viewer.addEventListener()}.\n * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`\n * event and zoom in/out when the left mouse button is pressed.\n * 4. Override {@link dispose | dispose()} method to remove mouse event listeners\n * {@link Viewer.removeEventListener | Viewer.removeEventListener()}.\n * 5. Register dragger class for the viewer instance.\n */\nexport class Dragger implements IDragger {\n name = \"\";\n\n constructor(viewer: IViewer) {}\n\n initialize(): void {}\n\n dispose(): void {}\n\n updatePreview(): void {}\n}\n"],"names":["Commands","constructor","this","_commands","Map","registerCommand","id","handler","description","thisArg","set","registerCommandAlias","alias","viewer","args","executeCommand","getCommand","get","getCommands","map","forEach","value","key","command","isDraggerCommand","draggers","includes","setActiveDragger","console","warn","undefined","result","apply","emit","type","data","commands","viewerType","defaultOptions","showWCS","cameraAnimation","antialiasing","groundShadow","shadows","cameraAxisXSpeed","cameraAxisYSpeed","ambientOcclusion","enableStreamingMode","enablePartialMode","memoryLimit","cuttingPlaneFillColor","red","green","blue","edgesColor","r","g","b","facesColor","edgesVisibility","edgesOverlap","facesOverlap","facesTransparancy","enableCustomHighlight","sceneGraph","edgeModel","reverseZoomWheel","enableZoomWheel","enableGestures","geometryType","rulerUnit","Options","emitter","_emitter","_data","loadFromStorage","defaults","notifierChangeEvent","change","saveToStorage","window","localStorage","setItem","JSON","stringify","error","item","getItem","parse","resetToDefaults","fields","resetData","reduce","acc","field","Boolean","CanvasEvents","CANVAS_EVENTS","Dragger","name","initialize","dispose","updatePreview"],"mappings":"AA0BA,MAAMA;IAAN,WAAAC;QACmBC,KAAAC,YAAY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,kBAAIV;QACF,OAAOlE,KAAKwE,MAAMN;AACnB;IAED,kBAAIA,CAAe/C;QACjBnB,KAAKwE,MAAMN,mBAAmB/C;QAC9BnB,KAAK4E;AACN;IAED,gBAAIT;QACF,OAAOnE,KAAKwE,MAAML;AACnB;IAED,gBAAIA,CAAahD;QACfnB,KAAKwE,MAAML,eAAehD;QAC1BnB,KAAK4E;AACN;IAED,aAAIR;QACF,OAAOpE,KAAKwE,MAAMJ;AACnB;IAED,aAAIA,CAAUjD;QACZnB,KAAKwE,MAAMJ,YAAYjD;QACvBnB,KAAK4E;AACN;;;AChUU,MAAAkB,eAAe,EAC1B,SACA,eACA,YACA,aACA,cACA,aACA,WACA,iBACA,eACA,gBACA,eACA,aACA,eACA,YACA,aACA,cACA;;AAGK,MAAMC,gBAAgBD;;MC+BhBE;IAGX,WAAAjG,CAAYY;QAFZX,KAAIiG,OAAG;AAEwB;IAE/B,UAAAC,IAAqB;IAErB,OAAAC,IAAkB;IAElB,aAAAC,IAAwB;;;"}
|
|
@@ -61,18 +61,18 @@ export interface IOptions {
|
|
|
61
61
|
* If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only
|
|
62
62
|
* update once the loading is complete, which may take a while.
|
|
63
63
|
*
|
|
64
|
-
* If streaming is enabled, {@link enablePartialMode | partial
|
|
64
|
+
* If streaming is enabled, {@link enablePartialMode | partial streaming} mode may be enabled as well.
|
|
65
65
|
*
|
|
66
66
|
* @defaultValue true
|
|
67
67
|
*/
|
|
68
68
|
enableStreamingMode?: boolean;
|
|
69
69
|
/**
|
|
70
|
-
* Enable partial
|
|
70
|
+
* Enable partial streaming mode to be able open large drawing.
|
|
71
71
|
*
|
|
72
|
-
* In partial
|
|
73
|
-
* objects when the
|
|
72
|
+
* In partial streaming mode, the viewer keeps only visible objects in memory and loads other
|
|
73
|
+
* objects when the camera changes.
|
|
74
74
|
*
|
|
75
|
-
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial
|
|
75
|
+
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is
|
|
76
76
|
* enabled, then {@link sceneGraph | scene graph} will be disabled.
|
|
77
77
|
*
|
|
78
78
|
* @defaultValue false
|
|
@@ -131,7 +131,7 @@ export interface IOptions {
|
|
|
131
131
|
*
|
|
132
132
|
* Scene graph increases perfomance improvement, but consumes memory. Large drawings can take
|
|
133
133
|
* up a lot of memory. If scene graph is enabled, then
|
|
134
|
-
* {@link enablePartialMode | partial
|
|
134
|
+
* {@link enablePartialMode | partial streaming} mode will be disabled.
|
|
135
135
|
*/
|
|
136
136
|
sceneGraph: boolean;
|
|
137
137
|
/**
|
|
@@ -163,6 +163,15 @@ export interface IOptions {
|
|
|
163
163
|
* Deprecated since `25.8`.
|
|
164
164
|
*/
|
|
165
165
|
geometryType?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Ruler unit.
|
|
168
|
+
*
|
|
169
|
+
* Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards,
|
|
170
|
+
* Kilometers, Miles, Micrometers, MicroInches
|
|
171
|
+
*
|
|
172
|
+
* @defaultValue Default
|
|
173
|
+
*/
|
|
174
|
+
rulerUnit: string;
|
|
166
175
|
/**
|
|
167
176
|
* Resets options to default values.
|
|
168
177
|
*
|
package/lib/options/Options.d.ts
CHANGED
package/lib/viewer/IViewer.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
50
50
|
*/
|
|
51
51
|
canvasEvents: string[];
|
|
52
52
|
/**
|
|
53
|
-
* List of names of
|
|
53
|
+
* List of names of available draggers.
|
|
54
54
|
*/
|
|
55
55
|
draggers: string[];
|
|
56
56
|
/**
|
|
@@ -114,16 +114,101 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
114
114
|
open(file: Model | File | Assembly): Promise<this>;
|
|
115
115
|
/**
|
|
116
116
|
* Cancels asynchronous file loading started by {@link open | open()}.
|
|
117
|
+
*
|
|
118
|
+
* Fires:
|
|
119
|
+
*
|
|
120
|
+
* - {@link CancelEvent | calcel}
|
|
117
121
|
*/
|
|
118
122
|
cancel(): this;
|
|
119
123
|
/**
|
|
120
124
|
* Unloads an open file, clears the canvas and markups.
|
|
125
|
+
*
|
|
126
|
+
* Fires:
|
|
127
|
+
*
|
|
128
|
+
* - {@link ClearEvent | clear}
|
|
121
129
|
*/
|
|
122
130
|
clear(): this;
|
|
123
131
|
/**
|
|
124
132
|
* Returns `true` if current opened model is 3D model.
|
|
125
133
|
*/
|
|
126
134
|
is3D(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Creates an overlay view. Overlay view is used to draw cutting planes and markups.
|
|
137
|
+
*/
|
|
138
|
+
syncOverlay(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Clears the overlay view.
|
|
141
|
+
*/
|
|
142
|
+
clearOverlay(): void;
|
|
143
|
+
/**
|
|
144
|
+
* Removes all cutting planes.
|
|
145
|
+
*/
|
|
146
|
+
clearSlices(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Returns a list of original handles for the selected objects.
|
|
149
|
+
*/
|
|
150
|
+
getSelected(): string[];
|
|
151
|
+
/**
|
|
152
|
+
* Selects the objects by original handles.
|
|
153
|
+
*
|
|
154
|
+
* Fires:
|
|
155
|
+
*
|
|
156
|
+
* - {@link SelectEvent | select}
|
|
157
|
+
*
|
|
158
|
+
* @param handles - The list of original handles.
|
|
159
|
+
*/
|
|
160
|
+
setSelected(handles?: string[]): void;
|
|
161
|
+
/**
|
|
162
|
+
* Unselects all objects.
|
|
163
|
+
*
|
|
164
|
+
* Fires:
|
|
165
|
+
*
|
|
166
|
+
* - {@link SelectEvent | select}
|
|
167
|
+
*/
|
|
168
|
+
clearSelected(): void;
|
|
169
|
+
/**
|
|
170
|
+
* Makes the selected objects invisible.
|
|
171
|
+
*
|
|
172
|
+
* Fires:
|
|
173
|
+
*
|
|
174
|
+
* - {@link HideEvent | hide}
|
|
175
|
+
* - {@link SelectEvent | select}
|
|
176
|
+
*/
|
|
177
|
+
hideSelected(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Hides all objects except selected.
|
|
180
|
+
*
|
|
181
|
+
* Fires:
|
|
182
|
+
*
|
|
183
|
+
* - {@link IsolateEvent | isolate}
|
|
184
|
+
*/
|
|
185
|
+
isolateSelected(): void;
|
|
186
|
+
/**
|
|
187
|
+
* Makes all objects visible.
|
|
188
|
+
*
|
|
189
|
+
* Fires:
|
|
190
|
+
*
|
|
191
|
+
* - {@link ShowAllEvent | showall}
|
|
192
|
+
*/
|
|
193
|
+
showAll(): void;
|
|
194
|
+
/**
|
|
195
|
+
* Breaks the model into its component objects. To collect objects back use index `0`.
|
|
196
|
+
*
|
|
197
|
+
* Fires:
|
|
198
|
+
*
|
|
199
|
+
* - {@link ExplodeEvent | explode}
|
|
200
|
+
*
|
|
201
|
+
* @param index - Explode index. Range is 0 to 100.
|
|
202
|
+
*/
|
|
203
|
+
explode(index: number): void;
|
|
204
|
+
/**
|
|
205
|
+
* Collect model objects back. Alias to {@link explode | explode(0)}.
|
|
206
|
+
*
|
|
207
|
+
* Fires:
|
|
208
|
+
*
|
|
209
|
+
* - {@link ExplodeEvent | explode}
|
|
210
|
+
*/
|
|
211
|
+
collect(): void;
|
|
127
212
|
/**
|
|
128
213
|
* Returns the active dragger reference, or `null` if there is no active dragger.
|
|
129
214
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Assembly, File, Model } from "@inweb/client";
|
|
2
|
+
import { IViewpoint } from "./IViewpoint";
|
|
2
3
|
/**
|
|
3
4
|
* Event that fires when model loading has been canceled.
|
|
4
5
|
*
|
|
@@ -26,7 +27,7 @@ export interface ChangeActiveDraggerEvent {
|
|
|
26
27
|
data: string;
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
|
-
* Event that fires when the
|
|
30
|
+
* Event that fires when the default color of new markup objects has been changed.
|
|
30
31
|
*
|
|
31
32
|
* @event
|
|
32
33
|
*/
|
|
@@ -108,6 +109,21 @@ export interface DisposeEvent {
|
|
|
108
109
|
*/
|
|
109
110
|
type: "dispose";
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
114
|
+
*
|
|
115
|
+
* @event
|
|
116
|
+
*/
|
|
117
|
+
export interface ExplodeEvent {
|
|
118
|
+
/**
|
|
119
|
+
* Event type.
|
|
120
|
+
*/
|
|
121
|
+
type: "explode";
|
|
122
|
+
/**
|
|
123
|
+
* Explode index. Range is 0 to 100.
|
|
124
|
+
*/
|
|
125
|
+
data: number;
|
|
126
|
+
}
|
|
111
127
|
/**
|
|
112
128
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
113
129
|
*
|
|
@@ -222,6 +238,17 @@ export interface GeometryStartEvent {
|
|
|
222
238
|
*/
|
|
223
239
|
buffer?: Uint8Array | ArrayBuffer;
|
|
224
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Event that fires after selected objects becomes invisible.
|
|
243
|
+
*
|
|
244
|
+
* @event
|
|
245
|
+
*/
|
|
246
|
+
export interface HideEvent {
|
|
247
|
+
/**
|
|
248
|
+
* Event type.
|
|
249
|
+
*/
|
|
250
|
+
type: "hide";
|
|
251
|
+
}
|
|
225
252
|
/**
|
|
226
253
|
* Event that fires after the viewer initialized.
|
|
227
254
|
*
|
|
@@ -259,6 +286,17 @@ export interface InitializeProgressEvent {
|
|
|
259
286
|
*/
|
|
260
287
|
total: number;
|
|
261
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Event that fires after selected objects becomes isolated.
|
|
291
|
+
*
|
|
292
|
+
* @event
|
|
293
|
+
*/
|
|
294
|
+
export interface IsolateEvent {
|
|
295
|
+
/**
|
|
296
|
+
* Event type.
|
|
297
|
+
*/
|
|
298
|
+
type: "isolate";
|
|
299
|
+
}
|
|
262
300
|
/**
|
|
263
301
|
* Event that fires before model opens.
|
|
264
302
|
*
|
|
@@ -333,7 +371,7 @@ export interface SelectEvent {
|
|
|
333
371
|
*/
|
|
334
372
|
type: "select";
|
|
335
373
|
/**
|
|
336
|
-
* Selection set.
|
|
374
|
+
* Selection set (viewer dependent).
|
|
337
375
|
*/
|
|
338
376
|
data: any;
|
|
339
377
|
/**
|
|
@@ -341,6 +379,17 @@ export interface SelectEvent {
|
|
|
341
379
|
*/
|
|
342
380
|
handles: string[];
|
|
343
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Event that fires after all objects becomes visible.
|
|
384
|
+
*
|
|
385
|
+
* @event
|
|
386
|
+
*/
|
|
387
|
+
export interface ShowAllEvent {
|
|
388
|
+
/**
|
|
389
|
+
* Event type.
|
|
390
|
+
*/
|
|
391
|
+
type: "showall";
|
|
392
|
+
}
|
|
344
393
|
/**
|
|
345
394
|
* Event that fires when an update occurs.
|
|
346
395
|
*
|
|
@@ -379,6 +428,21 @@ export interface VisualizeProgressEvent {
|
|
|
379
428
|
*/
|
|
380
429
|
total: number;
|
|
381
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Event that fires after viewer loads a viewpoint.
|
|
433
|
+
*
|
|
434
|
+
* @event
|
|
435
|
+
*/
|
|
436
|
+
export interface ViewpointEvent {
|
|
437
|
+
/**
|
|
438
|
+
* Event type.
|
|
439
|
+
*/
|
|
440
|
+
type: "drawviewpoint" | "createviewpoint";
|
|
441
|
+
/**
|
|
442
|
+
* Viewpoint.
|
|
443
|
+
*/
|
|
444
|
+
data: IViewpoint;
|
|
445
|
+
}
|
|
382
446
|
/**
|
|
383
447
|
* Event that fires when walk speed changing.
|
|
384
448
|
*
|
|
@@ -416,19 +480,19 @@ export interface PanEvent {
|
|
|
416
480
|
*/
|
|
417
481
|
type: "pan";
|
|
418
482
|
/**
|
|
419
|
-
* X coordinate.
|
|
483
|
+
* The X coordinate of the mouse pointer in screen coordinates.
|
|
420
484
|
*/
|
|
421
485
|
x: number;
|
|
422
486
|
/**
|
|
423
|
-
* Y coordinate.
|
|
487
|
+
* The Y coordinate of the mouse pointer in screen coordinates.
|
|
424
488
|
*/
|
|
425
489
|
y: number;
|
|
426
490
|
/**
|
|
427
|
-
*
|
|
491
|
+
* The X coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
428
492
|
*/
|
|
429
493
|
dX: number;
|
|
430
494
|
/**
|
|
431
|
-
*
|
|
495
|
+
* The Y coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
432
496
|
*/
|
|
433
497
|
dY: number;
|
|
434
498
|
}
|
|
@@ -461,6 +525,14 @@ export interface ZoomAtEvent {
|
|
|
461
525
|
* New zoom factor.
|
|
462
526
|
*/
|
|
463
527
|
data: number;
|
|
528
|
+
/**
|
|
529
|
+
* X coordinate of the mouse pointer in screen coordinates.
|
|
530
|
+
*/
|
|
531
|
+
x: number;
|
|
532
|
+
/**
|
|
533
|
+
* Y coordinate of the mouse pointer in screen coordinates.
|
|
534
|
+
*/
|
|
535
|
+
y: number;
|
|
464
536
|
}
|
|
465
537
|
/**
|
|
466
538
|
* Event that fires when zooming to object.
|
|
@@ -503,6 +575,10 @@ export interface ViewerEventMap {
|
|
|
503
575
|
* Event that fires after viewer executes the command.
|
|
504
576
|
*/
|
|
505
577
|
command: CommandEvent;
|
|
578
|
+
/**
|
|
579
|
+
* Event that fires after viewer creates a viewpoint.
|
|
580
|
+
*/
|
|
581
|
+
createviewpoint: ViewpointEvent;
|
|
506
582
|
/**
|
|
507
583
|
* Event that fires when the model scene description file has been loaded.
|
|
508
584
|
*/
|
|
@@ -511,6 +587,14 @@ export interface ViewerEventMap {
|
|
|
511
587
|
* Event that fires before viewer resources has been released.
|
|
512
588
|
*/
|
|
513
589
|
dispose: DisposeEvent;
|
|
590
|
+
/**
|
|
591
|
+
* Event that fires after viewer loads a viewpoint.
|
|
592
|
+
*/
|
|
593
|
+
drawviewpoint: ViewpointEvent;
|
|
594
|
+
/**
|
|
595
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
596
|
+
*/
|
|
597
|
+
explode: ExplodeEvent;
|
|
514
598
|
/**
|
|
515
599
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
516
600
|
*/
|
|
@@ -531,6 +615,10 @@ export interface ViewerEventMap {
|
|
|
531
615
|
* Event that fires before the model opens.
|
|
532
616
|
*/
|
|
533
617
|
geometrystart: GeometryStartEvent;
|
|
618
|
+
/**
|
|
619
|
+
* Event that fires after selected objects becomes invisible.
|
|
620
|
+
*/
|
|
621
|
+
hide: HideEvent;
|
|
534
622
|
/**
|
|
535
623
|
* Event that fires after the viewer initialized.
|
|
536
624
|
*/
|
|
@@ -539,6 +627,10 @@ export interface ViewerEventMap {
|
|
|
539
627
|
* Event that measures the progress of the viewer's initialization.
|
|
540
628
|
*/
|
|
541
629
|
initializeprogress: InitializeProgressEvent;
|
|
630
|
+
/**
|
|
631
|
+
* Event that fires after selected objects becomes isolated.
|
|
632
|
+
*/
|
|
633
|
+
isolate: IsolateEvent;
|
|
542
634
|
/**
|
|
543
635
|
* Event that fires before model opens.
|
|
544
636
|
*/
|
|
@@ -559,6 +651,10 @@ export interface ViewerEventMap {
|
|
|
559
651
|
* Event that fires when the selection changes.
|
|
560
652
|
*/
|
|
561
653
|
select: SelectEvent;
|
|
654
|
+
/**
|
|
655
|
+
* Event that fires after all objects becomes visible.
|
|
656
|
+
*/
|
|
657
|
+
showall: ShowAllEvent;
|
|
562
658
|
/**
|
|
563
659
|
* Event that fires when an update occurs.
|
|
564
660
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-core",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.11.1",
|
|
4
4
|
"description": "3D CAD and BIM data Viewer core",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"test": "karma start karma.conf.js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@inweb/eventemitter2": "~25.
|
|
29
|
+
"@inweb/eventemitter2": "~25.11.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@inweb/eventemitter2": "~25.
|
|
32
|
+
"@inweb/eventemitter2": "~25.11.1"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/options/IOptions.ts
CHANGED
|
@@ -93,19 +93,19 @@ export interface IOptions {
|
|
|
93
93
|
* If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only
|
|
94
94
|
* update once the loading is complete, which may take a while.
|
|
95
95
|
*
|
|
96
|
-
* If streaming is enabled, {@link enablePartialMode | partial
|
|
96
|
+
* If streaming is enabled, {@link enablePartialMode | partial streaming} mode may be enabled as well.
|
|
97
97
|
*
|
|
98
98
|
* @defaultValue true
|
|
99
99
|
*/
|
|
100
100
|
enableStreamingMode?: boolean;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Enable partial
|
|
103
|
+
* Enable partial streaming mode to be able open large drawing.
|
|
104
104
|
*
|
|
105
|
-
* In partial
|
|
106
|
-
* objects when the
|
|
105
|
+
* In partial streaming mode, the viewer keeps only visible objects in memory and loads other
|
|
106
|
+
* objects when the camera changes.
|
|
107
107
|
*
|
|
108
|
-
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial
|
|
108
|
+
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is
|
|
109
109
|
* enabled, then {@link sceneGraph | scene graph} will be disabled.
|
|
110
110
|
*
|
|
111
111
|
* @defaultValue false
|
|
@@ -166,7 +166,7 @@ export interface IOptions {
|
|
|
166
166
|
*
|
|
167
167
|
* Scene graph increases perfomance improvement, but consumes memory. Large drawings can take
|
|
168
168
|
* up a lot of memory. If scene graph is enabled, then
|
|
169
|
-
* {@link enablePartialMode | partial
|
|
169
|
+
* {@link enablePartialMode | partial streaming} mode will be disabled.
|
|
170
170
|
*/
|
|
171
171
|
sceneGraph: boolean;
|
|
172
172
|
|
|
@@ -204,6 +204,16 @@ export interface IOptions {
|
|
|
204
204
|
*/
|
|
205
205
|
geometryType?: string;
|
|
206
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Ruler unit.
|
|
209
|
+
*
|
|
210
|
+
* Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards,
|
|
211
|
+
* Kilometers, Miles, Micrometers, MicroInches
|
|
212
|
+
*
|
|
213
|
+
* @defaultValue Default
|
|
214
|
+
*/
|
|
215
|
+
rulerUnit: string;
|
|
216
|
+
|
|
207
217
|
/**
|
|
208
218
|
* Resets options to default values.
|
|
209
219
|
*
|
|
@@ -239,5 +249,6 @@ export function defaultOptions(): IOptions {
|
|
|
239
249
|
enableZoomWheel: true,
|
|
240
250
|
enableGestures: true,
|
|
241
251
|
geometryType: "vsfx",
|
|
252
|
+
rulerUnit: "Default",
|
|
242
253
|
};
|
|
243
254
|
}
|
package/src/options/Options.ts
CHANGED
|
@@ -333,4 +333,13 @@ export class Options implements IOptions {
|
|
|
333
333
|
this._data.geometryType = value;
|
|
334
334
|
this.change();
|
|
335
335
|
}
|
|
336
|
+
|
|
337
|
+
get rulerUnit(): string {
|
|
338
|
+
return this._data.rulerUnit;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
set rulerUnit(value: string) {
|
|
342
|
+
this._data.rulerUnit = value;
|
|
343
|
+
this.change();
|
|
344
|
+
}
|
|
336
345
|
}
|
package/src/viewer/IViewer.ts
CHANGED
|
@@ -78,7 +78,7 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
78
78
|
canvasEvents: string[];
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* List of names of
|
|
81
|
+
* List of names of available draggers.
|
|
82
82
|
*/
|
|
83
83
|
draggers: string[];
|
|
84
84
|
|
|
@@ -148,11 +148,19 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* Cancels asynchronous file loading started by {@link open | open()}.
|
|
151
|
+
*
|
|
152
|
+
* Fires:
|
|
153
|
+
*
|
|
154
|
+
* - {@link CancelEvent | calcel}
|
|
151
155
|
*/
|
|
152
156
|
cancel(): this;
|
|
153
157
|
|
|
154
158
|
/**
|
|
155
159
|
* Unloads an open file, clears the canvas and markups.
|
|
160
|
+
*
|
|
161
|
+
* Fires:
|
|
162
|
+
*
|
|
163
|
+
* - {@link ClearEvent | clear}
|
|
156
164
|
*/
|
|
157
165
|
clear(): this;
|
|
158
166
|
|
|
@@ -161,6 +169,94 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
161
169
|
*/
|
|
162
170
|
is3D(): boolean;
|
|
163
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Creates an overlay view. Overlay view is used to draw cutting planes and markups.
|
|
174
|
+
*/
|
|
175
|
+
syncOverlay(): void;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Clears the overlay view.
|
|
179
|
+
*/
|
|
180
|
+
clearOverlay(): void;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Removes all cutting planes.
|
|
184
|
+
*/
|
|
185
|
+
clearSlices(): void;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Returns a list of original handles for the selected objects.
|
|
189
|
+
*/
|
|
190
|
+
getSelected(): string[];
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Selects the objects by original handles.
|
|
194
|
+
*
|
|
195
|
+
* Fires:
|
|
196
|
+
*
|
|
197
|
+
* - {@link SelectEvent | select}
|
|
198
|
+
*
|
|
199
|
+
* @param handles - The list of original handles.
|
|
200
|
+
*/
|
|
201
|
+
setSelected(handles?: string[]): void;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Unselects all objects.
|
|
205
|
+
*
|
|
206
|
+
* Fires:
|
|
207
|
+
*
|
|
208
|
+
* - {@link SelectEvent | select}
|
|
209
|
+
*/
|
|
210
|
+
clearSelected(): void;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Makes the selected objects invisible.
|
|
214
|
+
*
|
|
215
|
+
* Fires:
|
|
216
|
+
*
|
|
217
|
+
* - {@link HideEvent | hide}
|
|
218
|
+
* - {@link SelectEvent | select}
|
|
219
|
+
*/
|
|
220
|
+
hideSelected(): void;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Hides all objects except selected.
|
|
224
|
+
*
|
|
225
|
+
* Fires:
|
|
226
|
+
*
|
|
227
|
+
* - {@link IsolateEvent | isolate}
|
|
228
|
+
*/
|
|
229
|
+
isolateSelected(): void;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Makes all objects visible.
|
|
233
|
+
*
|
|
234
|
+
* Fires:
|
|
235
|
+
*
|
|
236
|
+
* - {@link ShowAllEvent | showall}
|
|
237
|
+
*/
|
|
238
|
+
showAll(): void;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Breaks the model into its component objects. To collect objects back use index `0`.
|
|
242
|
+
*
|
|
243
|
+
* Fires:
|
|
244
|
+
*
|
|
245
|
+
* - {@link ExplodeEvent | explode}
|
|
246
|
+
*
|
|
247
|
+
* @param index - Explode index. Range is 0 to 100.
|
|
248
|
+
*/
|
|
249
|
+
explode(index: number): void;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Collect model objects back. Alias to {@link explode | explode(0)}.
|
|
253
|
+
*
|
|
254
|
+
* Fires:
|
|
255
|
+
*
|
|
256
|
+
* - {@link ExplodeEvent | explode}
|
|
257
|
+
*/
|
|
258
|
+
collect(): void;
|
|
259
|
+
|
|
164
260
|
/**
|
|
165
261
|
* Returns the active dragger reference, or `null` if there is no active dragger.
|
|
166
262
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Assembly, File, Model } from "@inweb/client";
|
|
2
|
+
import { IViewpoint } from "./IViewpoint";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Event that fires when model loading has been canceled.
|
|
@@ -30,7 +31,7 @@ export interface ChangeActiveDraggerEvent {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* Event that fires when the
|
|
34
|
+
* Event that fires when the default color of new markup objects has been changed.
|
|
34
35
|
*
|
|
35
36
|
* @event
|
|
36
37
|
*/
|
|
@@ -119,6 +120,23 @@ export interface DisposeEvent {
|
|
|
119
120
|
type: "dispose";
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
125
|
+
*
|
|
126
|
+
* @event
|
|
127
|
+
*/
|
|
128
|
+
export interface ExplodeEvent {
|
|
129
|
+
/**
|
|
130
|
+
* Event type.
|
|
131
|
+
*/
|
|
132
|
+
type: "explode";
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Explode index. Range is 0 to 100.
|
|
136
|
+
*/
|
|
137
|
+
data: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
122
140
|
/**
|
|
123
141
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
124
142
|
*
|
|
@@ -252,6 +270,18 @@ export interface GeometryStartEvent {
|
|
|
252
270
|
buffer?: Uint8Array | ArrayBuffer;
|
|
253
271
|
}
|
|
254
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Event that fires after selected objects becomes invisible.
|
|
275
|
+
*
|
|
276
|
+
* @event
|
|
277
|
+
*/
|
|
278
|
+
export interface HideEvent {
|
|
279
|
+
/**
|
|
280
|
+
* Event type.
|
|
281
|
+
*/
|
|
282
|
+
type: "hide";
|
|
283
|
+
}
|
|
284
|
+
|
|
255
285
|
/**
|
|
256
286
|
* Event that fires after the viewer initialized.
|
|
257
287
|
*
|
|
@@ -294,6 +324,18 @@ export interface InitializeProgressEvent {
|
|
|
294
324
|
total: number;
|
|
295
325
|
}
|
|
296
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Event that fires after selected objects becomes isolated.
|
|
329
|
+
*
|
|
330
|
+
* @event
|
|
331
|
+
*/
|
|
332
|
+
export interface IsolateEvent {
|
|
333
|
+
/**
|
|
334
|
+
* Event type.
|
|
335
|
+
*/
|
|
336
|
+
type: "isolate";
|
|
337
|
+
}
|
|
338
|
+
|
|
297
339
|
/**
|
|
298
340
|
* Event that fires before model opens.
|
|
299
341
|
*
|
|
@@ -379,7 +421,7 @@ export interface SelectEvent {
|
|
|
379
421
|
type: "select";
|
|
380
422
|
|
|
381
423
|
/**
|
|
382
|
-
* Selection set.
|
|
424
|
+
* Selection set (viewer dependent).
|
|
383
425
|
*/
|
|
384
426
|
data: any;
|
|
385
427
|
|
|
@@ -389,6 +431,18 @@ export interface SelectEvent {
|
|
|
389
431
|
handles: string[];
|
|
390
432
|
}
|
|
391
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Event that fires after all objects becomes visible.
|
|
436
|
+
*
|
|
437
|
+
* @event
|
|
438
|
+
*/
|
|
439
|
+
export interface ShowAllEvent {
|
|
440
|
+
/**
|
|
441
|
+
* Event type.
|
|
442
|
+
*/
|
|
443
|
+
type: "showall";
|
|
444
|
+
}
|
|
445
|
+
|
|
392
446
|
/**
|
|
393
447
|
* Event that fires when an update occurs.
|
|
394
448
|
*
|
|
@@ -432,6 +486,23 @@ export interface VisualizeProgressEvent {
|
|
|
432
486
|
total: number;
|
|
433
487
|
}
|
|
434
488
|
|
|
489
|
+
/**
|
|
490
|
+
* Event that fires after viewer loads a viewpoint.
|
|
491
|
+
*
|
|
492
|
+
* @event
|
|
493
|
+
*/
|
|
494
|
+
export interface ViewpointEvent {
|
|
495
|
+
/**
|
|
496
|
+
* Event type.
|
|
497
|
+
*/
|
|
498
|
+
type: "drawviewpoint" | "createviewpoint";
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Viewpoint.
|
|
502
|
+
*/
|
|
503
|
+
data: IViewpoint;
|
|
504
|
+
}
|
|
505
|
+
|
|
435
506
|
/**
|
|
436
507
|
* Event that fires when walk speed changing.
|
|
437
508
|
*
|
|
@@ -473,22 +544,22 @@ export interface PanEvent {
|
|
|
473
544
|
type: "pan";
|
|
474
545
|
|
|
475
546
|
/**
|
|
476
|
-
* X coordinate.
|
|
547
|
+
* The X coordinate of the mouse pointer in screen coordinates.
|
|
477
548
|
*/
|
|
478
549
|
x: number;
|
|
479
550
|
|
|
480
551
|
/**
|
|
481
|
-
* Y coordinate.
|
|
552
|
+
* The Y coordinate of the mouse pointer in screen coordinates.
|
|
482
553
|
*/
|
|
483
554
|
y: number;
|
|
484
555
|
|
|
485
556
|
/**
|
|
486
|
-
*
|
|
557
|
+
* The X coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
487
558
|
*/
|
|
488
559
|
dX: number;
|
|
489
560
|
|
|
490
561
|
/**
|
|
491
|
-
*
|
|
562
|
+
* The Y coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
492
563
|
*/
|
|
493
564
|
dY: number;
|
|
494
565
|
}
|
|
@@ -525,6 +596,16 @@ export interface ZoomAtEvent {
|
|
|
525
596
|
* New zoom factor.
|
|
526
597
|
*/
|
|
527
598
|
data: number;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* X coordinate of the mouse pointer in screen coordinates.
|
|
602
|
+
*/
|
|
603
|
+
x: number;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Y coordinate of the mouse pointer in screen coordinates.
|
|
607
|
+
*/
|
|
608
|
+
y: number;
|
|
528
609
|
}
|
|
529
610
|
|
|
530
611
|
/**
|
|
@@ -575,6 +656,11 @@ export interface ViewerEventMap {
|
|
|
575
656
|
*/
|
|
576
657
|
command: CommandEvent;
|
|
577
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Event that fires after viewer creates a viewpoint.
|
|
661
|
+
*/
|
|
662
|
+
createviewpoint: ViewpointEvent;
|
|
663
|
+
|
|
578
664
|
/**
|
|
579
665
|
* Event that fires when the model scene description file has been loaded.
|
|
580
666
|
*/
|
|
@@ -585,6 +671,16 @@ export interface ViewerEventMap {
|
|
|
585
671
|
*/
|
|
586
672
|
dispose: DisposeEvent;
|
|
587
673
|
|
|
674
|
+
/**
|
|
675
|
+
* Event that fires after viewer loads a viewpoint.
|
|
676
|
+
*/
|
|
677
|
+
drawviewpoint: ViewpointEvent;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
681
|
+
*/
|
|
682
|
+
explode: ExplodeEvent;
|
|
683
|
+
|
|
588
684
|
/**
|
|
589
685
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
590
686
|
*/
|
|
@@ -610,6 +706,11 @@ export interface ViewerEventMap {
|
|
|
610
706
|
*/
|
|
611
707
|
geometrystart: GeometryStartEvent;
|
|
612
708
|
|
|
709
|
+
/**
|
|
710
|
+
* Event that fires after selected objects becomes invisible.
|
|
711
|
+
*/
|
|
712
|
+
hide: HideEvent;
|
|
713
|
+
|
|
613
714
|
/**
|
|
614
715
|
* Event that fires after the viewer initialized.
|
|
615
716
|
*/
|
|
@@ -620,6 +721,11 @@ export interface ViewerEventMap {
|
|
|
620
721
|
*/
|
|
621
722
|
initializeprogress: InitializeProgressEvent;
|
|
622
723
|
|
|
724
|
+
/**
|
|
725
|
+
* Event that fires after selected objects becomes isolated.
|
|
726
|
+
*/
|
|
727
|
+
isolate: IsolateEvent;
|
|
728
|
+
|
|
623
729
|
/**
|
|
624
730
|
* Event that fires before model opens.
|
|
625
731
|
*/
|
|
@@ -645,6 +751,11 @@ export interface ViewerEventMap {
|
|
|
645
751
|
*/
|
|
646
752
|
select: SelectEvent;
|
|
647
753
|
|
|
754
|
+
/**
|
|
755
|
+
* Event that fires after all objects becomes visible.
|
|
756
|
+
*/
|
|
757
|
+
showall: ShowAllEvent;
|
|
758
|
+
|
|
648
759
|
/**
|
|
649
760
|
* Event that fires when an update occurs.
|
|
650
761
|
*/
|