@inweb/viewer-core 25.9.1 → 25.9.3
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 +23 -0
- package/dist/viewer-core.js.map +1 -1
- package/dist/viewer-core.module.js.map +1 -1
- package/lib/commands/Commands.d.ts +8 -0
- package/lib/commands/ICommands.d.ts +78 -0
- package/lib/viewer/IDragger.d.ts +40 -0
- package/lib/viewer/IViewer.d.ts +133 -1
- package/package.json +3 -3
- package/src/commands/Commands.ts +8 -0
- package/src/commands/ICommands.ts +85 -0
- package/src/viewer/IDragger.ts +43 -0
- package/src/viewer/IViewer.ts +144 -1
package/dist/viewer-core.js
CHANGED
|
@@ -62,6 +62,14 @@
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
const _commands = new Map();
|
|
65
|
+
/**
|
|
66
|
+
* Returns the command manager for the specified viewer type.
|
|
67
|
+
*
|
|
68
|
+
* @param viewerType - Viewer type. Predefined viewer types are:
|
|
69
|
+
*
|
|
70
|
+
* - VisualizeJS - The `VisualizeJS` powered viewer.
|
|
71
|
+
* - ThreeJS - The `Three.js` powered viewer.
|
|
72
|
+
*/
|
|
65
73
|
function commands(viewerType = "") {
|
|
66
74
|
let result = _commands.get(viewerType);
|
|
67
75
|
if (!result) {
|
|
@@ -466,6 +474,21 @@
|
|
|
466
474
|
// By use of this software, its documentation or related materials, you
|
|
467
475
|
// acknowledge and accept the above terms.
|
|
468
476
|
///////////////////////////////////////////////////////////////////////////////
|
|
477
|
+
/**
|
|
478
|
+
* Base class for the viewer draggers.
|
|
479
|
+
*
|
|
480
|
+
* To create your own dragger:
|
|
481
|
+
*
|
|
482
|
+
* 1. Define a dragger class inherited from Dragger.
|
|
483
|
+
* 2. Override {@link initialize | initialize()} method to add mouse event listeners using
|
|
484
|
+
* {@link Viewer.addEventListener | Viewer.addEventListener()}.
|
|
485
|
+
* 3. Define the dragger logic in listeners. For example, listen for the `mousemove` event and
|
|
486
|
+
* zoom in/out when the left mouse button is pressed.
|
|
487
|
+
* 4. Override {@link dispose | dispose()} method to remove mouse event listeners
|
|
488
|
+
* {@link Viewer.removeEventListener | Viewer.removeEventListener()}.
|
|
489
|
+
* 5. Register dragger class for the viewer instance using
|
|
490
|
+
* {@link Viewer.registerDragger | Viewer.registerDragger()}.
|
|
491
|
+
*/
|
|
469
492
|
class Dragger {
|
|
470
493
|
constructor(viewer) {
|
|
471
494
|
this.name = "";
|
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\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\nexport interface IDragger {\n name: string;\n initialize(): void;\n dispose(): void;\n updatePreview(): void;\n}\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,CAAC,CAAC;SAC/B;QAED,WAAW,GAAA;IACT,QAAA,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAC;YACxC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5D,QAAA,OAAO,GAAG,CAAC;SACZ;IAED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AI,CAAC,MAAM,EAAE,CAAC;SACf;IAED,IAAA,IAAI,YAAY,GAAA;IACd,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;SAChC;QAED,IAAI,YAAY,CAAC,KAAa,EAAA;IAC5B,QAAA,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;YAChC,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;IACF;;IC/UD;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;UAWa,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;;;;;;;;;;;;;"}
|
|
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 listeners. For example, listen for the `mousemove` event and\n * 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 using\n * {@link Viewer.registerDragger | Viewer.registerDragger()}.\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,CAAC,CAAC;SAC/B;QAED,WAAW,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
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\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\nexport interface IDragger {\n name: string;\n initialize(): void;\n dispose(): void;\n updatePreview(): void;\n}\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,O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AIA,CAAW3C;QACbnB,KAAKuE,MAAMT,aAAa3C;QACxB,IAAIA,OAAOnB,KAAKuE,MAAMzB,oBAAoB;QAC1C9C,KAAK2E;AACN;IAED,aAAIZ;QACF,OAAO6B,QAAQ5F,KAAKuE,MAAMR;AAC3B;IAED,aAAIA,CAAU5C;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;;MCXhBE;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 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 listeners. For example, listen for the `mousemove` event and\n * 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 using\n * {@link Viewer.registerDragger | Viewer.registerDragger()}.\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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B;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;;MCgChBE;IAGX,WAAAhG,CAAYY;QAFZX,KAAIgG,OAAG;AAEwB;IAE/B,UAAAC,IAAqB;IAErB,OAAAC,IAAkB;IAElB,aAAAC,IAAwB;;;"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { ICommands } from "./ICommands";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the command manager for the specified viewer type.
|
|
4
|
+
*
|
|
5
|
+
* @param viewerType - Viewer type. Predefined viewer types are:
|
|
6
|
+
*
|
|
7
|
+
* - VisualizeJS - The `VisualizeJS` powered viewer.
|
|
8
|
+
* - ThreeJS - The `Three.js` powered viewer.
|
|
9
|
+
*/
|
|
2
10
|
declare function commands(viewerType?: string): ICommands;
|
|
3
11
|
export { commands };
|
|
@@ -1,24 +1,102 @@
|
|
|
1
1
|
import { IViewer } from "../viewer/IViewer";
|
|
2
|
+
/**
|
|
3
|
+
* Defines the command executer service interface.
|
|
4
|
+
*/
|
|
2
5
|
export interface ICommandService {
|
|
6
|
+
/**
|
|
7
|
+
* Executes the command denoted by the given command ID.
|
|
8
|
+
*
|
|
9
|
+
* To register your own command use the {@link ICommands.registerCommand | registerCommand()}
|
|
10
|
+
* method of the {@link commands} manager.
|
|
11
|
+
*
|
|
12
|
+
* @param id - ID of the command to execute.
|
|
13
|
+
* @param args - Parameters passed to the command handler function.
|
|
14
|
+
* @returns Returns the result of the command handler function. Returns `undefined` when the
|
|
15
|
+
* command doesn't exists.
|
|
16
|
+
*/
|
|
3
17
|
executeCommand(id: string, ...args: any[]): any;
|
|
4
18
|
}
|
|
5
19
|
export type ICommandsMap = Map<string, ICommand>;
|
|
20
|
+
/**
|
|
21
|
+
* Defines the command handler function.
|
|
22
|
+
*/
|
|
6
23
|
export interface ICommandHandler {
|
|
24
|
+
/**
|
|
25
|
+
* @param viewer - Viewer instance that executes the command.
|
|
26
|
+
* @param args - Parameters passed to the command handler function.
|
|
27
|
+
*/
|
|
7
28
|
(viewer: any, ...args: any[]): any;
|
|
8
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Defines the command to execute by the {@link Viewer}.
|
|
32
|
+
*/
|
|
9
33
|
export interface ICommand {
|
|
34
|
+
/**
|
|
35
|
+
* Command ID.
|
|
36
|
+
*/
|
|
10
37
|
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Handler function.
|
|
40
|
+
*/
|
|
11
41
|
handler: ICommandHandler;
|
|
42
|
+
/**
|
|
43
|
+
* The `this` context used when invoking the handler function.
|
|
44
|
+
*/
|
|
12
45
|
thisArg?: any;
|
|
46
|
+
/**
|
|
47
|
+
* Command description.
|
|
48
|
+
*/
|
|
13
49
|
description?: ICommandDescription;
|
|
14
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Defines the command description.
|
|
53
|
+
*/
|
|
15
54
|
export interface ICommandDescription {
|
|
55
|
+
/**
|
|
56
|
+
* Command description string.
|
|
57
|
+
*/
|
|
16
58
|
readonly description: string;
|
|
17
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Define the viewer command manager interface.
|
|
62
|
+
*/
|
|
18
63
|
export interface ICommands {
|
|
64
|
+
/**
|
|
65
|
+
* Binds a command ID to a handler function. Registering a command with an existing ID twice
|
|
66
|
+
* overrides the existing handler.
|
|
67
|
+
*
|
|
68
|
+
* @param id - Unique ID for the command.
|
|
69
|
+
* @param handler - Command handler function.
|
|
70
|
+
* @param description - Command description.
|
|
71
|
+
* @param thisArg - The `this` context used when invoking the handler function.
|
|
72
|
+
*/
|
|
19
73
|
registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void;
|
|
74
|
+
/**
|
|
75
|
+
* Registers an alias for a command.
|
|
76
|
+
*
|
|
77
|
+
* @param id - Unique ID for the command.
|
|
78
|
+
* @param alias - Command alias string.
|
|
79
|
+
*/
|
|
20
80
|
registerCommandAlias(id: string, alias: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Returns a list of registered commands.
|
|
83
|
+
*/
|
|
21
84
|
getCommands(): ICommandsMap;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the specified command or `undefined` when the command doesn't exists.
|
|
87
|
+
*
|
|
88
|
+
* @param id - Command ID.
|
|
89
|
+
*/
|
|
22
90
|
getCommand(id: string): ICommand | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Executes the command denoted by the given command. If the command is not found, tries to
|
|
93
|
+
* set active dragger with the specified name.
|
|
94
|
+
*
|
|
95
|
+
* @param id - Command ID or dragger name.
|
|
96
|
+
* @param viewer - Viewer instance that wants to execute the command.
|
|
97
|
+
* @param args - Parameters passed to the command handler function.
|
|
98
|
+
* @returns Returns the result of the command handler function or new active dragger
|
|
99
|
+
* instance. Returns `undefined` if neither the command nor the dragger exists.
|
|
100
|
+
*/
|
|
23
101
|
executeCommand(id: string, viewer: IViewer, ...args: any[]): any;
|
|
24
102
|
}
|
package/lib/viewer/IDragger.d.ts
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
import type { IViewer } from "./IViewer";
|
|
2
|
+
/**
|
|
3
|
+
* Defines the dragger of the viewer.
|
|
4
|
+
*/
|
|
2
5
|
export interface IDragger {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the dragger. Use this name to activate dragger using
|
|
8
|
+
* {@link Viewer.setActiveDragger | Viewer.setActiveDragger()}
|
|
9
|
+
*/
|
|
3
10
|
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Initializes the dragger instance. Call {@link dispose | dispose()} to release allocated resources.
|
|
13
|
+
*
|
|
14
|
+
* This is internal method, called by the {@link Viewer} when the dragger is activated. Do not
|
|
15
|
+
* call this directly.
|
|
16
|
+
*/
|
|
4
17
|
initialize(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Releases resources allocated in the {@link initialize | initialize()}.
|
|
20
|
+
*
|
|
21
|
+
* This is internal method, called by the {@link Viewer} when the dragger is deactivated. Do
|
|
22
|
+
* not call this directly.
|
|
23
|
+
*/
|
|
5
24
|
dispose(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Updates the dragger preview if exists.
|
|
27
|
+
*
|
|
28
|
+
* This is internal method, called by the {@link Viewer} when it updates. Do not call this
|
|
29
|
+
* method directly unless you are manually updating the viewer.
|
|
30
|
+
*/
|
|
6
31
|
updatePreview(): void;
|
|
7
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Base class for the viewer draggers.
|
|
35
|
+
*
|
|
36
|
+
* To create your own dragger:
|
|
37
|
+
*
|
|
38
|
+
* 1. Define a dragger class inherited from Dragger.
|
|
39
|
+
* 2. Override {@link initialize | initialize()} method to add mouse event listeners using
|
|
40
|
+
* {@link Viewer.addEventListener | Viewer.addEventListener()}.
|
|
41
|
+
* 3. Define the dragger logic in listeners. For example, listen for the `mousemove` event and
|
|
42
|
+
* zoom in/out when the left mouse button is pressed.
|
|
43
|
+
* 4. Override {@link dispose | dispose()} method to remove mouse event listeners
|
|
44
|
+
* {@link Viewer.removeEventListener | Viewer.removeEventListener()}.
|
|
45
|
+
* 5. Register dragger class for the viewer instance using
|
|
46
|
+
* {@link Viewer.registerDragger | Viewer.registerDragger()}.
|
|
47
|
+
*/
|
|
8
48
|
export declare class Dragger implements IDragger {
|
|
9
49
|
name: string;
|
|
10
50
|
constructor(viewer: IViewer);
|
package/lib/viewer/IViewer.d.ts
CHANGED
|
@@ -8,22 +8,154 @@ import { IViewpoint } from "./IViewpoint";
|
|
|
8
8
|
* Viewer core interface.
|
|
9
9
|
*/
|
|
10
10
|
export interface IViewer extends IEventEmitter, ICommandService {
|
|
11
|
+
/**
|
|
12
|
+
* The `Client` instance that is used to load model reference files from the Open Cloud Server.
|
|
13
|
+
*/
|
|
11
14
|
client: Client | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Viewer options.
|
|
17
|
+
*/
|
|
12
18
|
options: IOptions;
|
|
19
|
+
/**
|
|
20
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
21
|
+
* for the viewer used to operate on. Defined only while the viewer is initialized.
|
|
22
|
+
*/
|
|
13
23
|
canvas: HTMLCanvasElement | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* List of canvas events, such as mouse events or
|
|
26
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Pointer_events#event_types_and_global_event_handlers | pointer events}
|
|
27
|
+
* or
|
|
28
|
+
* {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
29
|
+
* that the viewer should listen and redirect to the draggers and components.
|
|
30
|
+
*
|
|
31
|
+
* By default, the following events are redirected:
|
|
32
|
+
*
|
|
33
|
+
* - click
|
|
34
|
+
* - contextmenu
|
|
35
|
+
* - dblclick
|
|
36
|
+
* - mousedown
|
|
37
|
+
* - mouseleave
|
|
38
|
+
* - mousemove
|
|
39
|
+
* - mouseup
|
|
40
|
+
* - pointercancel
|
|
41
|
+
* - pointerdown
|
|
42
|
+
* - pointerleave
|
|
43
|
+
* - pointermove
|
|
44
|
+
* - pointerup
|
|
45
|
+
* - touchcancel
|
|
46
|
+
* - touchend
|
|
47
|
+
* - touchmove
|
|
48
|
+
* - touchstart
|
|
49
|
+
* - wheel
|
|
50
|
+
*/
|
|
14
51
|
canvasEvents: string[];
|
|
52
|
+
/**
|
|
53
|
+
* List of names of registered draggers.
|
|
54
|
+
*/
|
|
15
55
|
draggers: string[];
|
|
56
|
+
/**
|
|
57
|
+
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to
|
|
58
|
+
* release allocated resources.
|
|
59
|
+
*
|
|
60
|
+
* Fires:
|
|
61
|
+
*
|
|
62
|
+
* - {@link InitializeProgressEvent | initializeprogress}
|
|
63
|
+
*
|
|
64
|
+
* @param canvas -
|
|
65
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
66
|
+
* for the viewer used to operate on.
|
|
67
|
+
* @param onProgress - A callback function that handles events measuring progress of viewer
|
|
68
|
+
* initialization.
|
|
69
|
+
*/
|
|
16
70
|
initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
|
|
71
|
+
/**
|
|
72
|
+
* Unloads an open file, clears the canvas and markups, and releases resources allocated by
|
|
73
|
+
* this viewer instance. Call this method before release the `Viewer` instance.
|
|
74
|
+
*/
|
|
17
75
|
dispose(): this;
|
|
76
|
+
/**
|
|
77
|
+
* Returns `true` if viewer has been initialized.
|
|
78
|
+
*/
|
|
18
79
|
isInitialized(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Updates the viewer.
|
|
82
|
+
*
|
|
83
|
+
* Fires:
|
|
84
|
+
*
|
|
85
|
+
* - {@link UpdateEvent | update}
|
|
86
|
+
*
|
|
87
|
+
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
88
|
+
* animation frame. Default is `false`.
|
|
89
|
+
*/
|
|
19
90
|
update(force?: boolean): void;
|
|
20
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Loads a file from Open Cloud Server into the viewer.
|
|
93
|
+
*
|
|
94
|
+
* The file geometry data on the server must be converted into a format siutable for the viewer.
|
|
95
|
+
*
|
|
96
|
+
* This method requires a `Client` instance to be specified to load model reference files
|
|
97
|
+
* from the Open Cloud Server.
|
|
98
|
+
*
|
|
99
|
+
* Fires:
|
|
100
|
+
*
|
|
101
|
+
* - {@link OpenEvent | open}
|
|
102
|
+
* - {@link GeometryStartEvent | geometrystart}
|
|
103
|
+
* - {@link GeometryProgressEvent | geometryprogress}
|
|
104
|
+
* - {@link DatabaseChunkEvent | databasechunk}
|
|
105
|
+
* - {@link GeometryChunkEvent | geometrychunk}
|
|
106
|
+
* - {@link GeometryEndEvent | geometryend}
|
|
107
|
+
* - {@link GeometryErrorEvent | geometryerror}
|
|
108
|
+
*
|
|
109
|
+
* @param file - File, assembly or specific model to load. If a `File` instance with multiple
|
|
110
|
+
* models is specified, the default model will be loaded. If there is no default model,
|
|
111
|
+
* first availiable model will be loaded.
|
|
112
|
+
*/
|
|
113
|
+
open(file: Model | File | Assembly): Promise<this>;
|
|
114
|
+
/**
|
|
115
|
+
* Cancels asynchronous file loading started by {@link open | open()}.
|
|
116
|
+
*/
|
|
21
117
|
cancel(): this;
|
|
118
|
+
/**
|
|
119
|
+
* Unloads an open file, clears the canvas and markups.
|
|
120
|
+
*/
|
|
22
121
|
clear(): this;
|
|
122
|
+
/**
|
|
123
|
+
* Returns `true` if current opened model is 3D model.
|
|
124
|
+
*/
|
|
23
125
|
is3D(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the active dragger reference, or `null` if there is no active dragger.
|
|
128
|
+
*/
|
|
24
129
|
activeDragger(): IDragger | null;
|
|
130
|
+
/**
|
|
131
|
+
* Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
|
|
132
|
+
*
|
|
133
|
+
* Fires:
|
|
134
|
+
*
|
|
135
|
+
* - {@link ChangeActiveDraggerEvent | changeactivedragger}
|
|
136
|
+
*
|
|
137
|
+
* @param name - Dragger name. Can be one of the {@link draggers} list.
|
|
138
|
+
* @returns Returns the new active dragger reference or `null` if there is no dragger with
|
|
139
|
+
* the given name.
|
|
140
|
+
*/
|
|
25
141
|
setActiveDragger(name: string): IDragger | null;
|
|
142
|
+
/**
|
|
143
|
+
* Resets the state of the active dragger.
|
|
144
|
+
*/
|
|
26
145
|
resetActiveDragger(): void;
|
|
146
|
+
/**
|
|
147
|
+
* Sets the viewer state to the specified viewpoint.
|
|
148
|
+
*
|
|
149
|
+
* To get a list of available viewpoints from the server for a specific file, use the
|
|
150
|
+
* `File.getViewpoints()`.
|
|
151
|
+
*
|
|
152
|
+
* @param viewpoint - Viewpoint data.
|
|
153
|
+
*/
|
|
27
154
|
drawViewpoint(viewpoint: IViewpoint): void;
|
|
155
|
+
/**
|
|
156
|
+
* Saves the viewer state at the viewpoint.
|
|
157
|
+
*
|
|
158
|
+
* To save a viewpoint to the server for a specific file, use the `File.saveViewpoint()`.
|
|
159
|
+
*/
|
|
28
160
|
createViewpoint(): IViewpoint;
|
|
29
161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-core",
|
|
3
|
-
"version": "25.9.
|
|
3
|
+
"version": "25.9.3",
|
|
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.9.
|
|
29
|
+
"@inweb/eventemitter2": "~25.9.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@inweb/eventemitter2": "~25.9.
|
|
32
|
+
"@inweb/eventemitter2": "~25.9.3"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/commands/Commands.ts
CHANGED
|
@@ -68,6 +68,14 @@ class Commands implements ICommands {
|
|
|
68
68
|
|
|
69
69
|
const _commands = new Map<string, Commands>();
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Returns the command manager for the specified viewer type.
|
|
73
|
+
*
|
|
74
|
+
* @param viewerType - Viewer type. Predefined viewer types are:
|
|
75
|
+
*
|
|
76
|
+
* - VisualizeJS - The `VisualizeJS` powered viewer.
|
|
77
|
+
* - ThreeJS - The `Three.js` powered viewer.
|
|
78
|
+
*/
|
|
71
79
|
function commands(viewerType = ""): ICommands {
|
|
72
80
|
let result = _commands.get(viewerType);
|
|
73
81
|
if (!result) {
|
|
@@ -23,31 +23,116 @@
|
|
|
23
23
|
|
|
24
24
|
import { IViewer } from "../viewer/IViewer";
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Defines the command executer service interface.
|
|
28
|
+
*/
|
|
26
29
|
export interface ICommandService {
|
|
30
|
+
/**
|
|
31
|
+
* Executes the command denoted by the given command ID.
|
|
32
|
+
*
|
|
33
|
+
* To register your own command use the {@link ICommands.registerCommand | registerCommand()}
|
|
34
|
+
* method of the {@link commands} manager.
|
|
35
|
+
*
|
|
36
|
+
* @param id - ID of the command to execute.
|
|
37
|
+
* @param args - Parameters passed to the command handler function.
|
|
38
|
+
* @returns Returns the result of the command handler function. Returns `undefined` when the
|
|
39
|
+
* command doesn't exists.
|
|
40
|
+
*/
|
|
27
41
|
executeCommand(id: string, ...args: any[]): any;
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
export type ICommandsMap = Map<string, ICommand>;
|
|
31
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Defines the command handler function.
|
|
48
|
+
*/
|
|
32
49
|
export interface ICommandHandler {
|
|
50
|
+
/**
|
|
51
|
+
* @param viewer - Viewer instance that executes the command.
|
|
52
|
+
* @param args - Parameters passed to the command handler function.
|
|
53
|
+
*/
|
|
33
54
|
(viewer: any, ...args: any[]): any;
|
|
34
55
|
}
|
|
35
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Defines the command to execute by the {@link Viewer}.
|
|
59
|
+
*/
|
|
36
60
|
export interface ICommand {
|
|
61
|
+
/**
|
|
62
|
+
* Command ID.
|
|
63
|
+
*/
|
|
37
64
|
id: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Handler function.
|
|
68
|
+
*/
|
|
38
69
|
handler: ICommandHandler;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The `this` context used when invoking the handler function.
|
|
73
|
+
*/
|
|
39
74
|
thisArg?: any;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Command description.
|
|
78
|
+
*/
|
|
40
79
|
description?: ICommandDescription;
|
|
41
80
|
}
|
|
42
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Defines the command description.
|
|
84
|
+
*/
|
|
43
85
|
export interface ICommandDescription {
|
|
86
|
+
/**
|
|
87
|
+
* Command description string.
|
|
88
|
+
*/
|
|
44
89
|
readonly description: string;
|
|
45
90
|
}
|
|
46
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Define the viewer command manager interface.
|
|
94
|
+
*/
|
|
47
95
|
export interface ICommands {
|
|
96
|
+
/**
|
|
97
|
+
* Binds a command ID to a handler function. Registering a command with an existing ID twice
|
|
98
|
+
* overrides the existing handler.
|
|
99
|
+
*
|
|
100
|
+
* @param id - Unique ID for the command.
|
|
101
|
+
* @param handler - Command handler function.
|
|
102
|
+
* @param description - Command description.
|
|
103
|
+
* @param thisArg - The `this` context used when invoking the handler function.
|
|
104
|
+
*/
|
|
48
105
|
registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Registers an alias for a command.
|
|
109
|
+
*
|
|
110
|
+
* @param id - Unique ID for the command.
|
|
111
|
+
* @param alias - Command alias string.
|
|
112
|
+
*/
|
|
49
113
|
registerCommandAlias(id: string, alias: string): void;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns a list of registered commands.
|
|
117
|
+
*/
|
|
50
118
|
getCommands(): ICommandsMap;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns the specified command or `undefined` when the command doesn't exists.
|
|
122
|
+
*
|
|
123
|
+
* @param id - Command ID.
|
|
124
|
+
*/
|
|
51
125
|
getCommand(id: string): ICommand | undefined;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Executes the command denoted by the given command. If the command is not found, tries to
|
|
129
|
+
* set active dragger with the specified name.
|
|
130
|
+
*
|
|
131
|
+
* @param id - Command ID or dragger name.
|
|
132
|
+
* @param viewer - Viewer instance that wants to execute the command.
|
|
133
|
+
* @param args - Parameters passed to the command handler function.
|
|
134
|
+
* @returns Returns the result of the command handler function or new active dragger
|
|
135
|
+
* instance. Returns `undefined` if neither the command nor the dragger exists.
|
|
136
|
+
*/
|
|
52
137
|
executeCommand(id: string, viewer: IViewer, ...args: any[]): any;
|
|
53
138
|
}
|
package/src/viewer/IDragger.ts
CHANGED
|
@@ -23,13 +23,56 @@
|
|
|
23
23
|
|
|
24
24
|
import type { IViewer } from "./IViewer";
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Defines the dragger of the viewer.
|
|
28
|
+
*/
|
|
26
29
|
export interface IDragger {
|
|
30
|
+
/**
|
|
31
|
+
* The name of the dragger. Use this name to activate dragger using
|
|
32
|
+
* {@link Viewer.setActiveDragger | Viewer.setActiveDragger()}
|
|
33
|
+
*/
|
|
27
34
|
name: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Initializes the dragger instance. Call {@link dispose | dispose()} to release allocated resources.
|
|
38
|
+
*
|
|
39
|
+
* This is internal method, called by the {@link Viewer} when the dragger is activated. Do not
|
|
40
|
+
* call this directly.
|
|
41
|
+
*/
|
|
28
42
|
initialize(): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Releases resources allocated in the {@link initialize | initialize()}.
|
|
46
|
+
*
|
|
47
|
+
* This is internal method, called by the {@link Viewer} when the dragger is deactivated. Do
|
|
48
|
+
* not call this directly.
|
|
49
|
+
*/
|
|
29
50
|
dispose(): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Updates the dragger preview if exists.
|
|
54
|
+
*
|
|
55
|
+
* This is internal method, called by the {@link Viewer} when it updates. Do not call this
|
|
56
|
+
* method directly unless you are manually updating the viewer.
|
|
57
|
+
*/
|
|
30
58
|
updatePreview(): void;
|
|
31
59
|
}
|
|
32
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Base class for the viewer draggers.
|
|
63
|
+
*
|
|
64
|
+
* To create your own dragger:
|
|
65
|
+
*
|
|
66
|
+
* 1. Define a dragger class inherited from Dragger.
|
|
67
|
+
* 2. Override {@link initialize | initialize()} method to add mouse event listeners using
|
|
68
|
+
* {@link Viewer.addEventListener | Viewer.addEventListener()}.
|
|
69
|
+
* 3. Define the dragger logic in listeners. For example, listen for the `mousemove` event and
|
|
70
|
+
* zoom in/out when the left mouse button is pressed.
|
|
71
|
+
* 4. Override {@link dispose | dispose()} method to remove mouse event listeners
|
|
72
|
+
* {@link Viewer.removeEventListener | Viewer.removeEventListener()}.
|
|
73
|
+
* 5. Register dragger class for the viewer instance using
|
|
74
|
+
* {@link Viewer.registerDragger | Viewer.registerDragger()}.
|
|
75
|
+
*/
|
|
33
76
|
export class Dragger implements IDragger {
|
|
34
77
|
name = "";
|
|
35
78
|
|
package/src/viewer/IViewer.ts
CHANGED
|
@@ -32,28 +32,171 @@ import { IViewpoint } from "./IViewpoint";
|
|
|
32
32
|
* Viewer core interface.
|
|
33
33
|
*/
|
|
34
34
|
export interface IViewer extends IEventEmitter, ICommandService {
|
|
35
|
+
/**
|
|
36
|
+
* The `Client` instance that is used to load model reference files from the Open Cloud Server.
|
|
37
|
+
*/
|
|
35
38
|
client: Client | undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Viewer options.
|
|
42
|
+
*/
|
|
36
43
|
options: IOptions;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
47
|
+
* for the viewer used to operate on. Defined only while the viewer is initialized.
|
|
48
|
+
*/
|
|
37
49
|
canvas: HTMLCanvasElement | undefined;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* List of canvas events, such as mouse events or
|
|
53
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Pointer_events#event_types_and_global_event_handlers | pointer events}
|
|
54
|
+
* or
|
|
55
|
+
* {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
56
|
+
* that the viewer should listen and redirect to the draggers and components.
|
|
57
|
+
*
|
|
58
|
+
* By default, the following events are redirected:
|
|
59
|
+
*
|
|
60
|
+
* - click
|
|
61
|
+
* - contextmenu
|
|
62
|
+
* - dblclick
|
|
63
|
+
* - mousedown
|
|
64
|
+
* - mouseleave
|
|
65
|
+
* - mousemove
|
|
66
|
+
* - mouseup
|
|
67
|
+
* - pointercancel
|
|
68
|
+
* - pointerdown
|
|
69
|
+
* - pointerleave
|
|
70
|
+
* - pointermove
|
|
71
|
+
* - pointerup
|
|
72
|
+
* - touchcancel
|
|
73
|
+
* - touchend
|
|
74
|
+
* - touchmove
|
|
75
|
+
* - touchstart
|
|
76
|
+
* - wheel
|
|
77
|
+
*/
|
|
38
78
|
canvasEvents: string[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* List of names of registered draggers.
|
|
82
|
+
*/
|
|
39
83
|
draggers: string[];
|
|
40
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to
|
|
87
|
+
* release allocated resources.
|
|
88
|
+
*
|
|
89
|
+
* Fires:
|
|
90
|
+
*
|
|
91
|
+
* - {@link InitializeProgressEvent | initializeprogress}
|
|
92
|
+
*
|
|
93
|
+
* @param canvas -
|
|
94
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
95
|
+
* for the viewer used to operate on.
|
|
96
|
+
* @param onProgress - A callback function that handles events measuring progress of viewer
|
|
97
|
+
* initialization.
|
|
98
|
+
*/
|
|
41
99
|
initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Unloads an open file, clears the canvas and markups, and releases resources allocated by
|
|
103
|
+
* this viewer instance. Call this method before release the `Viewer` instance.
|
|
104
|
+
*/
|
|
42
105
|
dispose(): this;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Returns `true` if viewer has been initialized.
|
|
109
|
+
*/
|
|
43
110
|
isInitialized(): boolean;
|
|
44
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Updates the viewer.
|
|
114
|
+
*
|
|
115
|
+
* Fires:
|
|
116
|
+
*
|
|
117
|
+
* - {@link UpdateEvent | update}
|
|
118
|
+
*
|
|
119
|
+
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
120
|
+
* animation frame. Default is `false`.
|
|
121
|
+
*/
|
|
45
122
|
update(force?: boolean): void;
|
|
46
123
|
|
|
47
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Loads a file from Open Cloud Server into the viewer.
|
|
126
|
+
*
|
|
127
|
+
* The file geometry data on the server must be converted into a format siutable for the viewer.
|
|
128
|
+
*
|
|
129
|
+
* This method requires a `Client` instance to be specified to load model reference files
|
|
130
|
+
* from the Open Cloud Server.
|
|
131
|
+
*
|
|
132
|
+
* Fires:
|
|
133
|
+
*
|
|
134
|
+
* - {@link OpenEvent | open}
|
|
135
|
+
* - {@link GeometryStartEvent | geometrystart}
|
|
136
|
+
* - {@link GeometryProgressEvent | geometryprogress}
|
|
137
|
+
* - {@link DatabaseChunkEvent | databasechunk}
|
|
138
|
+
* - {@link GeometryChunkEvent | geometrychunk}
|
|
139
|
+
* - {@link GeometryEndEvent | geometryend}
|
|
140
|
+
* - {@link GeometryErrorEvent | geometryerror}
|
|
141
|
+
*
|
|
142
|
+
* @param file - File, assembly or specific model to load. If a `File` instance with multiple
|
|
143
|
+
* models is specified, the default model will be loaded. If there is no default model,
|
|
144
|
+
* first availiable model will be loaded.
|
|
145
|
+
*/
|
|
146
|
+
open(file: Model | File | Assembly): Promise<this>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Cancels asynchronous file loading started by {@link open | open()}.
|
|
150
|
+
*/
|
|
48
151
|
cancel(): this;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Unloads an open file, clears the canvas and markups.
|
|
155
|
+
*/
|
|
49
156
|
clear(): this;
|
|
50
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Returns `true` if current opened model is 3D model.
|
|
160
|
+
*/
|
|
51
161
|
is3D(): boolean;
|
|
52
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Returns the active dragger reference, or `null` if there is no active dragger.
|
|
165
|
+
*/
|
|
53
166
|
activeDragger(): IDragger | null;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
|
|
170
|
+
*
|
|
171
|
+
* Fires:
|
|
172
|
+
*
|
|
173
|
+
* - {@link ChangeActiveDraggerEvent | changeactivedragger}
|
|
174
|
+
*
|
|
175
|
+
* @param name - Dragger name. Can be one of the {@link draggers} list.
|
|
176
|
+
* @returns Returns the new active dragger reference or `null` if there is no dragger with
|
|
177
|
+
* the given name.
|
|
178
|
+
*/
|
|
54
179
|
setActiveDragger(name: string): IDragger | null;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Resets the state of the active dragger.
|
|
183
|
+
*/
|
|
55
184
|
resetActiveDragger(): void;
|
|
56
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Sets the viewer state to the specified viewpoint.
|
|
188
|
+
*
|
|
189
|
+
* To get a list of available viewpoints from the server for a specific file, use the
|
|
190
|
+
* `File.getViewpoints()`.
|
|
191
|
+
*
|
|
192
|
+
* @param viewpoint - Viewpoint data.
|
|
193
|
+
*/
|
|
57
194
|
drawViewpoint(viewpoint: IViewpoint): void;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Saves the viewer state at the viewpoint.
|
|
198
|
+
*
|
|
199
|
+
* To save a viewpoint to the server for a specific file, use the `File.saveViewpoint()`.
|
|
200
|
+
*/
|
|
58
201
|
createViewpoint(): IViewpoint;
|
|
59
202
|
}
|