@inweb/viewer-core 25.10.0 → 25.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/viewer-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 +65 -0
- package/lib/viewer/ViewerEvents.d.ts +78 -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 +73 -0
- package/src/viewer/ViewerEvents.ts +89 -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
|
@@ -124,6 +124,71 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
124
124
|
* Returns `true` if current opened model is 3D model.
|
|
125
125
|
*/
|
|
126
126
|
is3D(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Returns a list of original handles for the selected objects.
|
|
129
|
+
*/
|
|
130
|
+
getSelected(): string[];
|
|
131
|
+
/**
|
|
132
|
+
* Selects the objects by original handles.
|
|
133
|
+
*
|
|
134
|
+
* Fires:
|
|
135
|
+
*
|
|
136
|
+
* - {@link SelectEvent | select}
|
|
137
|
+
*
|
|
138
|
+
* @param handles - The list of original handles.
|
|
139
|
+
*/
|
|
140
|
+
setSelected(handles?: string[]): void;
|
|
141
|
+
/**
|
|
142
|
+
* Unselects all objects.
|
|
143
|
+
*
|
|
144
|
+
* Fires:
|
|
145
|
+
*
|
|
146
|
+
* - {@link SelectEvent | select}
|
|
147
|
+
*/
|
|
148
|
+
clearSelected(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Makes the selected objects invisible.
|
|
151
|
+
*
|
|
152
|
+
* Fires:
|
|
153
|
+
*
|
|
154
|
+
* - {@link HideEvent | hide}
|
|
155
|
+
* - {@link SelectEvent | select}
|
|
156
|
+
*/
|
|
157
|
+
hideSelected(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Hides all objects except selected.
|
|
160
|
+
*
|
|
161
|
+
* Fires:
|
|
162
|
+
*
|
|
163
|
+
* - {@link IsolateEvent | isolate}
|
|
164
|
+
*/
|
|
165
|
+
isolateSelected(): void;
|
|
166
|
+
/**
|
|
167
|
+
* Makes all objects visible.
|
|
168
|
+
*
|
|
169
|
+
* Fires:
|
|
170
|
+
*
|
|
171
|
+
* - {@link ShowAllEvent | showall}
|
|
172
|
+
*/
|
|
173
|
+
showAll(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Breaks the model into its component objects. To collect objects back use index `0`.
|
|
176
|
+
*
|
|
177
|
+
* Fires:
|
|
178
|
+
*
|
|
179
|
+
* - {@link ExplodeEvent | explode}
|
|
180
|
+
*
|
|
181
|
+
* @param index - Explode index. Range is 0 to 100.
|
|
182
|
+
*/
|
|
183
|
+
explode(index: number): void;
|
|
184
|
+
/**
|
|
185
|
+
* Collect model objects back. Alias to {@link explode | explode(0)}.
|
|
186
|
+
*
|
|
187
|
+
* Fires:
|
|
188
|
+
*
|
|
189
|
+
* - {@link ExplodeEvent | explode}
|
|
190
|
+
*/
|
|
191
|
+
collect(): void;
|
|
127
192
|
/**
|
|
128
193
|
* Returns the active dragger reference, or `null` if there is no active dragger.
|
|
129
194
|
*/
|
|
@@ -26,7 +26,7 @@ export interface ChangeActiveDraggerEvent {
|
|
|
26
26
|
data: string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Event that fires when the
|
|
29
|
+
* Event that fires when the default color of new markup objects has been changed.
|
|
30
30
|
*
|
|
31
31
|
* @event
|
|
32
32
|
*/
|
|
@@ -108,6 +108,21 @@ export interface DisposeEvent {
|
|
|
108
108
|
*/
|
|
109
109
|
type: "dispose";
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
113
|
+
*
|
|
114
|
+
* @event
|
|
115
|
+
*/
|
|
116
|
+
export interface ExplodeEvent {
|
|
117
|
+
/**
|
|
118
|
+
* Event type.
|
|
119
|
+
*/
|
|
120
|
+
type: "explode";
|
|
121
|
+
/**
|
|
122
|
+
* Explode index. Range is 0 to 100.
|
|
123
|
+
*/
|
|
124
|
+
data: number;
|
|
125
|
+
}
|
|
111
126
|
/**
|
|
112
127
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
113
128
|
*
|
|
@@ -222,6 +237,17 @@ export interface GeometryStartEvent {
|
|
|
222
237
|
*/
|
|
223
238
|
buffer?: Uint8Array | ArrayBuffer;
|
|
224
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Event that fires after selected objects becomes invisible.
|
|
242
|
+
*
|
|
243
|
+
* @event
|
|
244
|
+
*/
|
|
245
|
+
export interface HideEvent {
|
|
246
|
+
/**
|
|
247
|
+
* Event type.
|
|
248
|
+
*/
|
|
249
|
+
type: "hide";
|
|
250
|
+
}
|
|
225
251
|
/**
|
|
226
252
|
* Event that fires after the viewer initialized.
|
|
227
253
|
*
|
|
@@ -259,6 +285,17 @@ export interface InitializeProgressEvent {
|
|
|
259
285
|
*/
|
|
260
286
|
total: number;
|
|
261
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Event that fires after selected objects becomes isolated.
|
|
290
|
+
*
|
|
291
|
+
* @event
|
|
292
|
+
*/
|
|
293
|
+
export interface IsolateEvent {
|
|
294
|
+
/**
|
|
295
|
+
* Event type.
|
|
296
|
+
*/
|
|
297
|
+
type: "isolate";
|
|
298
|
+
}
|
|
262
299
|
/**
|
|
263
300
|
* Event that fires before model opens.
|
|
264
301
|
*
|
|
@@ -333,7 +370,7 @@ export interface SelectEvent {
|
|
|
333
370
|
*/
|
|
334
371
|
type: "select";
|
|
335
372
|
/**
|
|
336
|
-
* Selection set.
|
|
373
|
+
* Selection set (viewer dependent).
|
|
337
374
|
*/
|
|
338
375
|
data: any;
|
|
339
376
|
/**
|
|
@@ -341,6 +378,17 @@ export interface SelectEvent {
|
|
|
341
378
|
*/
|
|
342
379
|
handles: string[];
|
|
343
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Event that fires after all objects becomes visible.
|
|
383
|
+
*
|
|
384
|
+
* @event
|
|
385
|
+
*/
|
|
386
|
+
export interface ShowAllEvent {
|
|
387
|
+
/**
|
|
388
|
+
* Event type.
|
|
389
|
+
*/
|
|
390
|
+
type: "showall";
|
|
391
|
+
}
|
|
344
392
|
/**
|
|
345
393
|
* Event that fires when an update occurs.
|
|
346
394
|
*
|
|
@@ -416,19 +464,19 @@ export interface PanEvent {
|
|
|
416
464
|
*/
|
|
417
465
|
type: "pan";
|
|
418
466
|
/**
|
|
419
|
-
* X coordinate.
|
|
467
|
+
* The X coordinate of the mouse pointer in screen coordinates.
|
|
420
468
|
*/
|
|
421
469
|
x: number;
|
|
422
470
|
/**
|
|
423
|
-
* Y coordinate.
|
|
471
|
+
* The Y coordinate of the mouse pointer in screen coordinates.
|
|
424
472
|
*/
|
|
425
473
|
y: number;
|
|
426
474
|
/**
|
|
427
|
-
*
|
|
475
|
+
* The X coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
428
476
|
*/
|
|
429
477
|
dX: number;
|
|
430
478
|
/**
|
|
431
|
-
*
|
|
479
|
+
* The Y coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
432
480
|
*/
|
|
433
481
|
dY: number;
|
|
434
482
|
}
|
|
@@ -461,6 +509,14 @@ export interface ZoomAtEvent {
|
|
|
461
509
|
* New zoom factor.
|
|
462
510
|
*/
|
|
463
511
|
data: number;
|
|
512
|
+
/**
|
|
513
|
+
* X coordinate of the mouse pointer in screen coordinates.
|
|
514
|
+
*/
|
|
515
|
+
x: number;
|
|
516
|
+
/**
|
|
517
|
+
* Y coordinate of the mouse pointer in screen coordinates.
|
|
518
|
+
*/
|
|
519
|
+
y: number;
|
|
464
520
|
}
|
|
465
521
|
/**
|
|
466
522
|
* Event that fires when zooming to object.
|
|
@@ -511,6 +567,10 @@ export interface ViewerEventMap {
|
|
|
511
567
|
* Event that fires before viewer resources has been released.
|
|
512
568
|
*/
|
|
513
569
|
dispose: DisposeEvent;
|
|
570
|
+
/**
|
|
571
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
572
|
+
*/
|
|
573
|
+
explode: ExplodeEvent;
|
|
514
574
|
/**
|
|
515
575
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
516
576
|
*/
|
|
@@ -531,6 +591,10 @@ export interface ViewerEventMap {
|
|
|
531
591
|
* Event that fires before the model opens.
|
|
532
592
|
*/
|
|
533
593
|
geometrystart: GeometryStartEvent;
|
|
594
|
+
/**
|
|
595
|
+
* Event that fires after selected objects becomes invisible.
|
|
596
|
+
*/
|
|
597
|
+
hide: HideEvent;
|
|
534
598
|
/**
|
|
535
599
|
* Event that fires after the viewer initialized.
|
|
536
600
|
*/
|
|
@@ -539,6 +603,10 @@ export interface ViewerEventMap {
|
|
|
539
603
|
* Event that measures the progress of the viewer's initialization.
|
|
540
604
|
*/
|
|
541
605
|
initializeprogress: InitializeProgressEvent;
|
|
606
|
+
/**
|
|
607
|
+
* Event that fires after selected objects becomes isolated.
|
|
608
|
+
*/
|
|
609
|
+
isolate: IsolateEvent;
|
|
542
610
|
/**
|
|
543
611
|
* Event that fires before model opens.
|
|
544
612
|
*/
|
|
@@ -559,6 +627,10 @@ export interface ViewerEventMap {
|
|
|
559
627
|
* Event that fires when the selection changes.
|
|
560
628
|
*/
|
|
561
629
|
select: SelectEvent;
|
|
630
|
+
/**
|
|
631
|
+
* Event that fires after all objects becomes visible.
|
|
632
|
+
*/
|
|
633
|
+
showall: ShowAllEvent;
|
|
562
634
|
/**
|
|
563
635
|
* Event that fires when an update occurs.
|
|
564
636
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-core",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.11.0",
|
|
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.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@inweb/eventemitter2": "~25.
|
|
32
|
+
"@inweb/eventemitter2": "~25.11.0"
|
|
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
|
@@ -161,6 +161,79 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
161
161
|
*/
|
|
162
162
|
is3D(): boolean;
|
|
163
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Returns a list of original handles for the selected objects.
|
|
166
|
+
*/
|
|
167
|
+
getSelected(): string[];
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Selects the objects by original handles.
|
|
171
|
+
*
|
|
172
|
+
* Fires:
|
|
173
|
+
*
|
|
174
|
+
* - {@link SelectEvent | select}
|
|
175
|
+
*
|
|
176
|
+
* @param handles - The list of original handles.
|
|
177
|
+
*/
|
|
178
|
+
setSelected(handles?: string[]): void;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Unselects all objects.
|
|
182
|
+
*
|
|
183
|
+
* Fires:
|
|
184
|
+
*
|
|
185
|
+
* - {@link SelectEvent | select}
|
|
186
|
+
*/
|
|
187
|
+
clearSelected(): void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Makes the selected objects invisible.
|
|
191
|
+
*
|
|
192
|
+
* Fires:
|
|
193
|
+
*
|
|
194
|
+
* - {@link HideEvent | hide}
|
|
195
|
+
* - {@link SelectEvent | select}
|
|
196
|
+
*/
|
|
197
|
+
hideSelected(): void;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Hides all objects except selected.
|
|
201
|
+
*
|
|
202
|
+
* Fires:
|
|
203
|
+
*
|
|
204
|
+
* - {@link IsolateEvent | isolate}
|
|
205
|
+
*/
|
|
206
|
+
isolateSelected(): void;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Makes all objects visible.
|
|
210
|
+
*
|
|
211
|
+
* Fires:
|
|
212
|
+
*
|
|
213
|
+
* - {@link ShowAllEvent | showall}
|
|
214
|
+
*/
|
|
215
|
+
showAll(): void;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Breaks the model into its component objects. To collect objects back use index `0`.
|
|
219
|
+
*
|
|
220
|
+
* Fires:
|
|
221
|
+
*
|
|
222
|
+
* - {@link ExplodeEvent | explode}
|
|
223
|
+
*
|
|
224
|
+
* @param index - Explode index. Range is 0 to 100.
|
|
225
|
+
*/
|
|
226
|
+
explode(index: number): void;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Collect model objects back. Alias to {@link explode | explode(0)}.
|
|
230
|
+
*
|
|
231
|
+
* Fires:
|
|
232
|
+
*
|
|
233
|
+
* - {@link ExplodeEvent | explode}
|
|
234
|
+
*/
|
|
235
|
+
collect(): void;
|
|
236
|
+
|
|
164
237
|
/**
|
|
165
238
|
* Returns the active dragger reference, or `null` if there is no active dragger.
|
|
166
239
|
*/
|
|
@@ -30,7 +30,7 @@ export interface ChangeActiveDraggerEvent {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Event that fires when the
|
|
33
|
+
* Event that fires when the default color of new markup objects has been changed.
|
|
34
34
|
*
|
|
35
35
|
* @event
|
|
36
36
|
*/
|
|
@@ -119,6 +119,23 @@ export interface DisposeEvent {
|
|
|
119
119
|
type: "dispose";
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
124
|
+
*
|
|
125
|
+
* @event
|
|
126
|
+
*/
|
|
127
|
+
export interface ExplodeEvent {
|
|
128
|
+
/**
|
|
129
|
+
* Event type.
|
|
130
|
+
*/
|
|
131
|
+
type: "explode";
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Explode index. Range is 0 to 100.
|
|
135
|
+
*/
|
|
136
|
+
data: number;
|
|
137
|
+
}
|
|
138
|
+
|
|
122
139
|
/**
|
|
123
140
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
124
141
|
*
|
|
@@ -252,6 +269,18 @@ export interface GeometryStartEvent {
|
|
|
252
269
|
buffer?: Uint8Array | ArrayBuffer;
|
|
253
270
|
}
|
|
254
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Event that fires after selected objects becomes invisible.
|
|
274
|
+
*
|
|
275
|
+
* @event
|
|
276
|
+
*/
|
|
277
|
+
export interface HideEvent {
|
|
278
|
+
/**
|
|
279
|
+
* Event type.
|
|
280
|
+
*/
|
|
281
|
+
type: "hide";
|
|
282
|
+
}
|
|
283
|
+
|
|
255
284
|
/**
|
|
256
285
|
* Event that fires after the viewer initialized.
|
|
257
286
|
*
|
|
@@ -294,6 +323,18 @@ export interface InitializeProgressEvent {
|
|
|
294
323
|
total: number;
|
|
295
324
|
}
|
|
296
325
|
|
|
326
|
+
/**
|
|
327
|
+
* Event that fires after selected objects becomes isolated.
|
|
328
|
+
*
|
|
329
|
+
* @event
|
|
330
|
+
*/
|
|
331
|
+
export interface IsolateEvent {
|
|
332
|
+
/**
|
|
333
|
+
* Event type.
|
|
334
|
+
*/
|
|
335
|
+
type: "isolate";
|
|
336
|
+
}
|
|
337
|
+
|
|
297
338
|
/**
|
|
298
339
|
* Event that fires before model opens.
|
|
299
340
|
*
|
|
@@ -379,7 +420,7 @@ export interface SelectEvent {
|
|
|
379
420
|
type: "select";
|
|
380
421
|
|
|
381
422
|
/**
|
|
382
|
-
* Selection set.
|
|
423
|
+
* Selection set (viewer dependent).
|
|
383
424
|
*/
|
|
384
425
|
data: any;
|
|
385
426
|
|
|
@@ -389,6 +430,18 @@ export interface SelectEvent {
|
|
|
389
430
|
handles: string[];
|
|
390
431
|
}
|
|
391
432
|
|
|
433
|
+
/**
|
|
434
|
+
* Event that fires after all objects becomes visible.
|
|
435
|
+
*
|
|
436
|
+
* @event
|
|
437
|
+
*/
|
|
438
|
+
export interface ShowAllEvent {
|
|
439
|
+
/**
|
|
440
|
+
* Event type.
|
|
441
|
+
*/
|
|
442
|
+
type: "showall";
|
|
443
|
+
}
|
|
444
|
+
|
|
392
445
|
/**
|
|
393
446
|
* Event that fires when an update occurs.
|
|
394
447
|
*
|
|
@@ -473,22 +526,22 @@ export interface PanEvent {
|
|
|
473
526
|
type: "pan";
|
|
474
527
|
|
|
475
528
|
/**
|
|
476
|
-
* X coordinate.
|
|
529
|
+
* The X coordinate of the mouse pointer in screen coordinates.
|
|
477
530
|
*/
|
|
478
531
|
x: number;
|
|
479
532
|
|
|
480
533
|
/**
|
|
481
|
-
* Y coordinate.
|
|
534
|
+
* The Y coordinate of the mouse pointer in screen coordinates.
|
|
482
535
|
*/
|
|
483
536
|
y: number;
|
|
484
537
|
|
|
485
538
|
/**
|
|
486
|
-
*
|
|
539
|
+
* The X coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
487
540
|
*/
|
|
488
541
|
dX: number;
|
|
489
542
|
|
|
490
543
|
/**
|
|
491
|
-
*
|
|
544
|
+
* The Y coordinate delta of the mouse pointer relative to the position of the last `Pan` event.
|
|
492
545
|
*/
|
|
493
546
|
dY: number;
|
|
494
547
|
}
|
|
@@ -525,6 +578,16 @@ export interface ZoomAtEvent {
|
|
|
525
578
|
* New zoom factor.
|
|
526
579
|
*/
|
|
527
580
|
data: number;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* X coordinate of the mouse pointer in screen coordinates.
|
|
584
|
+
*/
|
|
585
|
+
x: number;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Y coordinate of the mouse pointer in screen coordinates.
|
|
589
|
+
*/
|
|
590
|
+
y: number;
|
|
528
591
|
}
|
|
529
592
|
|
|
530
593
|
/**
|
|
@@ -585,6 +648,11 @@ export interface ViewerEventMap {
|
|
|
585
648
|
*/
|
|
586
649
|
dispose: DisposeEvent;
|
|
587
650
|
|
|
651
|
+
/**
|
|
652
|
+
* Event that fires when model breaks into its component objects or collect objects back.
|
|
653
|
+
*/
|
|
654
|
+
explode: ExplodeEvent;
|
|
655
|
+
|
|
588
656
|
/**
|
|
589
657
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
590
658
|
*/
|
|
@@ -610,6 +678,11 @@ export interface ViewerEventMap {
|
|
|
610
678
|
*/
|
|
611
679
|
geometrystart: GeometryStartEvent;
|
|
612
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Event that fires after selected objects becomes invisible.
|
|
683
|
+
*/
|
|
684
|
+
hide: HideEvent;
|
|
685
|
+
|
|
613
686
|
/**
|
|
614
687
|
* Event that fires after the viewer initialized.
|
|
615
688
|
*/
|
|
@@ -620,6 +693,11 @@ export interface ViewerEventMap {
|
|
|
620
693
|
*/
|
|
621
694
|
initializeprogress: InitializeProgressEvent;
|
|
622
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Event that fires after selected objects becomes isolated.
|
|
698
|
+
*/
|
|
699
|
+
isolate: IsolateEvent;
|
|
700
|
+
|
|
623
701
|
/**
|
|
624
702
|
* Event that fires before model opens.
|
|
625
703
|
*/
|
|
@@ -645,6 +723,11 @@ export interface ViewerEventMap {
|
|
|
645
723
|
*/
|
|
646
724
|
select: SelectEvent;
|
|
647
725
|
|
|
726
|
+
/**
|
|
727
|
+
* Event that fires after all objects becomes visible.
|
|
728
|
+
*/
|
|
729
|
+
showall: ShowAllEvent;
|
|
730
|
+
|
|
648
731
|
/**
|
|
649
732
|
* Event that fires when an update occurs.
|
|
650
733
|
*/
|