@vertexvis/viewer 0.19.0-canary.3 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/cjs/{model-02ca23aa.js → model-b0f39263.js} +3 -2
  2. package/dist/cjs/model-b0f39263.js.map +1 -0
  3. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js +1 -1
  4. package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js +1 -1
  5. package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js.map +1 -1
  6. package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js +1 -1
  7. package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js.map +1 -1
  8. package/dist/collection/lib/keyBinding.js +2 -1
  9. package/dist/collection/lib/keyBinding.js.map +1 -1
  10. package/dist/components/vertex-viewer-walk-mode-tool.js.map +1 -1
  11. package/dist/components/viewer-teleport-tool.js +2 -1
  12. package/dist/components/viewer-teleport-tool.js.map +1 -1
  13. package/dist/esm/{model-278b9023.js → model-155eb2f5.js} +3 -2
  14. package/dist/esm/model-155eb2f5.js.map +1 -0
  15. package/dist/esm/vertex-viewer-teleport-tool.entry.js +1 -1
  16. package/dist/esm/vertex-viewer-walk-mode-tool.entry.js +1 -1
  17. package/dist/esm/vertex-viewer-walk-mode-tool.entry.js.map +1 -1
  18. package/dist/types/components/viewer-walk-mode-tool/viewer-walk-mode-tool.d.ts +4 -0
  19. package/dist/types/components.d.ts +2 -2
  20. package/dist/viewer/{p-0341e1de.entry.js → p-b21c2231.entry.js} +2 -2
  21. package/dist/viewer/{p-3d2d8431.entry.js → p-e735e66c.entry.js} +2 -2
  22. package/dist/viewer/{p-3d2d8431.entry.js.map → p-e735e66c.entry.js.map} +1 -1
  23. package/dist/viewer/p-f174e347.js +5 -0
  24. package/dist/viewer/p-f174e347.js.map +1 -0
  25. package/dist/viewer/viewer.esm.js +1 -1
  26. package/package.json +7 -7
  27. package/readme.md +4 -4
  28. package/dist/cjs/model-02ca23aa.js.map +0 -1
  29. package/dist/esm/model-278b9023.js.map +0 -1
  30. package/dist/viewer/p-4717fc39.js +0 -5
  31. package/dist/viewer/p-4717fc39.js.map +0 -1
  32. /package/dist/viewer/{p-0341e1de.entry.js.map → p-b21c2231.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["src/lib/walk-mode/dom.ts","src/lib/walk-mode/interactions.ts","src/components/viewer-walk-mode-tool/viewer-walk-mode-tool.css?tag=vertex-viewer-walk-mode-tool&encapsulation=shadow","src/components/viewer-walk-mode-tool/viewer-walk-mode-tool.tsx"],"names":["targetIsElement","target","Element","WalkInteractionHandler","[object Object]","model","this","pressed","handleKeyUp","async","event","key","toLocaleLowerCase","Object","keys","filter","k","reduce","assign","length","interval","endInteraction","clearInterval","_a","api","handleKeyDown","bind","handleEnabledChange","restartInteraction","updateCamera","handlers","ViewerWalkModeOperation","MOVE_DOWN","moveDown","MOVE_UP","moveUp","PIVOT_DOWN","pivotDown","PIVOT_LEFT","pivotLeft","PIVOT_RIGHT","pivotRight","PIVOT_UP","pivotUp","WALK_BACKWARD","walkBackward","WALK_FORWARD","walkForward","WALK_LEFT","walkLeft","WALK_RIGHT","walkRight","enabledChangeDisposable","onEnabledChange","keyBindingsChangeDisposable","onKeyBindingsChange","configurationChangeDisposable","onConfigurationChange","disable","dispose","_b","_c","window","removeEventListener","_","getEnabled","addEventListener","toLowerCase","exclude","isElementExcluded","repeat","tryBeginInteraction","enabled","enable","someOperationMatches","beginInteraction","isInteracting","setInterval","getKeyboardRepeatInterval","undefined","forEach","op","operationMatches","some","pivotCamera","getKeyboardPivotDegrees","walk","Vector3","scale","relativeWalkSpeed","forward","back","left","right","down","up","getKeyboardWalkSpeed","viewerWalkModeToolCss","ViewerWalkModeTool","hostRef","WalkModeModel","stateMap","setupController","setupInteractionHandler","ensureTeleportToolConfigured","updateTeleportTool","setPivotInteractionMode","clearInteractionHandler","resetInteractionMode","controller","setEnabled","toggleInteractionMode","controllerChanged","emit","h","Host","name","onSlotchange","WalkModeController","updateModel","interactionHandlerDisposable","interactionHandler","viewer","registerInteractionHandler","hostEl","slotted","querySelector","slottedTeleportTool","tagName","teleportTool","slot","_e","_d","shadowRoot","document","createElement","appendChild","mode","teleportMode","baseInteractionHandler","getBaseInteractionHandler","interactionType","getPrimaryInteractionType","previousPrimaryInteractionType","setPrimaryInteractionType"],"mappings":";;;uLAAgBA,EAAgBC,GAC9B,OAAOA,aAAkBC,cCMdC,EAWXC,YAA2BC,GAAAC,KAAAD,MAAAA,EAPnBC,KAAAC,QAAmC,GAgFnCD,KAAAE,YAAcC,MAAOC,IAC3B,MAAMC,EAAMD,EAAMC,IAAIC,oBAEtBN,KAAKC,QAAUM,OAAOC,KAAKR,KAAKC,SAC7BQ,QAAQC,GAAMA,IAAML,IACpBM,QAAO,CAACV,EAASS,IAACH,OAAAK,OAAAL,OAAAK,OAAA,GAAWX,GAAO,CAAEH,CAACY,GAAI,QAAS,IAEvD,GAAIH,OAAOC,KAAKR,KAAKC,SAASY,SAAW,GAAKb,KAAKc,UAAY,KAAM,CACnEd,KAAKe,mBAoCDf,KAAAe,eAAiBZ,gBACvBH,KAAKgB,uBACCC,EAAAjB,KAAKkB,OAAG,MAAAD,SAAA,OAAA,EAAAA,EAAEF,mBAtHhBf,KAAKmB,cAAgBnB,KAAKmB,cAAcC,KAAKpB,MAC7CA,KAAKE,YAAcF,KAAKE,YAAYkB,KAAKpB,MACzCA,KAAKqB,oBAAsBrB,KAAKqB,oBAAoBD,KAAKpB,MACzDA,KAAKsB,mBAAqBtB,KAAKsB,mBAAmBF,KAAKpB,MACvDA,KAAKuB,aAAevB,KAAKuB,aAAaH,KAAKpB,MAE3CA,KAAKwB,SAAW,CACd1B,CAAC2B,EAAwBC,WAAY1B,KAAK2B,SAASP,KAAKpB,MACxDF,CAAC2B,EAAwBG,SAAU5B,KAAK6B,OAAOT,KAAKpB,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,UAAM,MAAAnG,SAAA,OAAA,EAAAA,EAAEqH,6BAErB,GACED,GAA0B,MAC1BA,EAAuBG,8BAAgC,SACvDxI,KAAK+F,SAAS0C,gCAAkC,KAChD,CACAJ,EAAuBK,0BACrB1I,KAAK+F,SAAS0C,gCAEhBzI,KAAK+F,SAAS0C,+BAAiChE","sourcesContent":["export function targetIsElement(target: EventTarget | null): target is Element {\n return target instanceof Element;\n}\n","import { Vector3 } from '@vertexvis/geometry';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { InteractionApiPerspective, InteractionHandler } from '../interactions';\nimport { targetIsElement } from './dom';\nimport { ViewerWalkModeOperation, WalkModeModel } from './model';\n\nexport class WalkInteractionHandler implements InteractionHandler {\n private api?: InteractionApiPerspective;\n\n private interval?: NodeJS.Timer;\n private pressed: Record<string, boolean> = {};\n private handlers: Record<ViewerWalkModeOperation, VoidFunction>;\n\n private enabledChangeDisposable?: Disposable;\n private keyBindingsChangeDisposable?: Disposable;\n private configurationChangeDisposable?: Disposable;\n\n public constructor(private model: WalkModeModel) {\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n this.handleEnabledChange = this.handleEnabledChange.bind(this);\n this.restartInteraction = this.restartInteraction.bind(this);\n this.updateCamera = this.updateCamera.bind(this);\n\n this.handlers = {\n [ViewerWalkModeOperation.MOVE_DOWN]: this.moveDown.bind(this),\n [ViewerWalkModeOperation.MOVE_UP]: this.moveUp.bind(this),\n [ViewerWalkModeOperation.PIVOT_DOWN]: this.pivotDown.bind(this),\n [ViewerWalkModeOperation.PIVOT_LEFT]: this.pivotLeft.bind(this),\n [ViewerWalkModeOperation.PIVOT_RIGHT]: this.pivotRight.bind(this),\n [ViewerWalkModeOperation.PIVOT_UP]: this.pivotUp.bind(this),\n [ViewerWalkModeOperation.WALK_BACKWARD]: this.walkBackward.bind(this),\n [ViewerWalkModeOperation.WALK_FORWARD]: this.walkForward.bind(this),\n [ViewerWalkModeOperation.WALK_LEFT]: this.walkLeft.bind(this),\n [ViewerWalkModeOperation.WALK_RIGHT]: this.walkRight.bind(this),\n };\n\n this.enabledChangeDisposable = this.model.onEnabledChange(\n this.handleEnabledChange\n );\n this.keyBindingsChangeDisposable = this.model.onKeyBindingsChange(\n this.restartInteraction\n );\n this.configurationChangeDisposable = this.model.onConfigurationChange(\n this.restartInteraction\n );\n }\n\n public dispose(): void {\n this.disable();\n this.enabledChangeDisposable?.dispose();\n this.keyBindingsChangeDisposable?.dispose();\n this.configurationChangeDisposable?.dispose();\n\n window.removeEventListener('keydown', this.handleKeyDown);\n window.removeEventListener('keyup', this.handleKeyUp);\n }\n\n public initialize(_: HTMLElement, api: InteractionApiPerspective): void {\n this.api = api;\n\n this.handleEnabledChange(this.model.getEnabled());\n }\n\n public enable(): void {\n this.disable();\n\n window.addEventListener('keydown', this.handleKeyDown);\n window.addEventListener('keyup', this.handleKeyUp);\n }\n\n public disable(): void {\n window.removeEventListener('keydown', this.handleKeyDown);\n window.removeEventListener('keyup', this.handleKeyUp);\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n const key = event.key.toLowerCase();\n\n const exclude =\n targetIsElement(event.target) &&\n this.model.isElementExcluded(event.target);\n\n if (!event.repeat && !exclude) {\n this.pressed = { ...this.pressed, [key]: true };\n\n this.tryBeginInteraction();\n }\n }\n\n private handleKeyUp = async (event: KeyboardEvent): Promise<void> => {\n const key = event.key.toLocaleLowerCase();\n\n this.pressed = Object.keys(this.pressed)\n .filter((k) => k !== key)\n .reduce((pressed, k) => ({ ...pressed, [k]: true }), {});\n\n if (Object.keys(this.pressed).length === 0 && this.interval != null) {\n this.endInteraction();\n }\n };\n\n private handleEnabledChange(enabled: boolean): void {\n if (enabled) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n private restartInteraction(): void {\n this.clearInterval();\n this.tryBeginInteraction();\n }\n\n private tryBeginInteraction(): void {\n if (Object.keys(this.pressed).length > 0 && this.someOperationMatches()) {\n this.beginInteraction();\n }\n }\n\n private beginInteraction(): void {\n if (!this.api?.isInteracting()) {\n this.api?.beginInteraction();\n }\n\n if (this.interval == null) {\n this.interval = setInterval(\n this.updateCamera,\n this.model.getKeyboardRepeatInterval()\n );\n }\n }\n\n private endInteraction = async (): Promise<void> => {\n this.clearInterval();\n await this.api?.endInteraction();\n };\n\n private clearInterval(): void {\n if (this.interval != null) {\n clearInterval(this.interval);\n this.interval = undefined;\n }\n }\n\n private updateCamera(): void {\n Object.keys(this.handlers).forEach((key) => {\n const op = key as ViewerWalkModeOperation;\n\n if (this.model.operationMatches(op, this.pressed)) {\n this.handlers[op]();\n }\n });\n }\n\n private someOperationMatches(): boolean {\n return Object.keys(this.handlers).some((op) =>\n this.model.operationMatches(op as ViewerWalkModeOperation, this.pressed)\n );\n }\n\n private pivotLeft(): void {\n this.api?.pivotCamera(0, this.model.getKeyboardPivotDegrees());\n }\n\n private pivotRight(): void {\n this.api?.pivotCamera(0, -this.model.getKeyboardPivotDegrees());\n }\n\n private pivotUp(): void {\n this.api?.pivotCamera(-this.model.getKeyboardPivotDegrees(), 0);\n }\n\n private pivotDown(): void {\n this.api?.pivotCamera(this.model.getKeyboardPivotDegrees(), 0);\n }\n\n private walkForward(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.forward()));\n }\n\n private walkBackward(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.back()));\n }\n\n private walkLeft(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.left()));\n }\n\n private walkRight(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.right()));\n }\n\n private moveUp(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.down()));\n }\n\n private moveDown(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.up()));\n }\n\n private relativeWalkSpeed(): number {\n return this.model.getKeyboardWalkSpeed() / 500;\n }\n}\n",":host {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Host,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { InteractionType } from '../../lib/interactions/baseInteractionHandler';\nimport { WalkModeController } from '../../lib/walk-mode/controller';\nimport { WalkInteractionHandler } from '../../lib/walk-mode/interactions';\nimport { ViewerTeleportMode, WalkModeModel } from '../../lib/walk-mode/model';\n\ninterface StateMap {\n teleportTool?: HTMLVertexViewerTeleportToolElement;\n previousPrimaryInteractionType?: InteractionType;\n}\n\n/**\n * The `<vertex-viewer-walk-mode-tool>` allows for additional interactions\n * intended for walking through a model instead of orbiting a model.\n */\n@Component({\n tag: 'vertex-viewer-walk-mode-tool',\n styleUrl: 'viewer-walk-mode-tool.css',\n shadow: true,\n})\nexport class ViewerWalkModeTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The `WalkModeController` responsible for controlling `KeyBinding`s and excluded\n * elements, as well as updating the `WalkModeModel` with various configuration\n * settings.\n */\n @Prop({ mutable: true })\n public controller?: WalkModeController;\n\n /**\n * The `WalkModeModel` responsible for tracking configuration and emitting\n * events for interaction handlers to respond to.\n */\n @Prop({ mutable: true })\n public model: WalkModeModel = new WalkModeModel();\n\n /**\n * The type of teleportation to perform when clicking. This value is passed through\n * to a `<vertex-viewer-teleport-tool>`'s mode attribute.\n *\n * `teleport` - the camera's `position` is moved to the location of the hit result\n * constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `teleport-and-align` - the camera's `position`, `lookAt`, and `up` vectors are updated\n * to align to the plane represented by the hit result's position and normal.\n *\n * `undefined` - no teleportation will occur when clicking.\n *\n * Defaults to `undefined`.\n */\n @Prop()\n public teleportMode?: ViewerTeleportMode;\n\n /**\n * Determines whether the interaction handlers for this tool should respond to events.\n * When set to `true`, the default viewer interaction mode will be overridden to use the\n * `pivot` camera interaction type, keyboard controls for movement will be added, and\n * setting the `teleportMode` will enable the tool.\n *\n * Defaults to `true`.\n */\n @Prop()\n public enabled = true;\n\n /**\n * Event emitted when the `WalkModeController` associated with this tool changes.\n */\n @Event()\n public controllerChanged!: EventEmitter<WalkModeController>;\n\n @Element()\n private hostEl?: HTMLElement;\n\n private interactionHandlerDisposable?: Disposable;\n private interactionHandler?: WalkInteractionHandler;\n\n private stateMap: StateMap = {};\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n this.setupController();\n this.setupInteractionHandler();\n }\n\n /**\n * @ignore\n */\n protected async componentDidLoad(): Promise<void> {\n await this.ensureTeleportToolConfigured();\n this.updateTeleportTool();\n await this.setPivotInteractionMode();\n }\n\n /**\n * @ignore\n */\n protected connectedCallback(): void {\n this.setupInteractionHandler();\n this.setPivotInteractionMode();\n }\n\n /**\n * @ignore\n */\n protected disconnectedCallback(): void {\n this.clearInteractionHandler();\n this.resetInteractionMode();\n }\n\n /**\n * @ignore\n */\n @Watch('enabled')\n protected handleEnabledChanged(): void {\n this.controller?.setEnabled(this.enabled);\n this.toggleInteractionMode();\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(): void {\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n this.updateTeleportTool();\n this.toggleInteractionMode();\n }\n\n /**\n * @ignore\n */\n @Watch('teleportMode')\n protected handleTeleportModeChanged(): void {\n this.updateTeleportTool();\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChanged(): void {\n this.updateTeleportTool();\n this.controllerChanged.emit(this.controller);\n }\n\n /**\n * @ignore\n */\n @Watch('model')\n protected handleModelChanged(): void {\n this.setupController();\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n }\n\n protected render(): JSX.Element {\n return (\n <Host>\n <slot\n name=\"teleport-tool\"\n onSlotchange={async () => {\n await this.ensureTeleportToolConfigured();\n this.updateTeleportTool();\n }}\n ></slot>\n </Host>\n );\n }\n\n private setupController(): void {\n if (this.controller == null) {\n this.controller = new WalkModeController(this.model);\n this.controllerChanged.emit(this.controller);\n } else {\n this.controller.updateModel(this.model);\n }\n }\n\n private clearInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandlerDisposable = undefined;\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private async setupInteractionHandler(): Promise<void> {\n if (this.interactionHandler == null) {\n this.interactionHandler = new WalkInteractionHandler(this.model);\n\n this.interactionHandlerDisposable =\n await this.viewer?.registerInteractionHandler(this.interactionHandler);\n }\n }\n\n private async ensureTeleportToolConfigured(): Promise<void> {\n if (this.hostEl != null) {\n const slotted: Element | undefined =\n this.hostEl?.querySelector(\n 'vertex-viewer-teleport-tool[slot=\"teleport-tool\"]'\n ) ?? undefined;\n const slottedTeleportTool =\n slotted?.tagName === 'VERTEX-VIEWER-TELEPORT-TOOL'\n ? (slotted as HTMLVertexViewerTeleportToolElement)\n : undefined;\n\n if (slottedTeleportTool != null) {\n this.stateMap.teleportTool = slottedTeleportTool;\n } else {\n const slot: HTMLSlotElement | undefined =\n this.hostEl?.shadowRoot?.querySelector(\n 'slot[name=\"teleport-tool\"]'\n ) ?? undefined;\n\n this.stateMap.teleportTool = document.createElement(\n 'vertex-viewer-teleport-tool'\n );\n slot?.appendChild(this.stateMap.teleportTool);\n }\n }\n }\n\n private updateTeleportTool(): void {\n if (this.stateMap.teleportTool != null) {\n this.stateMap.teleportTool.viewer = this.viewer;\n this.stateMap.teleportTool.controller = this.controller;\n this.stateMap.teleportTool.model = this.model;\n this.stateMap.teleportTool.mode = this.teleportMode;\n }\n }\n\n private toggleInteractionMode(): void {\n if (this.enabled) {\n this.setPivotInteractionMode();\n } else {\n this.resetInteractionMode();\n }\n }\n\n private async setPivotInteractionMode(): Promise<void> {\n const baseInteractionHandler =\n await this.viewer?.getBaseInteractionHandler();\n\n if (this.enabled && baseInteractionHandler != null) {\n const interactionType =\n baseInteractionHandler.getPrimaryInteractionType();\n this.stateMap.previousPrimaryInteractionType =\n interactionType === 'pivot'\n ? this.stateMap.previousPrimaryInteractionType\n : interactionType;\n baseInteractionHandler.setPrimaryInteractionType('pivot');\n }\n }\n\n private async resetInteractionMode(): Promise<void> {\n const baseInteractionHandler =\n await this.viewer?.getBaseInteractionHandler();\n\n if (\n baseInteractionHandler != null &&\n baseInteractionHandler.getPrimaryInteractionType() === 'pivot' &&\n this.stateMap.previousPrimaryInteractionType != null\n ) {\n baseInteractionHandler.setPrimaryInteractionType(\n this.stateMap.previousPrimaryInteractionType\n );\n this.stateMap.previousPrimaryInteractionType = undefined;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["src/lib/walk-mode/dom.ts","src/lib/walk-mode/interactions.ts","src/components/viewer-walk-mode-tool/viewer-walk-mode-tool.css?tag=vertex-viewer-walk-mode-tool&encapsulation=shadow","src/components/viewer-walk-mode-tool/viewer-walk-mode-tool.tsx"],"names":["targetIsElement","target","Element","WalkInteractionHandler","[object Object]","model","this","pressed","handleKeyUp","async","event","key","toLocaleLowerCase","Object","keys","filter","k","reduce","assign","length","interval","endInteraction","clearInterval","_a","api","handleKeyDown","bind","handleEnabledChange","restartInteraction","updateCamera","handlers","ViewerWalkModeOperation","MOVE_DOWN","moveDown","MOVE_UP","moveUp","PIVOT_DOWN","pivotDown","PIVOT_LEFT","pivotLeft","PIVOT_RIGHT","pivotRight","PIVOT_UP","pivotUp","WALK_BACKWARD","walkBackward","WALK_FORWARD","walkForward","WALK_LEFT","walkLeft","WALK_RIGHT","walkRight","enabledChangeDisposable","onEnabledChange","keyBindingsChangeDisposable","onKeyBindingsChange","configurationChangeDisposable","onConfigurationChange","disable","dispose","_b","_c","window","removeEventListener","_","getEnabled","addEventListener","toLowerCase","exclude","isElementExcluded","repeat","tryBeginInteraction","enabled","enable","someOperationMatches","beginInteraction","isInteracting","setInterval","getKeyboardRepeatInterval","undefined","forEach","op","operationMatches","some","pivotCamera","getKeyboardPivotDegrees","walk","Vector3","scale","relativeWalkSpeed","forward","back","left","right","down","up","getKeyboardWalkSpeed","viewerWalkModeToolCss","ViewerWalkModeTool","hostRef","WalkModeModel","stateMap","setupController","setupInteractionHandler","ensureTeleportToolConfigured","updateTeleportTool","setPivotInteractionMode","clearInteractionHandler","resetInteractionMode","controller","setEnabled","toggleInteractionMode","controllerChanged","emit","h","Host","name","onSlotchange","WalkModeController","updateModel","interactionHandlerDisposable","interactionHandler","viewer","registerInteractionHandler","hostEl","slotted","querySelector","slottedTeleportTool","tagName","teleportTool","slot","_e","_d","shadowRoot","document","createElement","appendChild","mode","teleportMode","baseInteractionHandler","getBaseInteractionHandler","interactionType","getPrimaryInteractionType","previousPrimaryInteractionType","setPrimaryInteractionType"],"mappings":";;;uLAAgBA,EAAgBC,GAC9B,OAAOA,aAAkBC,cCMdC,EAWXC,YAA2BC,GAAAC,KAAAD,MAAAA,EAPnBC,KAAAC,QAAmC,GAgFnCD,KAAAE,YAAcC,MAAOC,IAC3B,MAAMC,EAAMD,EAAMC,IAAIC,oBAEtBN,KAAKC,QAAUM,OAAOC,KAAKR,KAAKC,SAC7BQ,QAAQC,GAAMA,IAAML,IACpBM,QAAO,CAACV,EAASS,IAACH,OAAAK,OAAAL,OAAAK,OAAA,GAAWX,GAAO,CAAEH,CAACY,GAAI,QAAS,IAEvD,GAAIH,OAAOC,KAAKR,KAAKC,SAASY,SAAW,GAAKb,KAAKc,UAAY,KAAM,CACnEd,KAAKe,mBAoCDf,KAAAe,eAAiBZ,gBACvBH,KAAKgB,uBACCC,EAAAjB,KAAKkB,OAAG,MAAAD,SAAA,OAAA,EAAAA,EAAEF,mBAtHhBf,KAAKmB,cAAgBnB,KAAKmB,cAAcC,KAAKpB,MAC7CA,KAAKE,YAAcF,KAAKE,YAAYkB,KAAKpB,MACzCA,KAAKqB,oBAAsBrB,KAAKqB,oBAAoBD,KAAKpB,MACzDA,KAAKsB,mBAAq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BAErB,GAAItI,KAAKkE,SAAWmE,GAA0B,KAAM,CAClD,MAAME,EACJF,EAAuBG,4BACzBxI,KAAK+F,SAAS0C,+BACZF,IAAoB,QAChBvI,KAAK+F,SAAS0C,+BACdF,EACNF,EAAuBK,0BAA0B,UAI7C5I,mCACN,MAAMuI,SACEpH,EAAAjB,KAAKoH,UAAM,MAAAnG,SAAA,OAAA,EAAAA,EAAEqH,6BAErB,GACED,GAA0B,MAC1BA,EAAuBG,8BAAgC,SACvDxI,KAAK+F,SAAS0C,gCAAkC,KAChD,CACAJ,EAAuBK,0BACrB1I,KAAK+F,SAAS0C,gCAEhBzI,KAAK+F,SAAS0C,+BAAiChE","sourcesContent":["export function targetIsElement(target: EventTarget | null): target is Element {\n return target instanceof Element;\n}\n","import { Vector3 } from '@vertexvis/geometry';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { InteractionApiPerspective, InteractionHandler } from '../interactions';\nimport { targetIsElement } from './dom';\nimport { ViewerWalkModeOperation, WalkModeModel } from './model';\n\nexport class WalkInteractionHandler implements InteractionHandler {\n private api?: InteractionApiPerspective;\n\n private interval?: NodeJS.Timer;\n private pressed: Record<string, boolean> = {};\n private handlers: Record<ViewerWalkModeOperation, VoidFunction>;\n\n private enabledChangeDisposable?: Disposable;\n private keyBindingsChangeDisposable?: Disposable;\n private configurationChangeDisposable?: Disposable;\n\n public constructor(private model: WalkModeModel) {\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n this.handleEnabledChange = this.handleEnabledChange.bind(this);\n this.restartInteraction = this.restartInteraction.bind(this);\n this.updateCamera = this.updateCamera.bind(this);\n\n this.handlers = {\n [ViewerWalkModeOperation.MOVE_DOWN]: this.moveDown.bind(this),\n [ViewerWalkModeOperation.MOVE_UP]: this.moveUp.bind(this),\n [ViewerWalkModeOperation.PIVOT_DOWN]: this.pivotDown.bind(this),\n [ViewerWalkModeOperation.PIVOT_LEFT]: this.pivotLeft.bind(this),\n [ViewerWalkModeOperation.PIVOT_RIGHT]: this.pivotRight.bind(this),\n [ViewerWalkModeOperation.PIVOT_UP]: this.pivotUp.bind(this),\n [ViewerWalkModeOperation.WALK_BACKWARD]: this.walkBackward.bind(this),\n [ViewerWalkModeOperation.WALK_FORWARD]: this.walkForward.bind(this),\n [ViewerWalkModeOperation.WALK_LEFT]: this.walkLeft.bind(this),\n [ViewerWalkModeOperation.WALK_RIGHT]: this.walkRight.bind(this),\n };\n\n this.enabledChangeDisposable = this.model.onEnabledChange(\n this.handleEnabledChange\n );\n this.keyBindingsChangeDisposable = this.model.onKeyBindingsChange(\n this.restartInteraction\n );\n this.configurationChangeDisposable = this.model.onConfigurationChange(\n this.restartInteraction\n );\n }\n\n public dispose(): void {\n this.disable();\n this.enabledChangeDisposable?.dispose();\n this.keyBindingsChangeDisposable?.dispose();\n this.configurationChangeDisposable?.dispose();\n\n window.removeEventListener('keydown', this.handleKeyDown);\n window.removeEventListener('keyup', this.handleKeyUp);\n }\n\n public initialize(_: HTMLElement, api: InteractionApiPerspective): void {\n this.api = api;\n\n this.handleEnabledChange(this.model.getEnabled());\n }\n\n public enable(): void {\n this.disable();\n\n window.addEventListener('keydown', this.handleKeyDown);\n window.addEventListener('keyup', this.handleKeyUp);\n }\n\n public disable(): void {\n window.removeEventListener('keydown', this.handleKeyDown);\n window.removeEventListener('keyup', this.handleKeyUp);\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n const key = event.key.toLowerCase();\n\n const exclude =\n targetIsElement(event.target) &&\n this.model.isElementExcluded(event.target);\n\n if (!event.repeat && !exclude) {\n this.pressed = { ...this.pressed, [key]: true };\n\n this.tryBeginInteraction();\n }\n }\n\n private handleKeyUp = async (event: KeyboardEvent): Promise<void> => {\n const key = event.key.toLocaleLowerCase();\n\n this.pressed = Object.keys(this.pressed)\n .filter((k) => k !== key)\n .reduce((pressed, k) => ({ ...pressed, [k]: true }), {});\n\n if (Object.keys(this.pressed).length === 0 && this.interval != null) {\n this.endInteraction();\n }\n };\n\n private handleEnabledChange(enabled: boolean): void {\n if (enabled) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n private restartInteraction(): void {\n this.clearInterval();\n this.tryBeginInteraction();\n }\n\n private tryBeginInteraction(): void {\n if (Object.keys(this.pressed).length > 0 && this.someOperationMatches()) {\n this.beginInteraction();\n }\n }\n\n private beginInteraction(): void {\n if (!this.api?.isInteracting()) {\n this.api?.beginInteraction();\n }\n\n if (this.interval == null) {\n this.interval = setInterval(\n this.updateCamera,\n this.model.getKeyboardRepeatInterval()\n );\n }\n }\n\n private endInteraction = async (): Promise<void> => {\n this.clearInterval();\n await this.api?.endInteraction();\n };\n\n private clearInterval(): void {\n if (this.interval != null) {\n clearInterval(this.interval);\n this.interval = undefined;\n }\n }\n\n private updateCamera(): void {\n Object.keys(this.handlers).forEach((key) => {\n const op = key as ViewerWalkModeOperation;\n\n if (this.model.operationMatches(op, this.pressed)) {\n this.handlers[op]();\n }\n });\n }\n\n private someOperationMatches(): boolean {\n return Object.keys(this.handlers).some((op) =>\n this.model.operationMatches(op as ViewerWalkModeOperation, this.pressed)\n );\n }\n\n private pivotLeft(): void {\n this.api?.pivotCamera(0, this.model.getKeyboardPivotDegrees());\n }\n\n private pivotRight(): void {\n this.api?.pivotCamera(0, -this.model.getKeyboardPivotDegrees());\n }\n\n private pivotUp(): void {\n this.api?.pivotCamera(-this.model.getKeyboardPivotDegrees(), 0);\n }\n\n private pivotDown(): void {\n this.api?.pivotCamera(this.model.getKeyboardPivotDegrees(), 0);\n }\n\n private walkForward(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.forward()));\n }\n\n private walkBackward(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.back()));\n }\n\n private walkLeft(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.left()));\n }\n\n private walkRight(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.right()));\n }\n\n private moveUp(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.down()));\n }\n\n private moveDown(): void {\n this.api?.walk(Vector3.scale(this.relativeWalkSpeed(), Vector3.up()));\n }\n\n private relativeWalkSpeed(): number {\n return this.model.getKeyboardWalkSpeed() / 500;\n }\n}\n",":host {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Host,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { InteractionType } from '../../lib/interactions/baseInteractionHandler';\nimport { WalkModeController } from '../../lib/walk-mode/controller';\nimport { WalkInteractionHandler } from '../../lib/walk-mode/interactions';\nimport { ViewerTeleportMode, WalkModeModel } from '../../lib/walk-mode/model';\n\ninterface StateMap {\n teleportTool?: HTMLVertexViewerTeleportToolElement;\n previousPrimaryInteractionType?: InteractionType;\n}\n\n/**\n * The `<vertex-viewer-walk-mode-tool>` allows for additional interactions\n * intended for walking through a model instead of orbiting a model.\n */\n@Component({\n tag: 'vertex-viewer-walk-mode-tool',\n styleUrl: 'viewer-walk-mode-tool.css',\n shadow: true,\n})\nexport class ViewerWalkModeTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The `WalkModeController` responsible for controlling `KeyBinding`s and excluded\n * elements, as well as updating the `WalkModeModel` with various configuration\n * settings.\n */\n @Prop({ mutable: true })\n public controller?: WalkModeController;\n\n /**\n * The `WalkModeModel` responsible for tracking configuration and emitting\n * events for interaction handlers to respond to.\n */\n @Prop({ mutable: true })\n public model: WalkModeModel = new WalkModeModel();\n\n /**\n * The type of teleportation to perform when clicking. This value is passed through\n * to a `<vertex-viewer-teleport-tool>`'s mode attribute.\n *\n * `teleport` - the camera's `position` is moved to the location of the hit result\n * constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `teleport-and-align` - the camera's `position`, `lookAt`, and `up` vectors are updated\n * to align to the plane represented by the hit result's position and normal.\n *\n * `teleport-toward` - the camera's `position` is moved a fixed distance toward the location of the\n * hit result constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `undefined` - no teleportation will occur when clicking.\n *\n * Defaults to `undefined`.\n */\n @Prop()\n public teleportMode?: ViewerTeleportMode;\n\n /**\n * Determines whether the interaction handlers for this tool should respond to events.\n * When set to `true`, the default viewer interaction mode will be overridden to use the\n * `pivot` camera interaction type, keyboard controls for movement will be added, and\n * setting the `teleportMode` will enable the tool.\n *\n * Defaults to `true`.\n */\n @Prop()\n public enabled = true;\n\n /**\n * Event emitted when the `WalkModeController` associated with this tool changes.\n */\n @Event()\n public controllerChanged!: EventEmitter<WalkModeController>;\n\n @Element()\n private hostEl?: HTMLElement;\n\n private interactionHandlerDisposable?: Disposable;\n private interactionHandler?: WalkInteractionHandler;\n\n private stateMap: StateMap = {};\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n this.setupController();\n this.setupInteractionHandler();\n }\n\n /**\n * @ignore\n */\n protected async componentDidLoad(): Promise<void> {\n await this.ensureTeleportToolConfigured();\n this.updateTeleportTool();\n await this.setPivotInteractionMode();\n }\n\n /**\n * @ignore\n */\n protected connectedCallback(): void {\n this.setupInteractionHandler();\n this.setPivotInteractionMode();\n }\n\n /**\n * @ignore\n */\n protected disconnectedCallback(): void {\n this.clearInteractionHandler();\n this.resetInteractionMode();\n }\n\n /**\n * @ignore\n */\n @Watch('enabled')\n protected handleEnabledChanged(): void {\n this.controller?.setEnabled(this.enabled);\n this.toggleInteractionMode();\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(): void {\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n this.updateTeleportTool();\n this.toggleInteractionMode();\n }\n\n /**\n * @ignore\n */\n @Watch('teleportMode')\n protected handleTeleportModeChanged(): void {\n this.updateTeleportTool();\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChanged(): void {\n this.updateTeleportTool();\n this.controllerChanged.emit(this.controller);\n }\n\n /**\n * @ignore\n */\n @Watch('model')\n protected handleModelChanged(): void {\n this.setupController();\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n }\n\n protected render(): JSX.Element {\n return (\n <Host>\n <slot\n name=\"teleport-tool\"\n onSlotchange={async () => {\n await this.ensureTeleportToolConfigured();\n this.updateTeleportTool();\n }}\n ></slot>\n </Host>\n );\n }\n\n private setupController(): void {\n if (this.controller == null) {\n this.controller = new WalkModeController(this.model);\n this.controllerChanged.emit(this.controller);\n } else {\n this.controller.updateModel(this.model);\n }\n }\n\n private clearInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandlerDisposable = undefined;\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private async setupInteractionHandler(): Promise<void> {\n if (this.interactionHandler == null) {\n this.interactionHandler = new WalkInteractionHandler(this.model);\n\n this.interactionHandlerDisposable =\n await this.viewer?.registerInteractionHandler(this.interactionHandler);\n }\n }\n\n private async ensureTeleportToolConfigured(): Promise<void> {\n if (this.hostEl != null) {\n const slotted: Element | undefined =\n this.hostEl?.querySelector(\n 'vertex-viewer-teleport-tool[slot=\"teleport-tool\"]'\n ) ?? undefined;\n const slottedTeleportTool =\n slotted?.tagName === 'VERTEX-VIEWER-TELEPORT-TOOL'\n ? (slotted as HTMLVertexViewerTeleportToolElement)\n : undefined;\n\n if (slottedTeleportTool != null) {\n this.stateMap.teleportTool = slottedTeleportTool;\n } else {\n const slot: HTMLSlotElement | undefined =\n this.hostEl?.shadowRoot?.querySelector(\n 'slot[name=\"teleport-tool\"]'\n ) ?? undefined;\n\n this.stateMap.teleportTool = document.createElement(\n 'vertex-viewer-teleport-tool'\n );\n slot?.appendChild(this.stateMap.teleportTool);\n }\n }\n }\n\n private updateTeleportTool(): void {\n if (this.stateMap.teleportTool != null) {\n this.stateMap.teleportTool.viewer = this.viewer;\n this.stateMap.teleportTool.controller = this.controller;\n this.stateMap.teleportTool.model = this.model;\n this.stateMap.teleportTool.mode = this.teleportMode;\n }\n }\n\n private toggleInteractionMode(): void {\n if (this.enabled) {\n this.setPivotInteractionMode();\n } else {\n this.resetInteractionMode();\n }\n }\n\n private async setPivotInteractionMode(): Promise<void> {\n const baseInteractionHandler =\n await this.viewer?.getBaseInteractionHandler();\n\n if (this.enabled && baseInteractionHandler != null) {\n const interactionType =\n baseInteractionHandler.getPrimaryInteractionType();\n this.stateMap.previousPrimaryInteractionType =\n interactionType === 'pivot'\n ? this.stateMap.previousPrimaryInteractionType\n : interactionType;\n baseInteractionHandler.setPrimaryInteractionType('pivot');\n }\n }\n\n private async resetInteractionMode(): Promise<void> {\n const baseInteractionHandler =\n await this.viewer?.getBaseInteractionHandler();\n\n if (\n baseInteractionHandler != null &&\n baseInteractionHandler.getPrimaryInteractionType() === 'pivot' &&\n this.stateMap.previousPrimaryInteractionType != null\n ) {\n baseInteractionHandler.setPrimaryInteractionType(\n this.stateMap.previousPrimaryInteractionType\n );\n this.stateMap.previousPrimaryInteractionType = undefined;\n }\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{E as t}from"./p-05d09319.js";class e{constructor(...t){this.bindings=t.map((t=>t.toLowerCase()))}matches(t){return this.bindings.length>0&&this.bindings.every((e=>this.bindingMatches(t,e)))}bindingMatches(t,e){const i=e.includes("!");const s=e.replace("!","");return i?!t[s]:t[s]}}class i{constructor(t){this.model=t;this.excludeTagNames=["VERTEX-SCENE-TREE","VERTEX-SCENE-TREE-SEARCH","VERTEX-VIEWER-PIN-TOOL","INPUT","TEXTAREA"];this.excludePredicates=[];this.updateModelExclusions()}updateModel(t){this.model=t}setEnabled(t){this.model.setEnabled(t)}setTeleportMode(t){this.model.setTeleportMode(t)}updateConfiguration(t){const e=this.model.getConfiguration();this.model.setConfiguration(Object.assign(Object.assign({},e),t))}addKeyBinding(t,...i){this.model.addKeyBinding(t,new e(...i))}replaceKeyBinding(t,...i){this.model.replaceKeyBinding(t,new e(...i))}excludeElement(...t){if(typeof t[0]==="string"){this.excludeTagNames=[...this.excludeTagNames,t[0]];this.updateModelExclusions();return{dispose:()=>{this.excludeTagNames=this.excludeTagNames.filter((e=>e!==t[0]))}}}else{this.excludePredicates=[...this.excludePredicates,t[0]];this.updateModelExclusions();return{dispose:()=>{this.excludePredicates=this.excludePredicates.filter((e=>e!==t[0]))}}}}updateModelExclusions(){this.model.setExcludedPredicate((t=>this.excludeTagNames.some((e=>e===t.tagName))||this.excludePredicates.some((e=>e(t)))))}}var s;(function(t){t["MOVE_DOWN"]="MOVE_DOWN";t["MOVE_UP"]="MOVE_UP";t["PIVOT_DOWN"]="PIVOT_DOWN";t["PIVOT_LEFT"]="PIVOT_LEFT";t["PIVOT_RIGHT"]="PIVOT_RIGHT";t["PIVOT_UP"]="PIVOT_UP";t["WALK_BACKWARD"]="WALK_BACKWARD";t["WALK_FORWARD"]="WALK_FORWARD";t["WALK_LEFT"]="WALK_LEFT";t["WALK_RIGHT"]="WALK_RIGHT"})(s||(s={}));class n{constructor(){this.keyBindings={[s.MOVE_DOWN]:[new e("PageDown","!Shift","!Alt")],[s.MOVE_UP]:[new e("PageUp","!Shift","!Alt")],[s.PIVOT_DOWN]:[new e("ArrowDown","!Shift","!Alt")],[s.PIVOT_LEFT]:[new e("ArrowLeft","!Shift","!Alt")],[s.PIVOT_RIGHT]:[new e("ArrowRight","!Shift","!Alt")],[s.PIVOT_UP]:[new e("ArrowUp","!Shift","!Alt")],[s.WALK_BACKWARD]:[new e("s")],[s.WALK_FORWARD]:[new e("w")],[s.WALK_LEFT]:[new e("a")],[s.WALK_RIGHT]:[new e("d")]};this.configuration={teleportHeightPercentage:11.75,teleportDistancePercentage:2,teleportCollisionDistance:1e3,keyboardWalkSpeed:5,keyboardPivotDegrees:1,keyboardRepeatIntervalMs:25};this.enabled=true;this.enabledChanged=new t;this.teleportModeChanged=new t;this.configurationChanged=new t;this.keyBindingsChanged=new t}setEnabled(t){this.enabled=t;this.enabledChanged.emit(t)}setTeleportMode(t){this.teleportMode=t;this.teleportModeChanged.emit(t)}setConfiguration(t){this.configuration=t;this.configurationChanged.emit(t)}addKeyBinding(t,e){this.keyBindings[t]=[...this.keyBindings[t],e];this.keyBindingsChanged.emit(this.keyBindings)}replaceKeyBinding(t,e){this.keyBindings[t]=[e];this.keyBindingsChanged.emit(this.keyBindings)}setExcludedPredicate(t){this.excludedPredicate=t}getEnabled(){return this.enabled}getTeleportMode(){return this.teleportMode}getTeleportHeightPercentage(){return this.configuration.teleportHeightPercentage}getKeyboardWalkSpeed(){return this.configuration.keyboardWalkSpeed}getKeyboardPivotDegrees(){return this.configuration.keyboardPivotDegrees}getKeyboardRepeatInterval(){return this.configuration.keyboardRepeatIntervalMs}getConfiguration(){return this.configuration}getKeyBindings(){return this.keyBindings}operationMatches(t,e){return this.keyBindings[t].some((t=>t.matches(e)))}isElementExcluded(t){var e;return!!((e=this.excludedPredicate)===null||e===void 0?void 0:e.call(this,t))}onEnabledChange(t){return this.enabledChanged.on(t)}onTeleportModeChange(t){return this.teleportModeChanged.on(t)}onConfigurationChange(t){return this.configurationChanged.on(t)}onKeyBindingsChange(t){return this.keyBindingsChanged.on(t)}}export{s as V,n as W,i as a};
5
+ //# sourceMappingURL=p-f174e347.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["src/lib/keyBinding.ts","src/lib/walk-mode/controller.ts","src/lib/walk-mode/model.ts"],"names":["KeyBinding","[object Object]","bindings","this","map","binding","toLowerCase","keys","length","every","bindingMatches","negated","includes","key","replace","WalkModeController","model","excludeTagNames","excludePredicates","updateModelExclusions","enabled","setEnabled","mode","setTeleportMode","configuration","existing","getConfiguration","setConfiguration","Object","assign","operation","addKeyBinding","replaceKeyBinding","args","dispose","filter","tn","setExcludedPredicate","el","some","tagName","p","ViewerWalkModeOperation","WalkModeModel","keyBindings","MOVE_DOWN","MOVE_UP","PIVOT_DOWN","PIVOT_LEFT","PIVOT_RIGHT","PIVOT_UP","WALK_BACKWARD","WALK_FORWARD","WALK_LEFT","WALK_RIGHT","teleportHeightPercentage","teleportDistancePercentage","teleportCollisionDistance","keyboardWalkSpeed","keyboardPivotDegrees","keyboardRepeatIntervalMs","enabledChanged","EventDispatcher","teleportModeChanged","configurationChanged","keyBindingsChanged","emit","teleportMode","keyBinding","predicate","excludedPredicate","state","matches","_a","call","listener","on"],"mappings":";;;0CAAaA,EAGXC,eAAsBC,GACpBC,KAAKD,SAAWA,EAASE,KAAKC,GAAYA,EAAQC,gBAG7CL,QAAQM,GACb,OACEJ,KAAKD,SAASM,OAAS,GACvBL,KAAKD,SAASO,OAAOJ,GAAYF,KAAKO,eAAeH,EAAMF,KAIvDJ,eACNM,EACAF,GAEA,MAAMM,EAAUN,EAAQO,SAAS,KACjC,MAAMC,EAAMR,EAAQS,QAAQ,IAAK,IAEjC,OAAOH,GAAWJ,EAAKM,GAAON,EAAKM,UCX1BE,EAWXd,YAA2Be,GAAAb,KAAAa,MAAAA,EAVnBb,KAAAc,gBAAiC,CACvC,oBACA,2BACA,yBACA,QACA,YAGMd,KAAAe,kBAAqD,GAG3Df,KAAKgB,wBAMAlB,YAAYe,GACjBb,KAAKa,MAAQA,EASRf,WAAWmB,GAChBjB,KAAKa,MAAMK,WAAWD,GAMjBnB,gBAAgBqB,GACrBnB,KAAKa,MAAMO,gBAAgBD,GAsCtBrB,oBACLuB,GAEA,MAAMC,EAAWtB,KAAKa,MAAMU,mBAE5BvB,KAAKa,MAAMW,iBAAgBC,OAAAC,OAAAD,OAAAC,OAAA,GACtBJ,GACAD,IASAvB,cACL6B,KACGvB,GAEHJ,KAAKa,MAAMe,cAAcD,EAAW,IAAI9B,KAAcO,IAkBjDN,kBACL6B,KACGvB,GAEHJ,KAAKa,MAAMgB,kBAAkBF,EAAW,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AKyC,YAGP3C,iBACL6B,EACAyC,GAEA,OAAOpE,KAAKyC,YAAYd,GAAWS,MAAMlC,GACvCA,EAAQmE,QAAQD,KAIbtE,kBAAkBqC,SACvB,UAASmC,EAAAtE,KAAKmE,qBAAiB,MAAAG,SAAA,OAAA,EAAAA,EAAAC,KAAtBvE,KAAyBmC,IAG7BrC,gBAAgB0E,GACrB,OAAOxE,KAAK0D,eAAee,GAAGD,GAGzB1E,qBACL0E,GAEA,OAAOxE,KAAK4D,oBAAoBa,GAAGD,GAG9B1E,sBACL0E,GAEA,OAAOxE,KAAK6D,qBAAqBY,GAAGD,GAG/B1E,oBACL0E,GAEA,OAAOxE,KAAK8D,mBAAmBW,GAAGD","sourcesContent":["export class KeyBinding {\n private bindings: string[];\n\n public constructor(...bindings: string[]) {\n this.bindings = bindings.map((binding) => binding.toLowerCase());\n }\n\n public matches(keys: Record<string, boolean>): boolean {\n return (\n this.bindings.length > 0 &&\n this.bindings.every((binding) => this.bindingMatches(keys, binding))\n );\n }\n\n private bindingMatches(\n keys: Record<string, boolean>,\n binding: string\n ): boolean {\n const negated = binding.includes('!');\n const key = binding.replace('!', '');\n\n return negated ? !keys[key] : keys[key];\n }\n}\n","import { Disposable } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\nimport {\n ViewerTeleportMode,\n ViewerWalkModeConfiguration,\n ViewerWalkModeOperation,\n WalkModeModel,\n} from './model';\n\nexport class WalkModeController {\n private excludeTagNames: Array<string> = [\n 'VERTEX-SCENE-TREE',\n 'VERTEX-SCENE-TREE-SEARCH',\n 'VERTEX-VIEWER-PIN-TOOL',\n 'INPUT',\n 'TEXTAREA',\n ];\n\n private excludePredicates: Array<(el: Element) => boolean> = [];\n\n public constructor(private model: WalkModeModel) {\n this.updateModelExclusions();\n }\n\n /**\n * @internal\n */\n public updateModel(model: WalkModeModel): void {\n this.model = model;\n }\n\n /**\n * Sets whether downstream walk mode interaction handlers are enabled.\n * Setting this value to `false` will remove all event listeners for\n * the interactions, and setting this value to `true` will add or\n * re-add the event listeners.\n */\n public setEnabled(enabled: boolean): void {\n this.model.setEnabled(enabled);\n }\n\n /**\n * Sets the `ViewerTeleportMode` to be used with a `<vertex-viewer-teleport-tool>`.\n */\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.model.setTeleportMode(mode);\n }\n\n /**\n * Updates the configuration for downstream walk mode interaction handlers.\n *\n * `teleportHeightPercentage` - percentage used for fine-tuning the distance to offset\n * the camera from a surface when performing a `teleport-and-align`. This percentage is\n * used alongside the shortest side of the visible bounding box to determine how far to\n * place the camera from the surface that has been hit, with a larger percentage placing\n * the camera further from the surface and vice-versa. Defaults to 11.75%.\n *\n * `teleportDistancePercentage` - percentage used for fine-tuning the distance moved per\n * click with the `teleport-toward` mode. This percentage is used alongside the longest\n * side of the visible bounding box to determine how far to move the camera's position\n * with each click, with a larger percentage moving the camera further and vice-versa.\n * Defaults to 2%.\n *\n * `teleportCollisionDistance` - distance used alongside the `teleportCollisionPercentage`\n * to determine whether a click with the `teleport-toward` mode would cause a \"collision\",\n * or would pass through the point clicked. If such a collision would occur, the camera is\n * instead placed this distance back from the point clicked once, then allowed to pass\n * through the point on subsequent clicks. Note that this will not apply if clicks occur\n * in quick succession without setting the `depthBuffers` property on the `<vertex-viewer>`\n * to `all` frames. Defaults to `1000`.\n *\n * `keyboardWalkSpeed` - speed to move the camera when performing keyboard-based\n * walk interactions. A larger number here will result in a faster walk speed through\n * the model and vice-versa. Defaults to `5`.\n *\n * `keyboardPivotDegrees` - number of degrees to move the camera when performing\n * keyboard-based pivot interactions. Defaults to `1`.\n *\n * `keyboardRepeatIntervalMs` - number of milliseconds to repeat keyboard-based interactions.\n * this value is multiplicative with the `keyboardWalkSpeed` and `keyboardPivotDegrees`, and\n * lower numbers will result in faster movement and vice-versa. Defaults to `25`.\n *\n */\n public updateConfiguration(\n configuration: Partial<ViewerWalkModeConfiguration>\n ): void {\n const existing = this.model.getConfiguration();\n\n this.model.setConfiguration({\n ...existing,\n ...configuration,\n });\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will append to the\n * existing set of keybindings to allow for multiple keybindings for a specific\n * operation. To replace the defaults, see `replaceKeyBinding`.\n */\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.addKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will replace any\n * existing keybindings to allow for overriding the default behavior.\n *\n * @example\n * ```\n * const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');\n *\n * // Remove keybinding for the `PIVOT_UP` operation\n * walkModeTool.controller.replaceKeyBinding('PIVOT_UP');\n *\n * // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`\n * walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');\n * ```\n */\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.replaceKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds an exclusion for specific elements when responding to keyboard\n * events. This is useful when there are other elements on screen that\n * require keyboard interaction and the walk mode handlers should not\n * respond to the keyboard events. Can be either a element's `tagName`\n * or a predicate. Returns a `Disposable` that can be used to remove the\n * exclusion.\n *\n * Default `tagName` exclusions:\n * 'VERTEX-SCENE-TREE'\n * 'VERTEX-SCENE-TREE-SEARCH'\n * 'VERTEX-VIEWER-PIN-TOOL'\n * 'INPUT'\n * 'TEXTAREA'\n */\n public excludeElement(predicate: (el: Element) => boolean): Disposable;\n public excludeElement(tagName: string): Disposable;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public excludeElement(...args: any[]): Disposable {\n if (typeof args[0] === 'string') {\n this.excludeTagNames = [...this.excludeTagNames, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludeTagNames = this.excludeTagNames.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n } else {\n this.excludePredicates = [...this.excludePredicates, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludePredicates = this.excludePredicates.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n }\n }\n\n private updateModelExclusions(): void {\n this.model.setExcludedPredicate(\n (el) =>\n this.excludeTagNames.some((tn) => tn === el.tagName) ||\n this.excludePredicates.some((p) => p(el))\n );\n }\n}\n","import { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\n\nexport interface ViewerWalkModeConfiguration {\n teleportHeightPercentage: number;\n teleportDistancePercentage: number;\n teleportCollisionDistance: number;\n keyboardWalkSpeed: number;\n keyboardPivotDegrees: number;\n keyboardRepeatIntervalMs: number;\n}\n\nexport type ViewerTeleportMode =\n | 'teleport'\n | 'teleport-and-align'\n | 'teleport-toward';\n\nexport enum ViewerWalkModeOperation {\n 'MOVE_DOWN' = 'MOVE_DOWN',\n 'MOVE_UP' = 'MOVE_UP',\n 'PIVOT_DOWN' = 'PIVOT_DOWN',\n 'PIVOT_LEFT' = 'PIVOT_LEFT',\n 'PIVOT_RIGHT' = 'PIVOT_RIGHT',\n 'PIVOT_UP' = 'PIVOT_UP',\n 'WALK_BACKWARD' = 'WALK_BACKWARD',\n 'WALK_FORWARD' = 'WALK_FORWARD',\n 'WALK_LEFT' = 'WALK_LEFT',\n 'WALK_RIGHT' = 'WALK_RIGHT',\n}\n\nexport type ViewerWalkModeKeyBindings = Record<\n ViewerWalkModeOperation,\n KeyBinding[]\n>;\n\nexport class WalkModeModel {\n private keyBindings: ViewerWalkModeKeyBindings = {\n [ViewerWalkModeOperation.MOVE_DOWN]: [\n new KeyBinding('PageDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.MOVE_UP]: [\n new KeyBinding('PageUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_DOWN]: [\n new KeyBinding('ArrowDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_LEFT]: [\n new KeyBinding('ArrowLeft', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_RIGHT]: [\n new KeyBinding('ArrowRight', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_UP]: [\n new KeyBinding('ArrowUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.WALK_BACKWARD]: [new KeyBinding('s')],\n [ViewerWalkModeOperation.WALK_FORWARD]: [new KeyBinding('w')],\n [ViewerWalkModeOperation.WALK_LEFT]: [new KeyBinding('a')],\n [ViewerWalkModeOperation.WALK_RIGHT]: [new KeyBinding('d')],\n };\n\n private configuration: ViewerWalkModeConfiguration = {\n teleportHeightPercentage: 11.75,\n teleportDistancePercentage: 2,\n teleportCollisionDistance: 1000,\n keyboardWalkSpeed: 5,\n keyboardPivotDegrees: 1,\n keyboardRepeatIntervalMs: 25,\n };\n\n private excludedPredicate?: (el: Element) => boolean;\n\n private enabled = true;\n private teleportMode?: ViewerTeleportMode;\n\n private enabledChanged: EventDispatcher<boolean> = new EventDispatcher();\n\n private teleportModeChanged: EventDispatcher<ViewerTeleportMode | undefined> =\n new EventDispatcher<ViewerTeleportMode | undefined>();\n\n private configurationChanged: EventDispatcher<ViewerWalkModeConfiguration> =\n new EventDispatcher<ViewerWalkModeConfiguration>();\n\n private keyBindingsChanged: EventDispatcher<ViewerWalkModeKeyBindings> =\n new EventDispatcher<ViewerWalkModeKeyBindings>();\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.enabledChanged.emit(enabled);\n }\n\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.teleportMode = mode;\n this.teleportModeChanged.emit(mode);\n }\n\n public setConfiguration(configuration: ViewerWalkModeConfiguration): void {\n this.configuration = configuration;\n this.configurationChanged.emit(configuration);\n }\n\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [...this.keyBindings[operation], keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public setExcludedPredicate(predicate: (el: Element) => boolean): void {\n this.excludedPredicate = predicate;\n }\n\n public getEnabled(): boolean {\n return this.enabled;\n }\n\n public getTeleportMode(): ViewerTeleportMode | undefined {\n return this.teleportMode;\n }\n\n public getTeleportHeightPercentage(): number {\n return this.configuration.teleportHeightPercentage;\n }\n\n public getKeyboardWalkSpeed(): number {\n return this.configuration.keyboardWalkSpeed;\n }\n\n public getKeyboardPivotDegrees(): number {\n return this.configuration.keyboardPivotDegrees;\n }\n\n public getKeyboardRepeatInterval(): number {\n return this.configuration.keyboardRepeatIntervalMs;\n }\n\n public getConfiguration(): ViewerWalkModeConfiguration {\n return this.configuration;\n }\n\n public getKeyBindings(): ViewerWalkModeKeyBindings {\n return this.keyBindings;\n }\n\n public operationMatches(\n operation: ViewerWalkModeOperation,\n state: Record<string, boolean>\n ): boolean {\n return this.keyBindings[operation].some((binding) =>\n binding.matches(state)\n );\n }\n\n public isElementExcluded(el: Element): boolean {\n return !!this.excludedPredicate?.(el);\n }\n\n public onEnabledChange(listener: Listener<boolean>): Disposable {\n return this.enabledChanged.on(listener);\n }\n\n public onTeleportModeChange(\n listener: Listener<ViewerTeleportMode | undefined>\n ): Disposable {\n return this.teleportModeChanged.on(listener);\n }\n\n public onConfigurationChange(\n listener: Listener<ViewerWalkModeConfiguration>\n ): Disposable {\n return this.configurationChanged.on(listener);\n }\n\n public onKeyBindingsChange(\n listener: Listener<ViewerWalkModeKeyBindings>\n ): Disposable {\n return this.keyBindingsChanged.on(listener);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{d as e,N as t,w as r,p as a,b as o}from"./p-50533a46.js";import{g as i}from"./p-146e5d45.js";import"./p-9acf99ad.js";const n=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const i="";const n={};if(i!==""){n.resourcesUrl=new URL(".",i).href}else{n.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,r.location.href)).href;{l(n.resourcesUrl,o)}if(!r.customElements){return __sc_import_viewer("./p-1afa84ed.js").then((()=>n))}}return a(n)};const l=(a,o)=>{const i=n(t);try{r[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const n=new Map;r[i]=t=>{const s=new URL(t,a).href;let l=n.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=o.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${i}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(r[i].m);t.remove()}}));n.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{i();return o(JSON.parse('[["p-d1e820c1",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-8e300190",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-a96559b7",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-f70fa80a",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-be78e8bd",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"stateMap":[32],"reset":[64]}]]],["p-0a837a9f",[[1,"vertex-viewer-view-cube",{"xPositiveLabel":[1,"x-positive-label"],"xNegativeLabel":[1,"x-negative-label"],"yPositiveLabel":[1,"y-positive-label"],"yNegativeLabel":[1,"y-negative-label"],"zPositiveLabel":[1,"z-positive-label"],"zNegativeLabel":[1,"z-negative-label"],"standardViewsOff":[4,"standard-views-off"],"animationDuration":[2,"animation-duration"],"triadOff":[4,"triad-off"],"worldOrientation":[1040],"camera":[1040],"viewer":[16],"boxLength":[32],"triadPosition":[32]}]]],["p-c2b7e86e",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-ac0160d1",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-4ddc5c2b",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-3d2d8431",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-0f9c6cbc",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"visibilityToggle":[4,"visibility-toggle"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"hoverController":[16]}]]],["p-7e6ce60f",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-f10a020b",[[1,"vertex-scene-tree-table-header"]]],["p-1ec5dc51",[[1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]]],["p-e9a6f6ff",[[1,"vertex-scene-tree-toolbar-group"]]],["p-f0d7dc62",[[1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1025,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1537,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"phantom":[16],"noDefaultLights":[4,"no-default-lights"],"experimentalRenderingOptions":[1,"experimental-rendering-options"],"featureLines":[16],"selectionHighlighting":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[64],"registerTapKeyInteraction":[64],"getInteractionTarget_DEPRECATED":[64],"addCursor":[64],"getInteractionHandlers":[64],"getKeyInteractions":[64],"getBaseInteractionHandler":[64],"getJwt":[64],"load":[64],"unload":[64],"scene":[64],"isSceneReady":[64]},[[0,"tap","handleTapEvent"]]]]],["p-33ef1574",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-10d63440",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-9a11b3c0",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"hovered":[1040]}]]],["p-369cf923",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]],["p-c8c7a500",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"invalidateStateCounter":[32]}]]],["p-452870c6",[[1,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-0341e1de",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-87d386a1",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-3ec43d9d",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-be6b15b3",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-13bf559e",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-a390c8a2",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-a66c938b",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-17ddabf6",[[1,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-e06e2d34",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]]]'),e)}));
4
+ import{d as e,N as t,w as r,p as a,b as o}from"./p-50533a46.js";import{g as i}from"./p-146e5d45.js";import"./p-9acf99ad.js";const n=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const i="";const n={};if(i!==""){n.resourcesUrl=new URL(".",i).href}else{n.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,r.location.href)).href;{l(n.resourcesUrl,o)}if(!r.customElements){return __sc_import_viewer("./p-1afa84ed.js").then((()=>n))}}return a(n)};const l=(a,o)=>{const i=n(t);try{r[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const n=new Map;r[i]=t=>{const s=new URL(t,a).href;let l=n.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=o.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${i}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(r[i].m);t.remove()}}));n.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{i();return o(JSON.parse('[["p-d1e820c1",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-8e300190",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-a96559b7",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-f70fa80a",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-be78e8bd",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"stateMap":[32],"reset":[64]}]]],["p-0a837a9f",[[1,"vertex-viewer-view-cube",{"xPositiveLabel":[1,"x-positive-label"],"xNegativeLabel":[1,"x-negative-label"],"yPositiveLabel":[1,"y-positive-label"],"yNegativeLabel":[1,"y-negative-label"],"zPositiveLabel":[1,"z-positive-label"],"zNegativeLabel":[1,"z-negative-label"],"standardViewsOff":[4,"standard-views-off"],"animationDuration":[2,"animation-duration"],"triadOff":[4,"triad-off"],"worldOrientation":[1040],"camera":[1040],"viewer":[16],"boxLength":[32],"triadPosition":[32]}]]],["p-c2b7e86e",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-ac0160d1",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-4ddc5c2b",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-e735e66c",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-0f9c6cbc",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"visibilityToggle":[4,"visibility-toggle"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"hoverController":[16]}]]],["p-7e6ce60f",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-f10a020b",[[1,"vertex-scene-tree-table-header"]]],["p-1ec5dc51",[[1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]]],["p-e9a6f6ff",[[1,"vertex-scene-tree-toolbar-group"]]],["p-f0d7dc62",[[1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1025,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1537,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"phantom":[16],"noDefaultLights":[4,"no-default-lights"],"experimentalRenderingOptions":[1,"experimental-rendering-options"],"featureLines":[16],"selectionHighlighting":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[64],"registerTapKeyInteraction":[64],"getInteractionTarget_DEPRECATED":[64],"addCursor":[64],"getInteractionHandlers":[64],"getKeyInteractions":[64],"getBaseInteractionHandler":[64],"getJwt":[64],"load":[64],"unload":[64],"scene":[64],"isSceneReady":[64]},[[0,"tap","handleTapEvent"]]]]],["p-33ef1574",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-10d63440",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-9a11b3c0",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"hovered":[1040]}]]],["p-369cf923",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]],["p-c8c7a500",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"invalidateStateCounter":[32]}]]],["p-452870c6",[[1,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-b21c2231",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-87d386a1",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-3ec43d9d",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-be6b15b3",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-13bf559e",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-a390c8a2",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-a66c938b",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-17ddabf6",[[1,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-e06e2d34",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]]]'),e)}));
5
5
  //# sourceMappingURL=viewer.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/viewer",
3
- "version": "0.19.0-canary.3",
3
+ "version": "0.19.0",
4
4
  "description": "The Vertex SDK for viewing models.",
5
5
  "license": "MIT",
6
6
  "author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
@@ -50,12 +50,12 @@
50
50
  "@stencil/core": "^2.16.1",
51
51
  "@types/classnames": "^2.3.1",
52
52
  "@vertexvis/frame-streaming-protos": "^0.10.5",
53
- "@vertexvis/geometry": "0.19.0-canary.3",
54
- "@vertexvis/html-templates": "0.19.0-canary.3",
53
+ "@vertexvis/geometry": "0.19.0",
54
+ "@vertexvis/html-templates": "0.19.0",
55
55
  "@vertexvis/scene-tree-protos": "^0.1.18",
56
56
  "@vertexvis/scene-view-protos": "^0.1.8",
57
- "@vertexvis/stream-api": "0.19.0-canary.3",
58
- "@vertexvis/utils": "0.19.0-canary.3",
57
+ "@vertexvis/stream-api": "0.19.0",
58
+ "@vertexvis/utils": "0.19.0",
59
59
  "@vertexvis/web-workers": "^0.1.0",
60
60
  "camel-case": "^4.1.2",
61
61
  "classnames": "^2.3.1",
@@ -82,7 +82,7 @@
82
82
  "@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
83
83
  "@vertexvis/rollup-plugin-web-workers": "^0.1.0",
84
84
  "@vertexvis/typescript-config-vertexvis": "1.1.0",
85
- "@vertexwebsdk/build": "0.19.0-canary.3",
85
+ "@vertexwebsdk/build": "0.19.0",
86
86
  "abortcontroller-polyfill": "^1.7.3",
87
87
  "chance": "^1.1.8",
88
88
  "eslint": "^8.17.0",
@@ -97,5 +97,5 @@
97
97
  "typedoc": "^0.22.17",
98
98
  "typescript": "^4.5.4"
99
99
  },
100
- "gitHead": "987c0d836eb13bab7b8439fd6bb7af6df70150dd"
100
+ "gitHead": "6a463531d436163280d20acc2d5d3053a11588fd"
101
101
  }
package/readme.md CHANGED
@@ -27,11 +27,11 @@ file that references our published JS bundles from a CDN.
27
27
  <head>
28
28
  <link
29
29
  rel="stylesheet"
30
- href="https://unpkg.com/@vertexvis/viewer@0.18.1/dist/viewer/viewer.css"
30
+ href="https://unpkg.com/@vertexvis/viewer@0.19.0/dist/viewer/viewer.css"
31
31
  />
32
32
  <script
33
33
  type="module"
34
- src="https://unpkg.com/@vertexvis/viewer@0.18.1/dist/viewer/viewer.esm.js"
34
+ src="https://unpkg.com/@vertexvis/viewer@0.19.0/dist/viewer/viewer.esm.js"
35
35
  ></script>
36
36
  </head>
37
37
 
@@ -53,7 +53,7 @@ These utilities can be imported from a CDN as shown below:
53
53
  </head>
54
54
  <body>
55
55
  <script type="module">
56
- import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.18.1/dist/esm/index.mjs';
56
+ import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.19.0/dist/esm/index.mjs';
57
57
 
58
58
  function main() {
59
59
  const color = ColorMaterial.fromHex('#ff0000');
@@ -90,7 +90,7 @@ dependency to your `package.json`:
90
90
  ```json
91
91
  {
92
92
  "dependencies": {
93
- "@vertexvis/viewer": "^0.18.1"
93
+ "@vertexvis/viewer": "^0.19.0"
94
94
  }
95
95
  }
96
96
  ```
@@ -1 +0,0 @@
1
- {"file":"model-02ca23aa.js","mappings":";;;;;;;MAAa,UAAU;EAGrB,YAAmB,GAAG,QAAkB;IACtC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;GAClE;EAEM,OAAO,CAAC,IAA6B;IAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;GAC7E;EAEO,cAAc,CACpB,IAA6B,EAC7B,OAAe;IAEf,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE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Operation","EventDispatcher"],"sources":["./src/lib/keyBinding.ts","./src/lib/walk-mode/controller.ts","./src/lib/walk-mode/model.ts"],"sourcesContent":["export class KeyBinding {\n private bindings: string[];\n\n public constructor(...bindings: string[]) {\n this.bindings = bindings.map((binding) => binding.toLowerCase());\n }\n\n public matches(keys: Record<string, boolean>): boolean {\n return this.bindings.every((binding) => this.bindingMatches(keys, binding));\n }\n\n private bindingMatches(\n keys: Record<string, boolean>,\n binding: string\n ): boolean {\n const negated = binding.includes('!');\n const key = binding.replace('!', '');\n\n return negated ? !keys[key] : keys[key];\n }\n}\n","import { Disposable } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\nimport {\n ViewerTeleportMode,\n ViewerWalkModeConfiguration,\n ViewerWalkModeOperation,\n WalkModeModel,\n} from './model';\n\nexport class WalkModeController {\n private excludeTagNames: Array<string> = [\n 'VERTEX-SCENE-TREE',\n 'VERTEX-SCENE-TREE-SEARCH',\n 'VERTEX-VIEWER-PIN-TOOL',\n 'INPUT',\n 'TEXTAREA',\n ];\n\n private excludePredicates: Array<(el: Element) => boolean> = [];\n\n public constructor(private model: WalkModeModel) {\n this.updateModelExclusions();\n }\n\n /**\n * @internal\n */\n public updateModel(model: WalkModeModel): void {\n this.model = model;\n }\n\n /**\n * Sets whether downstream walk mode interaction handlers are enabled.\n * Setting this value to `false` will remove all event listeners for\n * the interactions, and setting this value to `true` will add or\n * re-add the event listeners.\n */\n public setEnabled(enabled: boolean): void {\n this.model.setEnabled(enabled);\n }\n\n /**\n * Sets the `ViewerTeleportMode` to be used with a `<vertex-viewer-teleport-tool>`.\n */\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.model.setTeleportMode(mode);\n }\n\n /**\n * Updates the configuration for downstream walk mode interaction handlers.\n *\n * `teleportHeightPercentage` - percentage used for fine-tuning the distance to offset\n * the camera from a surface when performing a `teleport-and-align`. This percentage is\n * used alongside the shortest side of the visible bounding box to determine how far to\n * place the camera from the surface that has been hit, with a larger percentage placing\n * the camera further from the surface and vice-versa. Defaults to 11.75%.\n *\n * `teleportDistancePercentage` - percentage used for fine-tuning the distance moved per\n * click with the `teleport-toward` mode. This percentage is used alongside the longest\n * side of the visible bounding box to determine how far to move the camera's position\n * with each click, with a larger percentage moving the camera further and vice-versa.\n * Defaults to 2%.\n *\n * `teleportCollisionDistance` - distance used alongside the `teleportCollisionPercentage`\n * to determine whether a click with the `teleport-toward` mode would cause a \"collision\",\n * or would pass through the point clicked. If such a collision would occur, the camera is\n * instead placed this distance back from the point clicked once, then allowed to pass\n * through the point on subsequent clicks. Note that this will not apply if clicks occur\n * in quick succession without setting the `depthBuffers` property on the `<vertex-viewer>`\n * to `all` frames. Defaults to `1000`.\n *\n * `keyboardWalkSpeed` - speed to move the camera when performing keyboard-based\n * walk interactions. A larger number here will result in a faster walk speed through\n * the model and vice-versa. Defaults to `5`.\n *\n * `keyboardPivotDegrees` - number of degrees to move the camera when performing\n * keyboard-based pivot interactions. Defaults to `1`.\n *\n * `keyboardRepeatIntervalMs` - number of milliseconds to repeat keyboard-based interactions.\n * this value is multiplicative with the `keyboardWalkSpeed` and `keyboardPivotDegrees`, and\n * lower numbers will result in faster movement and vice-versa. Defaults to `25`.\n *\n */\n public updateConfiguration(\n configuration: Partial<ViewerWalkModeConfiguration>\n ): void {\n const existing = this.model.getConfiguration();\n\n this.model.setConfiguration({\n ...existing,\n ...configuration,\n });\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will append to the\n * existing set of keybindings to allow for multiple keybindings for a specific\n * operation. To replace the defaults, see `replaceKeyBinding`.\n */\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.addKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will replace any\n * existing keybindings to allow for overriding the default behavior.\n *\n * @example\n * ```\n * const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');\n *\n * // Remove keybinding for the `PIVOT_UP` operation\n * walkModeTool.controller.replaceKeyBinding('PIVOT_UP');\n *\n * // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`\n * walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');\n * ```\n */\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.replaceKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds an exclusion for specific elements when responding to keyboard\n * events. This is useful when there are other elements on screen that\n * require keyboard interaction and the walk mode handlers should not\n * respond to the keyboard events. Can be either a element's `tagName`\n * or a predicate. Returns a `Disposable` that can be used to remove the\n * exclusion.\n *\n * Default `tagName` exclusions:\n * 'VERTEX-SCENE-TREE'\n * 'VERTEX-SCENE-TREE-SEARCH'\n * 'VERTEX-VIEWER-PIN-TOOL'\n * 'INPUT'\n * 'TEXTAREA'\n */\n public excludeElement(predicate: (el: Element) => boolean): Disposable;\n public excludeElement(tagName: string): Disposable;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public excludeElement(...args: any[]): Disposable {\n if (typeof args[0] === 'string') {\n this.excludeTagNames = [...this.excludeTagNames, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludeTagNames = this.excludeTagNames.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n } else {\n this.excludePredicates = [...this.excludePredicates, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludePredicates = this.excludePredicates.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n }\n }\n\n private updateModelExclusions(): void {\n this.model.setExcludedPredicate(\n (el) =>\n this.excludeTagNames.some((tn) => tn === el.tagName) ||\n this.excludePredicates.some((p) => p(el))\n );\n }\n}\n","import { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\n\nexport interface ViewerWalkModeConfiguration {\n teleportHeightPercentage: number;\n teleportDistancePercentage: number;\n teleportCollisionDistance: number;\n keyboardWalkSpeed: number;\n keyboardPivotDegrees: number;\n keyboardRepeatIntervalMs: number;\n}\n\nexport type ViewerTeleportMode =\n | 'teleport'\n | 'teleport-and-align'\n | 'teleport-toward';\n\nexport enum ViewerWalkModeOperation {\n 'MOVE_DOWN' = 'MOVE_DOWN',\n 'MOVE_UP' = 'MOVE_UP',\n 'PIVOT_DOWN' = 'PIVOT_DOWN',\n 'PIVOT_LEFT' = 'PIVOT_LEFT',\n 'PIVOT_RIGHT' = 'PIVOT_RIGHT',\n 'PIVOT_UP' = 'PIVOT_UP',\n 'WALK_BACKWARD' = 'WALK_BACKWARD',\n 'WALK_FORWARD' = 'WALK_FORWARD',\n 'WALK_LEFT' = 'WALK_LEFT',\n 'WALK_RIGHT' = 'WALK_RIGHT',\n}\n\nexport type ViewerWalkModeKeyBindings = Record<\n ViewerWalkModeOperation,\n KeyBinding[]\n>;\n\nexport class WalkModeModel {\n private keyBindings: ViewerWalkModeKeyBindings = {\n [ViewerWalkModeOperation.MOVE_DOWN]: [\n new KeyBinding('PageDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.MOVE_UP]: [\n new KeyBinding('PageUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_DOWN]: [\n new KeyBinding('ArrowDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_LEFT]: [\n new KeyBinding('ArrowLeft', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_RIGHT]: [\n new KeyBinding('ArrowRight', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_UP]: [\n new KeyBinding('ArrowUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.WALK_BACKWARD]: [new KeyBinding('s')],\n [ViewerWalkModeOperation.WALK_FORWARD]: [new KeyBinding('w')],\n [ViewerWalkModeOperation.WALK_LEFT]: [new KeyBinding('a')],\n [ViewerWalkModeOperation.WALK_RIGHT]: [new KeyBinding('d')],\n };\n\n private configuration: ViewerWalkModeConfiguration = {\n teleportHeightPercentage: 11.75,\n teleportDistancePercentage: 2,\n teleportCollisionDistance: 1000,\n keyboardWalkSpeed: 5,\n keyboardPivotDegrees: 1,\n keyboardRepeatIntervalMs: 25,\n };\n\n private excludedPredicate?: (el: Element) => boolean;\n\n private enabled = true;\n private teleportMode?: ViewerTeleportMode;\n\n private enabledChanged: EventDispatcher<boolean> = new EventDispatcher();\n\n private teleportModeChanged: EventDispatcher<ViewerTeleportMode | undefined> =\n new EventDispatcher<ViewerTeleportMode | undefined>();\n\n private configurationChanged: EventDispatcher<ViewerWalkModeConfiguration> =\n new EventDispatcher<ViewerWalkModeConfiguration>();\n\n private keyBindingsChanged: EventDispatcher<ViewerWalkModeKeyBindings> =\n new EventDispatcher<ViewerWalkModeKeyBindings>();\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.enabledChanged.emit(enabled);\n }\n\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.teleportMode = mode;\n this.teleportModeChanged.emit(mode);\n }\n\n public setConfiguration(configuration: ViewerWalkModeConfiguration): void {\n this.configuration = configuration;\n this.configurationChanged.emit(configuration);\n }\n\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [...this.keyBindings[operation], keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public setExcludedPredicate(predicate: (el: Element) => boolean): void {\n this.excludedPredicate = predicate;\n }\n\n public getEnabled(): boolean {\n return this.enabled;\n }\n\n public getTeleportMode(): ViewerTeleportMode | undefined {\n return this.teleportMode;\n }\n\n public getTeleportHeightPercentage(): number {\n return this.configuration.teleportHeightPercentage;\n }\n\n public getKeyboardWalkSpeed(): number {\n return this.configuration.keyboardWalkSpeed;\n }\n\n public getKeyboardPivotDegrees(): number {\n return this.configuration.keyboardPivotDegrees;\n }\n\n public getKeyboardRepeatInterval(): number {\n return this.configuration.keyboardRepeatIntervalMs;\n }\n\n public getConfiguration(): ViewerWalkModeConfiguration {\n return this.configuration;\n }\n\n public getKeyBindings(): ViewerWalkModeKeyBindings {\n return this.keyBindings;\n }\n\n public operationMatches(\n operation: ViewerWalkModeOperation,\n state: Record<string, boolean>\n ): boolean {\n return this.keyBindings[operation].some((binding) =>\n binding.matches(state)\n );\n }\n\n public isElementExcluded(el: Element): boolean {\n return !!this.excludedPredicate?.(el);\n }\n\n public onEnabledChange(listener: Listener<boolean>): Disposable {\n return this.enabledChanged.on(listener);\n }\n\n public onTeleportModeChange(\n listener: Listener<ViewerTeleportMode | undefined>\n ): Disposable {\n return this.teleportModeChanged.on(listener);\n }\n\n public onConfigurationChange(\n listener: Listener<ViewerWalkModeConfiguration>\n ): Disposable {\n return this.configurationChanged.on(listener);\n }\n\n public onKeyBindingsChange(\n listener: Listener<ViewerWalkModeKeyBindings>\n ): Disposable {\n return this.keyBindingsChanged.on(listener);\n }\n}\n"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"model-278b9023.js","mappings":";;;;;MAAa,UAAU;EAGrB,YAAmB,GAAG,QAAkB;IACtC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;GAClE;EAEM,OAAO,CAAC,IAA6B;IAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;GAC7E;EAEO,cAAc,CACpB,IAA6B,EAC7B,OAAe;IAEf,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAA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","./src/lib/walk-mode/controller.ts","./src/lib/walk-mode/model.ts"],"sourcesContent":["export class KeyBinding {\n private bindings: string[];\n\n public constructor(...bindings: string[]) {\n this.bindings = bindings.map((binding) => binding.toLowerCase());\n }\n\n public matches(keys: Record<string, boolean>): boolean {\n return this.bindings.every((binding) => this.bindingMatches(keys, binding));\n }\n\n private bindingMatches(\n keys: Record<string, boolean>,\n binding: string\n ): boolean {\n const negated = binding.includes('!');\n const key = binding.replace('!', '');\n\n return negated ? !keys[key] : keys[key];\n }\n}\n","import { Disposable } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\nimport {\n ViewerTeleportMode,\n ViewerWalkModeConfiguration,\n ViewerWalkModeOperation,\n WalkModeModel,\n} from './model';\n\nexport class WalkModeController {\n private excludeTagNames: Array<string> = [\n 'VERTEX-SCENE-TREE',\n 'VERTEX-SCENE-TREE-SEARCH',\n 'VERTEX-VIEWER-PIN-TOOL',\n 'INPUT',\n 'TEXTAREA',\n ];\n\n private excludePredicates: Array<(el: Element) => boolean> = [];\n\n public constructor(private model: WalkModeModel) {\n this.updateModelExclusions();\n }\n\n /**\n * @internal\n */\n public updateModel(model: WalkModeModel): void {\n this.model = model;\n }\n\n /**\n * Sets whether downstream walk mode interaction handlers are enabled.\n * Setting this value to `false` will remove all event listeners for\n * the interactions, and setting this value to `true` will add or\n * re-add the event listeners.\n */\n public setEnabled(enabled: boolean): void {\n this.model.setEnabled(enabled);\n }\n\n /**\n * Sets the `ViewerTeleportMode` to be used with a `<vertex-viewer-teleport-tool>`.\n */\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.model.setTeleportMode(mode);\n }\n\n /**\n * Updates the configuration for downstream walk mode interaction handlers.\n *\n * `teleportHeightPercentage` - percentage used for fine-tuning the distance to offset\n * the camera from a surface when performing a `teleport-and-align`. This percentage is\n * used alongside the shortest side of the visible bounding box to determine how far to\n * place the camera from the surface that has been hit, with a larger percentage placing\n * the camera further from the surface and vice-versa. Defaults to 11.75%.\n *\n * `teleportDistancePercentage` - percentage used for fine-tuning the distance moved per\n * click with the `teleport-toward` mode. This percentage is used alongside the longest\n * side of the visible bounding box to determine how far to move the camera's position\n * with each click, with a larger percentage moving the camera further and vice-versa.\n * Defaults to 2%.\n *\n * `teleportCollisionDistance` - distance used alongside the `teleportCollisionPercentage`\n * to determine whether a click with the `teleport-toward` mode would cause a \"collision\",\n * or would pass through the point clicked. If such a collision would occur, the camera is\n * instead placed this distance back from the point clicked once, then allowed to pass\n * through the point on subsequent clicks. Note that this will not apply if clicks occur\n * in quick succession without setting the `depthBuffers` property on the `<vertex-viewer>`\n * to `all` frames. Defaults to `1000`.\n *\n * `keyboardWalkSpeed` - speed to move the camera when performing keyboard-based\n * walk interactions. A larger number here will result in a faster walk speed through\n * the model and vice-versa. Defaults to `5`.\n *\n * `keyboardPivotDegrees` - number of degrees to move the camera when performing\n * keyboard-based pivot interactions. Defaults to `1`.\n *\n * `keyboardRepeatIntervalMs` - number of milliseconds to repeat keyboard-based interactions.\n * this value is multiplicative with the `keyboardWalkSpeed` and `keyboardPivotDegrees`, and\n * lower numbers will result in faster movement and vice-versa. Defaults to `25`.\n *\n */\n public updateConfiguration(\n configuration: Partial<ViewerWalkModeConfiguration>\n ): void {\n const existing = this.model.getConfiguration();\n\n this.model.setConfiguration({\n ...existing,\n ...configuration,\n });\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will append to the\n * existing set of keybindings to allow for multiple keybindings for a specific\n * operation. To replace the defaults, see `replaceKeyBinding`.\n */\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.addKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will replace any\n * existing keybindings to allow for overriding the default behavior.\n *\n * @example\n * ```\n * const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');\n *\n * // Remove keybinding for the `PIVOT_UP` operation\n * walkModeTool.controller.replaceKeyBinding('PIVOT_UP');\n *\n * // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`\n * walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');\n * ```\n */\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.replaceKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds an exclusion for specific elements when responding to keyboard\n * events. This is useful when there are other elements on screen that\n * require keyboard interaction and the walk mode handlers should not\n * respond to the keyboard events. Can be either a element's `tagName`\n * or a predicate. Returns a `Disposable` that can be used to remove the\n * exclusion.\n *\n * Default `tagName` exclusions:\n * 'VERTEX-SCENE-TREE'\n * 'VERTEX-SCENE-TREE-SEARCH'\n * 'VERTEX-VIEWER-PIN-TOOL'\n * 'INPUT'\n * 'TEXTAREA'\n */\n public excludeElement(predicate: (el: Element) => boolean): Disposable;\n public excludeElement(tagName: string): Disposable;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public excludeElement(...args: any[]): Disposable {\n if (typeof args[0] === 'string') {\n this.excludeTagNames = [...this.excludeTagNames, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludeTagNames = this.excludeTagNames.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n } else {\n this.excludePredicates = [...this.excludePredicates, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludePredicates = this.excludePredicates.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n }\n }\n\n private updateModelExclusions(): void {\n this.model.setExcludedPredicate(\n (el) =>\n this.excludeTagNames.some((tn) => tn === el.tagName) ||\n this.excludePredicates.some((p) => p(el))\n );\n }\n}\n","import { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\n\nexport interface ViewerWalkModeConfiguration {\n teleportHeightPercentage: number;\n teleportDistancePercentage: number;\n teleportCollisionDistance: number;\n keyboardWalkSpeed: number;\n keyboardPivotDegrees: number;\n keyboardRepeatIntervalMs: number;\n}\n\nexport type ViewerTeleportMode =\n | 'teleport'\n | 'teleport-and-align'\n | 'teleport-toward';\n\nexport enum ViewerWalkModeOperation {\n 'MOVE_DOWN' = 'MOVE_DOWN',\n 'MOVE_UP' = 'MOVE_UP',\n 'PIVOT_DOWN' = 'PIVOT_DOWN',\n 'PIVOT_LEFT' = 'PIVOT_LEFT',\n 'PIVOT_RIGHT' = 'PIVOT_RIGHT',\n 'PIVOT_UP' = 'PIVOT_UP',\n 'WALK_BACKWARD' = 'WALK_BACKWARD',\n 'WALK_FORWARD' = 'WALK_FORWARD',\n 'WALK_LEFT' = 'WALK_LEFT',\n 'WALK_RIGHT' = 'WALK_RIGHT',\n}\n\nexport type ViewerWalkModeKeyBindings = Record<\n ViewerWalkModeOperation,\n KeyBinding[]\n>;\n\nexport class WalkModeModel {\n private keyBindings: ViewerWalkModeKeyBindings = {\n [ViewerWalkModeOperation.MOVE_DOWN]: [\n new KeyBinding('PageDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.MOVE_UP]: [\n new KeyBinding('PageUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_DOWN]: [\n new KeyBinding('ArrowDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_LEFT]: [\n new KeyBinding('ArrowLeft', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_RIGHT]: [\n new KeyBinding('ArrowRight', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_UP]: [\n new KeyBinding('ArrowUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.WALK_BACKWARD]: [new KeyBinding('s')],\n [ViewerWalkModeOperation.WALK_FORWARD]: [new KeyBinding('w')],\n [ViewerWalkModeOperation.WALK_LEFT]: [new KeyBinding('a')],\n [ViewerWalkModeOperation.WALK_RIGHT]: [new KeyBinding('d')],\n };\n\n private configuration: ViewerWalkModeConfiguration = {\n teleportHeightPercentage: 11.75,\n teleportDistancePercentage: 2,\n teleportCollisionDistance: 1000,\n keyboardWalkSpeed: 5,\n keyboardPivotDegrees: 1,\n keyboardRepeatIntervalMs: 25,\n };\n\n private excludedPredicate?: (el: Element) => boolean;\n\n private enabled = true;\n private teleportMode?: ViewerTeleportMode;\n\n private enabledChanged: EventDispatcher<boolean> = new EventDispatcher();\n\n private teleportModeChanged: EventDispatcher<ViewerTeleportMode | undefined> =\n new EventDispatcher<ViewerTeleportMode | undefined>();\n\n private configurationChanged: EventDispatcher<ViewerWalkModeConfiguration> =\n new EventDispatcher<ViewerWalkModeConfiguration>();\n\n private keyBindingsChanged: EventDispatcher<ViewerWalkModeKeyBindings> =\n new EventDispatcher<ViewerWalkModeKeyBindings>();\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.enabledChanged.emit(enabled);\n }\n\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.teleportMode = mode;\n this.teleportModeChanged.emit(mode);\n }\n\n public setConfiguration(configuration: ViewerWalkModeConfiguration): void {\n this.configuration = configuration;\n this.configurationChanged.emit(configuration);\n }\n\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [...this.keyBindings[operation], keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public setExcludedPredicate(predicate: (el: Element) => boolean): void {\n this.excludedPredicate = predicate;\n }\n\n public getEnabled(): boolean {\n return this.enabled;\n }\n\n public getTeleportMode(): ViewerTeleportMode | undefined {\n return this.teleportMode;\n }\n\n public getTeleportHeightPercentage(): number {\n return this.configuration.teleportHeightPercentage;\n }\n\n public getKeyboardWalkSpeed(): number {\n return this.configuration.keyboardWalkSpeed;\n }\n\n public getKeyboardPivotDegrees(): number {\n return this.configuration.keyboardPivotDegrees;\n }\n\n public getKeyboardRepeatInterval(): number {\n return this.configuration.keyboardRepeatIntervalMs;\n }\n\n public getConfiguration(): ViewerWalkModeConfiguration {\n return this.configuration;\n }\n\n public getKeyBindings(): ViewerWalkModeKeyBindings {\n return this.keyBindings;\n }\n\n public operationMatches(\n operation: ViewerWalkModeOperation,\n state: Record<string, boolean>\n ): boolean {\n return this.keyBindings[operation].some((binding) =>\n binding.matches(state)\n );\n }\n\n public isElementExcluded(el: Element): boolean {\n return !!this.excludedPredicate?.(el);\n }\n\n public onEnabledChange(listener: Listener<boolean>): Disposable {\n return this.enabledChanged.on(listener);\n }\n\n public onTeleportModeChange(\n listener: Listener<ViewerTeleportMode | undefined>\n ): Disposable {\n return this.teleportModeChanged.on(listener);\n }\n\n public onConfigurationChange(\n listener: Listener<ViewerWalkModeConfiguration>\n ): Disposable {\n return this.configurationChanged.on(listener);\n }\n\n public onKeyBindingsChange(\n listener: Listener<ViewerWalkModeKeyBindings>\n ): Disposable {\n return this.keyBindingsChanged.on(listener);\n }\n}\n"],"version":3}
@@ -1,5 +0,0 @@
1
- /*!
2
- * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
- */
4
- import{E as t}from"./p-05d09319.js";class e{constructor(...t){this.bindings=t.map((t=>t.toLowerCase()))}matches(t){return this.bindings.every((e=>this.bindingMatches(t,e)))}bindingMatches(t,e){const i=e.includes("!");const s=e.replace("!","");return i?!t[s]:t[s]}}class i{constructor(t){this.model=t;this.excludeTagNames=["VERTEX-SCENE-TREE","VERTEX-SCENE-TREE-SEARCH","VERTEX-VIEWER-PIN-TOOL","INPUT","TEXTAREA"];this.excludePredicates=[];this.updateModelExclusions()}updateModel(t){this.model=t}setEnabled(t){this.model.setEnabled(t)}setTeleportMode(t){this.model.setTeleportMode(t)}updateConfiguration(t){const e=this.model.getConfiguration();this.model.setConfiguration(Object.assign(Object.assign({},e),t))}addKeyBinding(t,...i){this.model.addKeyBinding(t,new e(...i))}replaceKeyBinding(t,...i){this.model.replaceKeyBinding(t,new e(...i))}excludeElement(...t){if(typeof t[0]==="string"){this.excludeTagNames=[...this.excludeTagNames,t[0]];this.updateModelExclusions();return{dispose:()=>{this.excludeTagNames=this.excludeTagNames.filter((e=>e!==t[0]))}}}else{this.excludePredicates=[...this.excludePredicates,t[0]];this.updateModelExclusions();return{dispose:()=>{this.excludePredicates=this.excludePredicates.filter((e=>e!==t[0]))}}}}updateModelExclusions(){this.model.setExcludedPredicate((t=>this.excludeTagNames.some((e=>e===t.tagName))||this.excludePredicates.some((e=>e(t)))))}}var s;(function(t){t["MOVE_DOWN"]="MOVE_DOWN";t["MOVE_UP"]="MOVE_UP";t["PIVOT_DOWN"]="PIVOT_DOWN";t["PIVOT_LEFT"]="PIVOT_LEFT";t["PIVOT_RIGHT"]="PIVOT_RIGHT";t["PIVOT_UP"]="PIVOT_UP";t["WALK_BACKWARD"]="WALK_BACKWARD";t["WALK_FORWARD"]="WALK_FORWARD";t["WALK_LEFT"]="WALK_LEFT";t["WALK_RIGHT"]="WALK_RIGHT"})(s||(s={}));class n{constructor(){this.keyBindings={[s.MOVE_DOWN]:[new e("PageDown","!Shift","!Alt")],[s.MOVE_UP]:[new e("PageUp","!Shift","!Alt")],[s.PIVOT_DOWN]:[new e("ArrowDown","!Shift","!Alt")],[s.PIVOT_LEFT]:[new e("ArrowLeft","!Shift","!Alt")],[s.PIVOT_RIGHT]:[new e("ArrowRight","!Shift","!Alt")],[s.PIVOT_UP]:[new e("ArrowUp","!Shift","!Alt")],[s.WALK_BACKWARD]:[new e("s")],[s.WALK_FORWARD]:[new e("w")],[s.WALK_LEFT]:[new e("a")],[s.WALK_RIGHT]:[new e("d")]};this.configuration={teleportHeightPercentage:11.75,teleportDistancePercentage:2,teleportCollisionDistance:1e3,keyboardWalkSpeed:5,keyboardPivotDegrees:1,keyboardRepeatIntervalMs:25};this.enabled=true;this.enabledChanged=new t;this.teleportModeChanged=new t;this.configurationChanged=new t;this.keyBindingsChanged=new t}setEnabled(t){this.enabled=t;this.enabledChanged.emit(t)}setTeleportMode(t){this.teleportMode=t;this.teleportModeChanged.emit(t)}setConfiguration(t){this.configuration=t;this.configurationChanged.emit(t)}addKeyBinding(t,e){this.keyBindings[t]=[...this.keyBindings[t],e];this.keyBindingsChanged.emit(this.keyBindings)}replaceKeyBinding(t,e){this.keyBindings[t]=[e];this.keyBindingsChanged.emit(this.keyBindings)}setExcludedPredicate(t){this.excludedPredicate=t}getEnabled(){return this.enabled}getTeleportMode(){return this.teleportMode}getTeleportHeightPercentage(){return this.configuration.teleportHeightPercentage}getKeyboardWalkSpeed(){return this.configuration.keyboardWalkSpeed}getKeyboardPivotDegrees(){return this.configuration.keyboardPivotDegrees}getKeyboardRepeatInterval(){return this.configuration.keyboardRepeatIntervalMs}getConfiguration(){return this.configuration}getKeyBindings(){return this.keyBindings}operationMatches(t,e){return this.keyBindings[t].some((t=>t.matches(e)))}isElementExcluded(t){var e;return!!((e=this.excludedPredicate)===null||e===void 0?void 0:e.call(this,t))}onEnabledChange(t){return this.enabledChanged.on(t)}onTeleportModeChange(t){return this.teleportModeChanged.on(t)}onConfigurationChange(t){return this.configurationChanged.on(t)}onKeyBindingsChange(t){return this.keyBindingsChanged.on(t)}}export{s as V,n as W,i as a};
5
- //# sourceMappingURL=p-4717fc39.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["src/lib/keyBinding.ts","src/lib/walk-mode/controller.ts","src/lib/walk-mode/model.ts"],"names":["KeyBinding","[object Object]","bindings","this","map","binding","toLowerCase","keys","every","bindingMatches","negated","includes","key","replace","WalkModeController","model","excludeTagNames","excludePredicates","updateModelExclusions","enabled","setEnabled","mode","setTeleportMode","configuration","existing","getConfiguration","setConfiguration","Object","assign","operation","addKeyBinding","replaceKeyBinding","args","dispose","filter","tn","setExcludedPredicate","el","some","tagName","p","ViewerWalkModeOperation","WalkModeModel","keyBindings","MOVE_DOWN","MOVE_UP","PIVOT_DOWN","PIVOT_LEFT","PIVOT_RIGHT","PIVOT_UP","WALK_BACKWARD","WALK_FORWARD","WALK_LEFT","WALK_RIGHT","teleportHeightPercentage","teleportDistancePercentage","teleportCollisionDistance","keyboardWalkSpeed","keyboardPivotDegrees","keyboardRepeatIntervalMs","enabledChanged","EventDispatcher","teleportModeChanged","configurationChanged","keyBindingsChanged","emit","teleportMode","keyBinding","predicate","excludedPredicate","state","matches","_a","call","listener","on"],"mappings":";;;0CAAaA,EAGXC,eAAsBC,GACpBC,KAAKD,SAAWA,EAASE,KAAKC,GAAYA,EAAQC,gBAG7CL,QAAQM,GACb,OAAOJ,KAAKD,SAASM,OAAOH,GAAYF,KAAKM,eAAeF,EAAMF,KAG5DJ,eACNM,EACAF,GAEA,MAAMK,EAAUL,EAAQM,SAAS,KACjC,MAAMC,EAAMP,EAAQQ,QAAQ,IAAK,IAEjC,OAAOH,GAAWH,EAAKK,GAAOL,EAAKK,UCR1BE,EAWXb,YAA2Bc,GAAAZ,KAAAY,MAAAA,EAVnBZ,KAAAa,gBAAiC,CACvC,oBACA,2BACA,yBACA,QACA,YAGMb,KAAAc,kBAAqD,GAG3Dd,KAAKe,wBAMAjB,YAAYc,GACjBZ,KAAKY,MAAQA,EASRd,WAAWkB,GAChBhB,KAAKY,MAAMK,WAAWD,GAMjBlB,gBAAgBoB,GACrBlB,KAAKY,MAAMO,gBAAgBD,GAsCtBpB,oBACLsB,GAEA,MAAMC,EAAWrB,KAAKY,MAAMU,mBAE5BtB,KAAKY,MAAMW,iBAAgBC,OAAAC,OAAAD,OAAAC,OAAA,GACtBJ,GACAD,IASAtB,cACL4B,KACGtB,GAEHJ,KAAKY,MAAMe,cAAcD,EAAW,IAAI7B,KAAcO,IAkBjDN,kBACL4B,KACGtB,GAEHJ,KAAKY,MAAMgB,kBAAkBF,EAAW,IAAI7B,KAAcO,IAqBrDN,kBAAkB+B,GACvB,UAAWA,EAAK,KAAO,SAAU,CAC/B7B,KAAKa,gBAAkB,IAAIb,KAAKa,gBAAiBgB,EAAK,IAEtD7B,KAAKe,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kE,qBAAiB,MAAAG,SAAA,OAAA,EAAAA,EAAAC,KAAtBtE,KAAyBkC,IAG7BpC,gBAAgByE,GACrB,OAAOvE,KAAKyD,eAAee,GAAGD,GAGzBzE,qBACLyE,GAEA,OAAOvE,KAAK2D,oBAAoBa,GAAGD,GAG9BzE,sBACLyE,GAEA,OAAOvE,KAAK4D,qBAAqBY,GAAGD,GAG/BzE,oBACLyE,GAEA,OAAOvE,KAAK6D,mBAAmBW,GAAGD","sourcesContent":["export class KeyBinding {\n private bindings: string[];\n\n public constructor(...bindings: string[]) {\n this.bindings = bindings.map((binding) => binding.toLowerCase());\n }\n\n public matches(keys: Record<string, boolean>): boolean {\n return this.bindings.every((binding) => this.bindingMatches(keys, binding));\n }\n\n private bindingMatches(\n keys: Record<string, boolean>,\n binding: string\n ): boolean {\n const negated = binding.includes('!');\n const key = binding.replace('!', '');\n\n return negated ? !keys[key] : keys[key];\n }\n}\n","import { Disposable } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\nimport {\n ViewerTeleportMode,\n ViewerWalkModeConfiguration,\n ViewerWalkModeOperation,\n WalkModeModel,\n} from './model';\n\nexport class WalkModeController {\n private excludeTagNames: Array<string> = [\n 'VERTEX-SCENE-TREE',\n 'VERTEX-SCENE-TREE-SEARCH',\n 'VERTEX-VIEWER-PIN-TOOL',\n 'INPUT',\n 'TEXTAREA',\n ];\n\n private excludePredicates: Array<(el: Element) => boolean> = [];\n\n public constructor(private model: WalkModeModel) {\n this.updateModelExclusions();\n }\n\n /**\n * @internal\n */\n public updateModel(model: WalkModeModel): void {\n this.model = model;\n }\n\n /**\n * Sets whether downstream walk mode interaction handlers are enabled.\n * Setting this value to `false` will remove all event listeners for\n * the interactions, and setting this value to `true` will add or\n * re-add the event listeners.\n */\n public setEnabled(enabled: boolean): void {\n this.model.setEnabled(enabled);\n }\n\n /**\n * Sets the `ViewerTeleportMode` to be used with a `<vertex-viewer-teleport-tool>`.\n */\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.model.setTeleportMode(mode);\n }\n\n /**\n * Updates the configuration for downstream walk mode interaction handlers.\n *\n * `teleportHeightPercentage` - percentage used for fine-tuning the distance to offset\n * the camera from a surface when performing a `teleport-and-align`. This percentage is\n * used alongside the shortest side of the visible bounding box to determine how far to\n * place the camera from the surface that has been hit, with a larger percentage placing\n * the camera further from the surface and vice-versa. Defaults to 11.75%.\n *\n * `teleportDistancePercentage` - percentage used for fine-tuning the distance moved per\n * click with the `teleport-toward` mode. This percentage is used alongside the longest\n * side of the visible bounding box to determine how far to move the camera's position\n * with each click, with a larger percentage moving the camera further and vice-versa.\n * Defaults to 2%.\n *\n * `teleportCollisionDistance` - distance used alongside the `teleportCollisionPercentage`\n * to determine whether a click with the `teleport-toward` mode would cause a \"collision\",\n * or would pass through the point clicked. If such a collision would occur, the camera is\n * instead placed this distance back from the point clicked once, then allowed to pass\n * through the point on subsequent clicks. Note that this will not apply if clicks occur\n * in quick succession without setting the `depthBuffers` property on the `<vertex-viewer>`\n * to `all` frames. Defaults to `1000`.\n *\n * `keyboardWalkSpeed` - speed to move the camera when performing keyboard-based\n * walk interactions. A larger number here will result in a faster walk speed through\n * the model and vice-versa. Defaults to `5`.\n *\n * `keyboardPivotDegrees` - number of degrees to move the camera when performing\n * keyboard-based pivot interactions. Defaults to `1`.\n *\n * `keyboardRepeatIntervalMs` - number of milliseconds to repeat keyboard-based interactions.\n * this value is multiplicative with the `keyboardWalkSpeed` and `keyboardPivotDegrees`, and\n * lower numbers will result in faster movement and vice-versa. Defaults to `25`.\n *\n */\n public updateConfiguration(\n configuration: Partial<ViewerWalkModeConfiguration>\n ): void {\n const existing = this.model.getConfiguration();\n\n this.model.setConfiguration({\n ...existing,\n ...configuration,\n });\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will append to the\n * existing set of keybindings to allow for multiple keybindings for a specific\n * operation. To replace the defaults, see `replaceKeyBinding`.\n */\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.addKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will replace any\n * existing keybindings to allow for overriding the default behavior.\n *\n * @example\n * ```\n * const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');\n *\n * // Remove keybinding for the `PIVOT_UP` operation\n * walkModeTool.controller.replaceKeyBinding('PIVOT_UP');\n *\n * // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`\n * walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');\n * ```\n */\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.replaceKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds an exclusion for specific elements when responding to keyboard\n * events. This is useful when there are other elements on screen that\n * require keyboard interaction and the walk mode handlers should not\n * respond to the keyboard events. Can be either a element's `tagName`\n * or a predicate. Returns a `Disposable` that can be used to remove the\n * exclusion.\n *\n * Default `tagName` exclusions:\n * 'VERTEX-SCENE-TREE'\n * 'VERTEX-SCENE-TREE-SEARCH'\n * 'VERTEX-VIEWER-PIN-TOOL'\n * 'INPUT'\n * 'TEXTAREA'\n */\n public excludeElement(predicate: (el: Element) => boolean): Disposable;\n public excludeElement(tagName: string): Disposable;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public excludeElement(...args: any[]): Disposable {\n if (typeof args[0] === 'string') {\n this.excludeTagNames = [...this.excludeTagNames, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludeTagNames = this.excludeTagNames.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n } else {\n this.excludePredicates = [...this.excludePredicates, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludePredicates = this.excludePredicates.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n }\n }\n\n private updateModelExclusions(): void {\n this.model.setExcludedPredicate(\n (el) =>\n this.excludeTagNames.some((tn) => tn === el.tagName) ||\n this.excludePredicates.some((p) => p(el))\n );\n }\n}\n","import { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\n\nexport interface ViewerWalkModeConfiguration {\n teleportHeightPercentage: number;\n teleportDistancePercentage: number;\n teleportCollisionDistance: number;\n keyboardWalkSpeed: number;\n keyboardPivotDegrees: number;\n keyboardRepeatIntervalMs: number;\n}\n\nexport type ViewerTeleportMode =\n | 'teleport'\n | 'teleport-and-align'\n | 'teleport-toward';\n\nexport enum ViewerWalkModeOperation {\n 'MOVE_DOWN' = 'MOVE_DOWN',\n 'MOVE_UP' = 'MOVE_UP',\n 'PIVOT_DOWN' = 'PIVOT_DOWN',\n 'PIVOT_LEFT' = 'PIVOT_LEFT',\n 'PIVOT_RIGHT' = 'PIVOT_RIGHT',\n 'PIVOT_UP' = 'PIVOT_UP',\n 'WALK_BACKWARD' = 'WALK_BACKWARD',\n 'WALK_FORWARD' = 'WALK_FORWARD',\n 'WALK_LEFT' = 'WALK_LEFT',\n 'WALK_RIGHT' = 'WALK_RIGHT',\n}\n\nexport type ViewerWalkModeKeyBindings = Record<\n ViewerWalkModeOperation,\n KeyBinding[]\n>;\n\nexport class WalkModeModel {\n private keyBindings: ViewerWalkModeKeyBindings = {\n [ViewerWalkModeOperation.MOVE_DOWN]: [\n new KeyBinding('PageDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.MOVE_UP]: [\n new KeyBinding('PageUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_DOWN]: [\n new KeyBinding('ArrowDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_LEFT]: [\n new KeyBinding('ArrowLeft', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_RIGHT]: [\n new KeyBinding('ArrowRight', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_UP]: [\n new KeyBinding('ArrowUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.WALK_BACKWARD]: [new KeyBinding('s')],\n [ViewerWalkModeOperation.WALK_FORWARD]: [new KeyBinding('w')],\n [ViewerWalkModeOperation.WALK_LEFT]: [new KeyBinding('a')],\n [ViewerWalkModeOperation.WALK_RIGHT]: [new KeyBinding('d')],\n };\n\n private configuration: ViewerWalkModeConfiguration = {\n teleportHeightPercentage: 11.75,\n teleportDistancePercentage: 2,\n teleportCollisionDistance: 1000,\n keyboardWalkSpeed: 5,\n keyboardPivotDegrees: 1,\n keyboardRepeatIntervalMs: 25,\n };\n\n private excludedPredicate?: (el: Element) => boolean;\n\n private enabled = true;\n private teleportMode?: ViewerTeleportMode;\n\n private enabledChanged: EventDispatcher<boolean> = new EventDispatcher();\n\n private teleportModeChanged: EventDispatcher<ViewerTeleportMode | undefined> =\n new EventDispatcher<ViewerTeleportMode | undefined>();\n\n private configurationChanged: EventDispatcher<ViewerWalkModeConfiguration> =\n new EventDispatcher<ViewerWalkModeConfiguration>();\n\n private keyBindingsChanged: EventDispatcher<ViewerWalkModeKeyBindings> =\n new EventDispatcher<ViewerWalkModeKeyBindings>();\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.enabledChanged.emit(enabled);\n }\n\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.teleportMode = mode;\n this.teleportModeChanged.emit(mode);\n }\n\n public setConfiguration(configuration: ViewerWalkModeConfiguration): void {\n this.configuration = configuration;\n this.configurationChanged.emit(configuration);\n }\n\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [...this.keyBindings[operation], keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public setExcludedPredicate(predicate: (el: Element) => boolean): void {\n this.excludedPredicate = predicate;\n }\n\n public getEnabled(): boolean {\n return this.enabled;\n }\n\n public getTeleportMode(): ViewerTeleportMode | undefined {\n return this.teleportMode;\n }\n\n public getTeleportHeightPercentage(): number {\n return this.configuration.teleportHeightPercentage;\n }\n\n public getKeyboardWalkSpeed(): number {\n return this.configuration.keyboardWalkSpeed;\n }\n\n public getKeyboardPivotDegrees(): number {\n return this.configuration.keyboardPivotDegrees;\n }\n\n public getKeyboardRepeatInterval(): number {\n return this.configuration.keyboardRepeatIntervalMs;\n }\n\n public getConfiguration(): ViewerWalkModeConfiguration {\n return this.configuration;\n }\n\n public getKeyBindings(): ViewerWalkModeKeyBindings {\n return this.keyBindings;\n }\n\n public operationMatches(\n operation: ViewerWalkModeOperation,\n state: Record<string, boolean>\n ): boolean {\n return this.keyBindings[operation].some((binding) =>\n binding.matches(state)\n );\n }\n\n public isElementExcluded(el: Element): boolean {\n return !!this.excludedPredicate?.(el);\n }\n\n public onEnabledChange(listener: Listener<boolean>): Disposable {\n return this.enabledChanged.on(listener);\n }\n\n public onTeleportModeChange(\n listener: Listener<ViewerTeleportMode | undefined>\n ): Disposable {\n return this.teleportModeChanged.on(listener);\n }\n\n public onConfigurationChange(\n listener: Listener<ViewerWalkModeConfiguration>\n ): Disposable {\n return this.configurationChanged.on(listener);\n }\n\n public onKeyBindingsChange(\n listener: Listener<ViewerWalkModeKeyBindings>\n ): Disposable {\n return this.keyBindingsChanged.on(listener);\n }\n}\n"]}