@vertexvis/viewer 1.0.2-canary.1 → 1.0.2-canary.2

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 (79) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/{multiElementInteractionHandler-DCKBIy58.js → multiElementInteractionHandler-BHvRKVIp.js} +20 -21
  3. package/dist/cjs/multiElementInteractionHandler-BHvRKVIp.js.map +1 -0
  4. package/dist/cjs/{queries-XG1IeRYE.js → queries-Da9I-xMf.js} +12 -12
  5. package/dist/cjs/queries-Da9I-xMf.js.map +1 -0
  6. package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
  7. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js +1 -1
  8. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js.map +1 -1
  9. package/dist/cjs/vertex-viewer.cjs.entry.js +27 -18
  10. package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
  11. package/dist/collection/lib/interactions/baseInteractionHandler.js +18 -19
  12. package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
  13. package/dist/collection/lib/interactions/interactionApi.js +17 -8
  14. package/dist/collection/lib/interactions/interactionApi.js.map +1 -1
  15. package/dist/collection/lib/interactions/mouseInteractions.js +8 -8
  16. package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
  17. package/dist/collection/lib/scenes/camera.js +10 -10
  18. package/dist/collection/lib/scenes/camera.js.map +1 -1
  19. package/dist/collection/lib/teleportation/interactions.js +1 -1
  20. package/dist/collection/lib/teleportation/interactions.js.map +1 -1
  21. package/dist/components/index.js +1 -1
  22. package/dist/components/{p-BR7cFxzj.js → p-3DqRAYgO.js} +2 -2
  23. package/dist/components/p-3DqRAYgO.js.map +1 -0
  24. package/dist/components/{p-Bkhr6gno.js → p-BCOD9yfw.js} +2 -2
  25. package/dist/components/p-CAugdB_8.js +5 -0
  26. package/dist/components/p-CAugdB_8.js.map +1 -0
  27. package/dist/components/p-CGCJ5hbJ.js +5 -0
  28. package/dist/components/p-CGCJ5hbJ.js.map +1 -0
  29. package/dist/components/vertex-viewer-dom-renderer.js +1 -1
  30. package/dist/components/vertex-viewer-pin-tool.js +1 -1
  31. package/dist/components/vertex-viewer-teleport-tool.js +1 -1
  32. package/dist/components/vertex-viewer-view-cube.js +1 -1
  33. package/dist/components/vertex-viewer-walk-mode-tool.js +1 -1
  34. package/dist/components/vertex-viewer.js +1 -1
  35. package/dist/components/vertex-viewer.js.map +1 -1
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/index.mjs +1 -1
  38. package/dist/esm/{multiElementInteractionHandler-C3A6SPxu.js → multiElementInteractionHandler-DwjL-r55.js} +20 -21
  39. package/dist/esm/multiElementInteractionHandler-DwjL-r55.js.map +1 -0
  40. package/dist/esm/{queries-CsBLqW1v.js → queries-DEzCmbTD.js} +12 -12
  41. package/dist/esm/queries-DEzCmbTD.js.map +1 -0
  42. package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
  43. package/dist/esm/vertex-viewer-teleport-tool.entry.js +1 -1
  44. package/dist/esm/vertex-viewer-teleport-tool.entry.js.map +1 -1
  45. package/dist/esm/vertex-viewer.entry.js +27 -18
  46. package/dist/esm/vertex-viewer.entry.js.map +1 -1
  47. package/dist/types/lib/interactions/baseInteractionHandler.d.ts +1 -1
  48. package/dist/types/lib/interactions/interactionApi.d.ts +2 -2
  49. package/dist/types/lib/interactions/mouseInteractions.d.ts +2 -2
  50. package/dist/types/lib/scenes/camera.d.ts +1 -0
  51. package/dist/viewer/index.esm.js +1 -1
  52. package/dist/viewer/p-07b99ac9.entry.js +5 -0
  53. package/dist/viewer/p-07b99ac9.entry.js.map +1 -0
  54. package/dist/viewer/{p-5ced98d5.entry.js → p-29d14611.entry.js} +2 -2
  55. package/dist/viewer/{p-72a0588f.entry.js → p-89544066.entry.js} +2 -2
  56. package/dist/viewer/p-89544066.entry.js.map +1 -0
  57. package/dist/viewer/p-D6eJC1q4.js +5 -0
  58. package/dist/viewer/p-D6eJC1q4.js.map +1 -0
  59. package/dist/viewer/{p-5U-3M0jx.js → p-EsKoKfmx.js} +2 -2
  60. package/dist/viewer/p-EsKoKfmx.js.map +1 -0
  61. package/dist/viewer/viewer.esm.js +1 -1
  62. package/package.json +7 -7
  63. package/dist/cjs/multiElementInteractionHandler-DCKBIy58.js.map +0 -1
  64. package/dist/cjs/queries-XG1IeRYE.js.map +0 -1
  65. package/dist/components/p-BQrJ-Yrs.js +0 -5
  66. package/dist/components/p-BQrJ-Yrs.js.map +0 -1
  67. package/dist/components/p-BR7cFxzj.js.map +0 -1
  68. package/dist/components/p-DizXmW54.js +0 -5
  69. package/dist/components/p-DizXmW54.js.map +0 -1
  70. package/dist/esm/multiElementInteractionHandler-C3A6SPxu.js.map +0 -1
  71. package/dist/esm/queries-CsBLqW1v.js.map +0 -1
  72. package/dist/viewer/p-5U-3M0jx.js.map +0 -1
  73. package/dist/viewer/p-72a0588f.entry.js.map +0 -1
  74. package/dist/viewer/p-77a0c7b7.entry.js +0 -5
  75. package/dist/viewer/p-77a0c7b7.entry.js.map +0 -1
  76. package/dist/viewer/p-CxLXWk2n.js +0 -5
  77. package/dist/viewer/p-CxLXWk2n.js.map +0 -1
  78. /package/dist/components/{p-Bkhr6gno.js.map → p-BCOD9yfw.js.map} +0 -0
  79. /package/dist/viewer/{p-5ced98d5.entry.js.map → p-29d14611.entry.js.map} +0 -0
@@ -260,31 +260,30 @@ export class BaseInteractionHandler {
260
260
  }
261
261
  }
262
262
  wheelDeltaToPixels(deltaY, deltaMode) {
263
- if (this.computedBodyStyle == null) {
264
- this.computedBodyStyle = window.getComputedStyle(document.body);
263
+ // Cached values are an optimization we can use given mouseWheel
264
+ // events can happen dozen or hundreds of times per scroll, but body style
265
+ // is very unlikely to change frequently or while doing wheel movements.
266
+ if (this.bodyStyleCache == null) {
267
+ const bodyStyle = window.getComputedStyle(document.body);
268
+ this.bodyStyleCache = {
269
+ fontSize: parseFloat(bodyStyle.getPropertyValue('fontSize')) ||
270
+ DEFAULT_FONT_SIZE,
271
+ lineHeight: parseFloat(bodyStyle.getPropertyValue('lineHeight')) ||
272
+ DEFAULT_LINE_HEIGHT,
273
+ height: parseFloat(bodyStyle.getPropertyValue('height')) ||
274
+ window.innerHeight,
275
+ };
276
+ window.setTimeout(() => {
277
+ this.bodyStyleCache = undefined;
278
+ }, 4800); // For now hardcoded. Could be derived. eg mouseWheelInteractionEndDebounce * 12
265
279
  }
266
- const defaultLineHeight = this.computedBodyStyle.getPropertyValue('fontSize') != null &&
267
- this.computedBodyStyle.getPropertyValue('fontSize') !== '' &&
268
- !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('fontSize')))
269
- ? parseFloat(this.computedBodyStyle.getPropertyValue('fontSize')) *
270
- DEFAULT_LINE_HEIGHT
271
- : DEFAULT_FONT_SIZE * DEFAULT_LINE_HEIGHT;
272
280
  if (deltaMode === 1) {
273
281
  // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines
274
- return this.computedBodyStyle.getPropertyValue('lineHeight') != null &&
275
- this.computedBodyStyle.getPropertyValue('lineHeight') !== '' &&
276
- !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('lineHeight')))
277
- ? deltaY *
278
- parseFloat(this.computedBodyStyle.getPropertyValue('lineHeight'))
279
- : deltaY * defaultLineHeight;
282
+ return (deltaY * (this.bodyStyleCache.fontSize * this.bodyStyleCache.lineHeight));
280
283
  }
281
284
  else if (deltaMode === 2) {
282
285
  // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages
283
- return this.computedBodyStyle.getPropertyValue('height') != null &&
284
- this.computedBodyStyle.getPropertyValue('height') !== '' &&
285
- !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('height')))
286
- ? deltaY * parseFloat(this.computedBodyStyle.getPropertyValue('height'))
287
- : deltaY * window.innerHeight;
286
+ return deltaY * this.bodyStyleCache.height;
288
287
  }
289
288
  // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels
290
289
  return deltaY;
@@ -1 +1 @@
1
- {"version":3,"file":"baseInteractionHandler.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/baseInteractionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAc,eAAe,EAAY,MAAM,kBAAkB,CAAC;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAsBhD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,OAAgB,sBAAsB;IAoB1C,YACY,SAAsC,EACtC,OAAgC,EAChC,SAAsC,EACxC,iBAAoC,EACpC,sBAA8C,EAC9C,eAAgC,EAChC,cAA8B,EAC9B,gBAAkC,EAClC,gBAAkC,EAClC,SAAyB;QATvB,cAAS,GAAT,SAAS,CAA6B;QACtC,YAAO,GAAP,OAAO,CAAyB;QAChC,cAAS,GAAT,SAAS,CAA6B;QACxC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,oBAAe,GAAf,eAAe,CAAiB;QAChC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,cAAS,GAAT,SAAS,CAAgB;QArB3B,eAAU,GAAG,KAAK,CAAC;QAGnB,qBAAgB,GAAG,KAAK,CAAC;QAEvB,kCAA6B,GAAG,KAAK,CAAC;QAIxC,iCAA4B,GAAG,IAAI,eAAe,EAAQ,CAAC;QAcjE,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,gBAAgB,G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AQ,CAAC,KAAK,EAAE;gBACxD,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACrE,CAAC,CAAC,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;gBACxE,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC;QAClC,CAAC;QACD,8EAA8E;QAC9E,OAAO,MAAM,CAAC;IAChB,CAAC;IAES,iBAAiB,CAAC,KAAgB;;QAC1C,MAAM,YAAY,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,qBAAqB,EAAE,CAAC;QAC3D,MAAM,YAAY,GAChB,YAAY,IAAI,IAAI;YAClB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC;YACnD,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO,YAAY,IAAI,IAAI;YACzB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;YAC1E,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAES,OAAO,CAAC,KAAgB;QAChC,OAAO,MAAM,CAAC,YAAY,IAAI,IAAI,IAAI,KAAK,YAAY,YAAY;YACjE,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO;YAC/B,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { ConfigProvider } from '../config';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from './interactionApi';\nimport { BaseEvent } from './interactionEvent';\nimport { InteractionHandler } from './interactionHandler';\nimport {\n MouseInteraction,\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport type InteractionType =\n | 'rotate'\n | 'zoom'\n | 'pan'\n | 'twist'\n | 'rotate-point'\n | 'pivot';\n\nconst DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport abstract class BaseInteractionHandler implements InteractionHandler {\n protected interactionApi?: InteractionApi;\n protected element?: HTMLElement;\n protected downPosition?: Point.Point;\n private downPositionCanvas?: Point.Point;\n private primaryInteraction: MouseInteraction;\n private currentInteraction?: MouseInteraction;\n private draggingInteraction: MouseInteraction | undefined;\n private lastPrimaryRotateInteraction?: MouseInteraction;\n private isDragging = false;\n private lastMoveEvent?: BaseEvent;\n private interactionTimer?: number;\n private keyboardControls = false;\n\n protected disableIndividualInteractions = false;\n\n private computedBodyStyle?: CSSStyleDeclaration;\n\n private primaryInteractionTypeChange = new EventDispatcher<void>();\n\n public constructor(\n protected downEvent: 'mousedown' | 'pointerdown',\n protected upEvent: 'mouseup' | 'pointerup',\n protected moveEvent: 'mousemove' | 'pointermove',\n private rotateInteraction: RotateInteraction,\n private rotatePointInteraction: RotatePointInteraction,\n private zoomInteraction: ZoomInteraction,\n private panInteraction: PanInteraction,\n private twistInteraction: TwistInteraction,\n private pivotInteraction: PivotInteraction,\n private getConfig: ConfigProvider\n ) {\n this.primaryInteraction = rotateInteraction;\n this.handleDownEvent = this.handleDownEvent.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n this.handleWindowMove = this.handleWindowMove.bind(this);\n this.handleWindowUp = this.handleWindowUp.bind(this);\n this.handleDoubleClick = this.handleDoubleClick.bind(this);\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.interactionApi = api;\n element.addEventListener(this.downEvent, this.handleDownEvent);\n element.addEventListener('mousedown', this.handleDoubleClick);\n element.addEventListener('wheel', this.handleMouseWheel, {\n passive: false,\n });\n }\n\n public dispose(): void {\n this.element?.removeEventListener(this.downEvent, this.handleDownEvent);\n this.element?.removeEventListener('mousedown', this.handleDoubleClick);\n this.element?.removeEventListener('wheel', this.handleMouseWheel);\n this.element = undefined;\n }\n\n public onPrimaryInteractionTypeChange(listener: Listener<void>): Disposable {\n return this.primaryInteractionTypeChange.on(listener);\n }\n\n public setCurrentInteractionType(type?: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.currentInteraction = this.rotateInteraction;\n break;\n case 'zoom':\n this.currentInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.currentInteraction = this.panInteraction;\n break;\n case 'twist':\n this.currentInteraction = this.twistInteraction;\n break;\n case 'rotate-point':\n this.currentInteraction = this.rotatePointInteraction;\n break;\n case 'pivot':\n this.currentInteraction = this.pivotInteraction;\n break;\n default:\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction) {\n const point = this.draggingInteraction.getPosition();\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n this.interactionApi?.resetLastAngle();\n this.draggingInteraction.setPosition(point);\n }\n }\n\n public getPrimaryInteractionType(): InteractionType {\n return this.primaryInteraction.getType();\n }\n\n public getCurrentInteractionType(): InteractionType {\n return (this.currentInteraction || this.primaryInteraction).getType();\n }\n\n public setPrimaryInteractionType(type: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.primaryInteraction = this.rotateInteraction;\n this.lastPrimaryRotateInteraction = this.rotateInteraction;\n break;\n case 'rotate-point':\n this.primaryInteraction = this.rotatePointInteraction;\n this.lastPrimaryRotateInteraction = this.rotatePointInteraction;\n break;\n case 'zoom':\n this.primaryInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.primaryInteraction = this.panInteraction;\n break;\n case 'pivot':\n this.primaryInteraction = this.pivotInteraction;\n break;\n }\n this.primaryInteractionTypeChange.emit();\n }\n\n public setDefaultKeyboardControls(keyboardControls: boolean): void {\n this.keyboardControls = keyboardControls;\n }\n\n protected handleDownEvent(event: BaseEvent): void {\n // Prevent selection of any text while interacting with the model.\n event.preventDefault();\n\n this.interactionTimer = window.setTimeout(() => {\n this.downPosition = Point.create(event.screenX, event.screenY);\n this.downPositionCanvas = this.getCanvasPosition(event);\n this.interactionTimer = undefined;\n\n // Perform the current movement in the case that the interaction timer elapses\n if (this.lastMoveEvent != null) {\n this.handleWindowMove(this.lastMoveEvent);\n }\n }, this.getConfig().interactions.interactionDelay);\n\n window.addEventListener(this.moveEvent, this.handleWindowMove);\n window.addEventListener(this.upEvent, this.handleWindowUp);\n }\n\n protected handleWindowMove(event: BaseEvent): void {\n if (this.interactionTimer == null) {\n if (this.disableIndividualInteractions) {\n return;\n }\n\n const position = Point.create(event.screenX, event.screenY);\n const pixelThreshold =\n this.interactionApi != null\n ? this.interactionApi.pixelThreshold(this.isTouch(event))\n : 2;\n if (\n this.downPosition != null &&\n Point.distance(position, this.downPosition) >= pixelThreshold &&\n !this.isDragging\n ) {\n this.beginDrag(event);\n this.isDragging = true;\n }\n\n if (this.isDragging) {\n this.drag(event);\n }\n }\n\n this.lastMoveEvent = event;\n }\n\n protected async handleWindowUp(event: BaseEvent): Promise<void> {\n if (this.isDragging) {\n this.endDrag(event);\n this.isDragging = false;\n }\n\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n\n window.removeEventListener(this.moveEvent, this.handleWindowMove);\n window.removeEventListener(this.upEvent, this.handleWindowUp);\n this.lastMoveEvent = undefined;\n }\n\n protected async handleDoubleClick(event: BaseEvent): Promise<void> {\n // event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.\n if (\n event.detail === 2 &&\n event.buttons === 4 &&\n this.interactionApi != null\n ) {\n await this.interactionApi.viewAll();\n }\n }\n\n protected beginDrag(event: BaseEvent): void {\n if (this.keyboardControls && event.metaKey && event.shiftKey) {\n this.currentInteraction = this.rotatePointInteraction;\n } else if (this.keyboardControls && event.shiftKey && event.altKey) {\n this.currentInteraction = this.twistInteraction;\n } else if (this.keyboardControls && event.shiftKey) {\n this.currentInteraction = this.zoomInteraction;\n } else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {\n this.currentInteraction = this.panInteraction;\n } else if (this.keyboardControls && event.altKey) {\n this.currentInteraction = this.rotateInteraction;\n }\n\n if (event.buttons === 1) {\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n } else if (event.buttons === 2) {\n this.draggingInteraction = this.panInteraction;\n } else if (event.buttons === 4) {\n this.draggingInteraction =\n this.lastPrimaryRotateInteraction ?? this.rotateInteraction;\n }\n\n if (\n this.draggingInteraction != null &&\n this.interactionApi != null &&\n this.element != null\n ) {\n // Ensure any scroll wheel interactions have been ended prior to beginning\n // another interaction to prevent the interaction from being ended early.\n this.zoomInteraction.endDrag(event, this.interactionApi);\n\n this.draggingInteraction.beginDrag(\n event,\n this.downPositionCanvas || Point.create(event.clientX, event.clientY),\n this.interactionApi,\n this.element\n );\n }\n }\n\n protected drag(event: BaseEvent): void {\n if (this.keyboardControls && event.altKey && event.shiftKey) {\n this.currentInteraction = this.twistInteraction;\n } else {\n this.currentInteraction = undefined;\n }\n this.draggingInteraction =\n this.currentInteraction ||\n this.draggingInteraction ||\n this.primaryInteraction;\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.drag(event, this.interactionApi);\n }\n }\n\n protected endDrag(event: BaseEvent): void {\n if (\n this.keyboardControls &&\n this.currentInteraction === this.twistInteraction\n ) {\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.endDrag(event, this.interactionApi);\n this.draggingInteraction = undefined;\n }\n }\n\n protected handleMouseWheel(event: WheelEvent): void {\n event.preventDefault();\n\n if (\n this.element != null &&\n this.interactionApi != null &&\n event.buttons !== 4\n ) {\n const delta =\n -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;\n const rect = this.element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n const scrollSize = Math.abs(event.deltaY);\n\n if (scrollSize < 12) {\n // For small wheel movements, send a single zoom event.\n void this.zoomInteraction.zoomToPoint(\n point,\n delta,\n this.interactionApi\n );\n } else {\n const divisions = Math.min(10, Math.ceil(scrollSize / 12));\n const zoomDelta = delta / divisions;\n // For larger wheel movements, divide the delta into multiple zoom events with increasing delay\n // which approximates a smooth zoom deceleration curve for the end user.\n for (let i = 1; i <= divisions; i++) {\n const delayMs = i * 5;\n window.setTimeout(() => {\n if (this.interactionApi != null) {\n this.zoomInteraction.zoomToPoint(\n point,\n zoomDelta,\n this.interactionApi,\n delayMs\n );\n }\n }, delayMs);\n }\n }\n }\n }\n\n protected wheelDeltaToPixels(deltaY: number, deltaMode: number): number {\n if (this.computedBodyStyle == null) {\n this.computedBodyStyle = window.getComputedStyle(document.body);\n }\n\n const defaultLineHeight =\n this.computedBodyStyle.getPropertyValue('fontSize') != null &&\n this.computedBodyStyle.getPropertyValue('fontSize') !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('fontSize')))\n ? parseFloat(this.computedBodyStyle.getPropertyValue('fontSize')) *\n DEFAULT_LINE_HEIGHT\n : DEFAULT_FONT_SIZE * DEFAULT_LINE_HEIGHT;\n\n if (deltaMode === 1) {\n // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines\n return this.computedBodyStyle.getPropertyValue('lineHeight') != null &&\n this.computedBodyStyle.getPropertyValue('lineHeight') !== '' &&\n !isNaN(\n parseFloat(this.computedBodyStyle.getPropertyValue('lineHeight'))\n )\n ? deltaY *\n parseFloat(this.computedBodyStyle.getPropertyValue('lineHeight'))\n : deltaY * defaultLineHeight;\n } else if (deltaMode === 2) {\n // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages\n return this.computedBodyStyle.getPropertyValue('height') != null &&\n this.computedBodyStyle.getPropertyValue('height') !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('height')))\n ? deltaY * parseFloat(this.computedBodyStyle.getPropertyValue('height'))\n : deltaY * window.innerHeight;\n }\n // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels\n return deltaY;\n }\n\n protected getCanvasPosition(event: BaseEvent): Point.Point | undefined {\n const canvasBounds = this.element?.getBoundingClientRect();\n const canvasOffset =\n canvasBounds != null\n ? Point.create(canvasBounds.left, canvasBounds.top)\n : undefined;\n\n return canvasOffset != null\n ? Point.subtract(Point.create(event.clientX, event.clientY), canvasOffset)\n : undefined;\n }\n\n protected isTouch(event: BaseEvent): boolean {\n return window.PointerEvent != null && event instanceof PointerEvent\n ? event.pointerType === 'touch'\n : false;\n }\n}\n"]}
1
+ {"version":3,"file":"baseInteractionHandler.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/baseInteractionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAc,eAAe,EAAY,MAAM,kBAAkB,CAAC;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAsBhD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,OAAgB,sBAAsB;IAwB1C,YACY,SAAsC,EACtC,OAAgC,EAChC,SAAsC,EACxC,iBAAoC,EACpC,sBAA8C,EAC9C,eAAgC,EAChC,cAA8B,EAC9B,gBAAkC,EAClC,gBAAkC,EAClC,SAAyB;QATvB,cAAS,GAAT,SAAS,CAA6B;QACtC,YAAO,GAAP,OAAO,CAAyB;QAChC,cAAS,GAAT,SAAS,CAA6B;QACxC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,oBAAe,GAAf,eAAe,CAAiB;QAChC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,cAAS,GAAT,SAAS,CAAgB;QAz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CAAC,cAAc,CAAC,MAAM,CAAC;QAC7C,CAAC;QACD,8EAA8E;QAC9E,OAAO,MAAM,CAAC;IAChB,CAAC;IAES,iBAAiB,CAAC,KAAgB;;QAC1C,MAAM,YAAY,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,qBAAqB,EAAE,CAAC;QAC3D,MAAM,YAAY,GAChB,YAAY,IAAI,IAAI;YAClB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC;YACnD,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO,YAAY,IAAI,IAAI;YACzB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;YAC1E,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAES,OAAO,CAAC,KAAgB;QAChC,OAAO,MAAM,CAAC,YAAY,IAAI,IAAI,IAAI,KAAK,YAAY,YAAY;YACjE,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO;YAC/B,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { ConfigProvider } from '../config';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from './interactionApi';\nimport { BaseEvent } from './interactionEvent';\nimport { InteractionHandler } from './interactionHandler';\nimport {\n MouseInteraction,\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport type InteractionType =\n | 'rotate'\n | 'zoom'\n | 'pan'\n | 'twist'\n | 'rotate-point'\n | 'pivot';\n\nconst DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport abstract class BaseInteractionHandler implements InteractionHandler {\n protected interactionApi?: InteractionApi;\n protected element?: HTMLElement;\n protected downPosition?: Point.Point;\n private downPositionCanvas?: Point.Point;\n private primaryInteraction: MouseInteraction;\n private currentInteraction?: MouseInteraction;\n private draggingInteraction: MouseInteraction | undefined;\n private lastPrimaryRotateInteraction?: MouseInteraction;\n private isDragging = false;\n private lastMoveEvent?: BaseEvent;\n private interactionTimer?: number;\n private keyboardControls = false;\n\n protected disableIndividualInteractions = false;\n\n private bodyStyleCache?: {\n fontSize: number;\n lineHeight: number;\n height: number;\n };\n\n private primaryInteractionTypeChange = new EventDispatcher<void>();\n\n public constructor(\n protected downEvent: 'mousedown' | 'pointerdown',\n protected upEvent: 'mouseup' | 'pointerup',\n protected moveEvent: 'mousemove' | 'pointermove',\n private rotateInteraction: RotateInteraction,\n private rotatePointInteraction: RotatePointInteraction,\n private zoomInteraction: ZoomInteraction,\n private panInteraction: PanInteraction,\n private twistInteraction: TwistInteraction,\n private pivotInteraction: PivotInteraction,\n private getConfig: ConfigProvider\n ) {\n this.primaryInteraction = rotateInteraction;\n this.handleDownEvent = this.handleDownEvent.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n this.handleWindowMove = this.handleWindowMove.bind(this);\n this.handleWindowUp = this.handleWindowUp.bind(this);\n this.handleDoubleClick = this.handleDoubleClick.bind(this);\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.interactionApi = api;\n element.addEventListener(this.downEvent, this.handleDownEvent);\n element.addEventListener('mousedown', this.handleDoubleClick);\n element.addEventListener('wheel', this.handleMouseWheel, {\n passive: false,\n });\n }\n\n public dispose(): void {\n this.element?.removeEventListener(this.downEvent, this.handleDownEvent);\n this.element?.removeEventListener('mousedown', this.handleDoubleClick);\n this.element?.removeEventListener('wheel', this.handleMouseWheel);\n this.element = undefined;\n }\n\n public onPrimaryInteractionTypeChange(listener: Listener<void>): Disposable {\n return this.primaryInteractionTypeChange.on(listener);\n }\n\n public setCurrentInteractionType(type?: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.currentInteraction = this.rotateInteraction;\n break;\n case 'zoom':\n this.currentInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.currentInteraction = this.panInteraction;\n break;\n case 'twist':\n this.currentInteraction = this.twistInteraction;\n break;\n case 'rotate-point':\n this.currentInteraction = this.rotatePointInteraction;\n break;\n case 'pivot':\n this.currentInteraction = this.pivotInteraction;\n break;\n default:\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction) {\n const point = this.draggingInteraction.getPosition();\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n this.interactionApi?.resetLastAngle();\n this.draggingInteraction.setPosition(point);\n }\n }\n\n public getPrimaryInteractionType(): InteractionType {\n return this.primaryInteraction.getType();\n }\n\n public getCurrentInteractionType(): InteractionType {\n return (this.currentInteraction || this.primaryInteraction).getType();\n }\n\n public setPrimaryInteractionType(type: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.primaryInteraction = this.rotateInteraction;\n this.lastPrimaryRotateInteraction = this.rotateInteraction;\n break;\n case 'rotate-point':\n this.primaryInteraction = this.rotatePointInteraction;\n this.lastPrimaryRotateInteraction = this.rotatePointInteraction;\n break;\n case 'zoom':\n this.primaryInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.primaryInteraction = this.panInteraction;\n break;\n case 'pivot':\n this.primaryInteraction = this.pivotInteraction;\n break;\n }\n this.primaryInteractionTypeChange.emit();\n }\n\n public setDefaultKeyboardControls(keyboardControls: boolean): void {\n this.keyboardControls = keyboardControls;\n }\n\n protected handleDownEvent(event: BaseEvent): void {\n // Prevent selection of any text while interacting with the model.\n event.preventDefault();\n\n this.interactionTimer = window.setTimeout(() => {\n this.downPosition = Point.create(event.screenX, event.screenY);\n this.downPositionCanvas = this.getCanvasPosition(event);\n this.interactionTimer = undefined;\n\n // Perform the current movement in the case that the interaction timer elapses\n if (this.lastMoveEvent != null) {\n this.handleWindowMove(this.lastMoveEvent);\n }\n }, this.getConfig().interactions.interactionDelay);\n\n window.addEventListener(this.moveEvent, this.handleWindowMove);\n window.addEventListener(this.upEvent, this.handleWindowUp);\n }\n\n protected handleWindowMove(event: BaseEvent): void {\n if (this.interactionTimer == null) {\n if (this.disableIndividualInteractions) {\n return;\n }\n\n const position = Point.create(event.screenX, event.screenY);\n const pixelThreshold =\n this.interactionApi != null\n ? this.interactionApi.pixelThreshold(this.isTouch(event))\n : 2;\n if (\n this.downPosition != null &&\n Point.distance(position, this.downPosition) >= pixelThreshold &&\n !this.isDragging\n ) {\n this.beginDrag(event);\n this.isDragging = true;\n }\n\n if (this.isDragging) {\n this.drag(event);\n }\n }\n\n this.lastMoveEvent = event;\n }\n\n protected async handleWindowUp(event: BaseEvent): Promise<void> {\n if (this.isDragging) {\n this.endDrag(event);\n this.isDragging = false;\n }\n\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n\n window.removeEventListener(this.moveEvent, this.handleWindowMove);\n window.removeEventListener(this.upEvent, this.handleWindowUp);\n this.lastMoveEvent = undefined;\n }\n\n protected async handleDoubleClick(event: BaseEvent): Promise<void> {\n // event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.\n if (\n event.detail === 2 &&\n event.buttons === 4 &&\n this.interactionApi != null\n ) {\n await this.interactionApi.viewAll();\n }\n }\n\n protected beginDrag(event: BaseEvent): void {\n if (this.keyboardControls && event.metaKey && event.shiftKey) {\n this.currentInteraction = this.rotatePointInteraction;\n } else if (this.keyboardControls && event.shiftKey && event.altKey) {\n this.currentInteraction = this.twistInteraction;\n } else if (this.keyboardControls && event.shiftKey) {\n this.currentInteraction = this.zoomInteraction;\n } else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {\n this.currentInteraction = this.panInteraction;\n } else if (this.keyboardControls && event.altKey) {\n this.currentInteraction = this.rotateInteraction;\n }\n\n if (event.buttons === 1) {\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n } else if (event.buttons === 2) {\n this.draggingInteraction = this.panInteraction;\n } else if (event.buttons === 4) {\n this.draggingInteraction =\n this.lastPrimaryRotateInteraction ?? this.rotateInteraction;\n }\n\n if (\n this.draggingInteraction != null &&\n this.interactionApi != null &&\n this.element != null\n ) {\n // Ensure any scroll wheel interactions have been ended prior to beginning\n // another interaction to prevent the interaction from being ended early.\n this.zoomInteraction.endDrag(event, this.interactionApi);\n\n this.draggingInteraction.beginDrag(\n event,\n this.downPositionCanvas || Point.create(event.clientX, event.clientY),\n this.interactionApi,\n this.element\n );\n }\n }\n\n protected drag(event: BaseEvent): void {\n if (this.keyboardControls && event.altKey && event.shiftKey) {\n this.currentInteraction = this.twistInteraction;\n } else {\n this.currentInteraction = undefined;\n }\n this.draggingInteraction =\n this.currentInteraction ||\n this.draggingInteraction ||\n this.primaryInteraction;\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.drag(event, this.interactionApi);\n }\n }\n\n protected endDrag(event: BaseEvent): void {\n if (\n this.keyboardControls &&\n this.currentInteraction === this.twistInteraction\n ) {\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.endDrag(event, this.interactionApi);\n this.draggingInteraction = undefined;\n }\n }\n\n protected handleMouseWheel(event: WheelEvent): void {\n event.preventDefault();\n\n if (\n this.element != null &&\n this.interactionApi != null &&\n event.buttons !== 4\n ) {\n const delta =\n -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;\n const rect = this.element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n const scrollSize = Math.abs(event.deltaY);\n\n if (scrollSize < 12) {\n // For small wheel movements, send a single zoom event.\n void this.zoomInteraction.zoomToPoint(\n point,\n delta,\n this.interactionApi\n );\n } else {\n const divisions = Math.min(10, Math.ceil(scrollSize / 12));\n const zoomDelta = delta / divisions;\n // For larger wheel movements, divide the delta into multiple zoom events with increasing delay\n // which approximates a smooth zoom deceleration curve for the end user.\n for (let i = 1; i <= divisions; i++) {\n const delayMs = i * 5;\n window.setTimeout(() => {\n if (this.interactionApi != null) {\n this.zoomInteraction.zoomToPoint(\n point,\n zoomDelta,\n this.interactionApi,\n delayMs\n );\n }\n }, delayMs);\n }\n }\n }\n }\n\n protected wheelDeltaToPixels(deltaY: number, deltaMode: number): number {\n // Cached values are an optimization we can use given mouseWheel\n // events can happen dozen or hundreds of times per scroll, but body style\n // is very unlikely to change frequently or while doing wheel movements.\n if (this.bodyStyleCache == null) {\n const bodyStyle = window.getComputedStyle(document.body);\n this.bodyStyleCache = {\n fontSize:\n parseFloat(bodyStyle.getPropertyValue('fontSize')) ||\n DEFAULT_FONT_SIZE,\n lineHeight:\n parseFloat(bodyStyle.getPropertyValue('lineHeight')) ||\n DEFAULT_LINE_HEIGHT,\n height:\n parseFloat(bodyStyle.getPropertyValue('height')) ||\n window.innerHeight,\n };\n window.setTimeout(() => {\n this.bodyStyleCache = undefined;\n }, 4800); // For now hardcoded. Could be derived. eg mouseWheelInteractionEndDebounce * 12\n }\n\n if (deltaMode === 1) {\n // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines\n return (\n deltaY * (this.bodyStyleCache.fontSize * this.bodyStyleCache.lineHeight)\n );\n } else if (deltaMode === 2) {\n // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages\n return deltaY * this.bodyStyleCache.height;\n }\n // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels\n return deltaY;\n }\n\n protected getCanvasPosition(event: BaseEvent): Point.Point | undefined {\n const canvasBounds = this.element?.getBoundingClientRect();\n const canvasOffset =\n canvasBounds != null\n ? Point.create(canvasBounds.left, canvasBounds.top)\n : undefined;\n\n return canvasOffset != null\n ? Point.subtract(Point.create(event.clientX, event.clientY), canvasOffset)\n : undefined;\n }\n\n protected isTouch(event: BaseEvent): boolean {\n return window.PointerEvent != null && event instanceof PointerEvent\n ? event.pointerType === 'touch'\n : false;\n }\n}\n"]}
@@ -110,8 +110,9 @@ export class InteractionApi {
110
110
  * performing any additional interaction operations. Use `endInteraction()` to
111
111
  * mark the end of an interaction.
112
112
  */
113
- async beginInteraction() {
113
+ async beginInteraction(renderOptions = {}) {
114
114
  if (!this.isInteracting()) {
115
+ this.activeRenderOptions = renderOptions;
115
116
  this.interactionStartedEmitter.emit();
116
117
  this.sceneLoadingPromise = this.getScene();
117
118
  this.currentCamera = (await this.sceneLoadingPromise).camera();
@@ -119,11 +120,18 @@ export class InteractionApi {
119
120
  await this.stream.beginInteraction();
120
121
  }
121
122
  }
122
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
- async transformCamera(...args) {
124
- var _a;
125
- const t = args[0];
126
- const renderOptions = args[1];
123
+ /**
124
+ * Invokes a function to transform the scene's camera and request a new image
125
+ * for the updated scene.
126
+ *
127
+ * @param t A function to transform the camera. Function will be passed the
128
+ * camera and scene viewport and is expected to return an updated camera.
129
+ */
130
+ async transformCamera(t, renderOptions) {
131
+ var _a, _b;
132
+ if (renderOptions === void 0) {
133
+ renderOptions = (_a = this.activeRenderOptions) !== null && _a !== void 0 ? _a : {};
134
+ }
127
135
  if (this.isInteracting()) {
128
136
  const scene = await this.getScene();
129
137
  const viewport = this.getViewport();
@@ -140,7 +148,7 @@ export class InteractionApi {
140
148
  depthBuffer,
141
149
  })
142
150
  : undefined;
143
- await ((_a = this.currentCamera) === null || _a === void 0 ? void 0 : _a.render(renderOptions));
151
+ await ((_b = this.currentCamera) === null || _b === void 0 ? void 0 : _b.render(renderOptions));
144
152
  }
145
153
  }
146
154
  async twistCamera(...args) {
@@ -213,7 +221,7 @@ export class InteractionApi {
213
221
  * new image for the updated scene.
214
222
  */
215
223
  async viewAll() {
216
- await (await this.getScene()).camera().viewAll().render();
224
+ await (await this.getScene()).camera().viewAll().render({});
217
225
  }
218
226
  /**
219
227
  * Performs a rotate operation of the scene around the camera's look at point,
@@ -382,6 +390,7 @@ export class InteractionApi {
382
390
  this.interactionFinishedEmitter.emit();
383
391
  await this.stream.endInteraction();
384
392
  }
393
+ this.activeRenderOptions = undefined;
385
394
  }
386
395
  /**
387
396
  * resets the last recorded angle for a twist op
@@ -1 +1 @@
1
- {"version":3,"file":"interactionApi.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApi.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,GAAG,EACH,OAAO,GACR,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EAEL,UAAU,GAIX,MAAM,UAAU,CAAC;AA8BlB;;;GAGG;AACH,MAAM,OAAgB,cAAc;IASlC,YACY,MAAiB,EACnB,OAAsB,EACpB,SAAoC,EACpC,QAAuB,EACvB,QAAyC,EAC5C,WAA2B,EAC1B,UAAyC,EACzC,gBAA+C,EAC/C,gBAA+C,EAC/C,yBAA6C,EAC7C,0BAA8C;QAV5C,WAAM,GAAN,MAAM,CAAW;QACnB,YAAO,GAAP,OAAO,CAAe;QACpB,cAAS,GAAT,SAAS,CAA2B;QACpC,aAAQ,GAAR,QAAQ,CAAe;QACvB,aAAQ,GAAR,QAAQ,CAAiC;QAC5C,gBAAW,GAAX,WAAW,CAAgB;QAC1B,eAAU,GAAV,UAAU,CAA+B;QACzC,qBAAgB,GAAhB,gBAAgB,CAA+B;QAC/C,qBAAgB,GAAhB,gBAAgB,CAA+B;QAC/C,8BAAyB,GAAzB,yBAAyB,CAAoB;QAC7C,+BAA0B,GAA1B,0BAA0B,CAAoB;QAEtD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC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AC,OAAO,CAAC,CAAC;QAC9C,OAAO,QAAQ;YACb,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC;YACzD,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;CAeF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport {\n Angle,\n BoundingBox,\n Plane,\n Point,\n Ray,\n Vector3,\n} from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { ReceivedFrame } from '../..';\nimport { Cursor, CursorManager } from '../cursors';\nimport {\n Camera,\n CameraRenderOptions,\n OrthographicCamera,\n Scene,\n} from '../scenes';\nimport {\n DepthBuffer,\n EntityType,\n FrameCameraBase,\n Interactions,\n Viewport,\n} from '../types';\nimport { TapEventDetails, TapEventKeys } from './tapEventDetails';\n\nexport type SceneProvider = () => Promise<Scene>;\n\nexport type InteractionConfigProvider = () => Interactions.InteractionConfig;\n\nexport type CameraTransform<\n T extends Camera = Camera,\n R extends Camera = Camera,\n> = (data: {\n camera: T;\n viewport: Viewport;\n scale: Point.Point;\n boundingBox: BoundingBox.BoundingBox;\n frame: ReceivedFrame;\n depthBuffer?: DepthBuffer;\n}) => R;\n\nexport interface PanData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n startingCamera: FrameCameraBase;\n}\n\nexport interface ZoomData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n}\n\n/**\n * The `InteractionApi` provides methods that API developers can use to modify\n * the internal state of an interaction.\n */\nexport abstract class InteractionApi<T extends Camera = Camera> {\n protected currentCamera?: Camera;\n private sceneLoadingPromise?: Promise<Scene>;\n private lastAngle: Angle.Angle | undefined;\n private worldRotationPoint?: Vector3.Vector3;\n\n protected panData?: PanData;\n protected zoomData?: ZoomData;\n\n public constructor(\n protected stream: StreamApi,\n private cursors: CursorManager,\n protected getConfig: InteractionConfigProvider,\n protected getScene: SceneProvider,\n protected getFrame: () => ReceivedFrame | undefined,\n public getViewport: () => Viewport,\n private tapEmitter: EventEmitter<TapEventDetails>,\n private doubleTapEmitter: EventEmitter<TapEventDetails>,\n private longPressEmitter: EventEmitter<TapEventDetails>,\n private interactionStartedEmitter: EventEmitter<void>,\n private interactionFinishedEmitter: EventEmitter<void>\n ) {\n this.tap = this.tap.bind(this);\n this.doubleTap = this.doubleTap.bind(this);\n this.longPress = this.longPress.bind(this);\n this.emitTapEvent = this.emitTapEvent.bind(this);\n }\n\n /**\n * Displays a cursor over the viewer with the given priority. Cursors with\n * higher priority will take precedence over cursors with lower priorities if\n * there's more than a single cursor added.\n *\n * @param cursor The cursor to add.\n * @param priority The priority of the cursor.\n * @returns A `Disposable` that can be used to remove the cursor.\n */\n public addCursor(cursor: Cursor, priority?: number): Disposable {\n return this.cursors.add(cursor, priority);\n }\n\n /**\n * Returns a 3D point in world space for the given 2D point in viewport space.\n *\n * @param point A point in 2D viewport space to transform.\n * @returns A 3D point in world space.\n */\n public async getWorldPointFromViewport(\n point: Point.Point\n ): Promise<Vector3.Vector3 | undefined> {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame == null) {\n throw new Error('Cannot get world point. Frame is undefined.');\n }\n\n const depthBuffer = await frame.depthBuffer();\n return depthBuffer != null\n ? viewport.transformPointToWorldSpace(point, depthBuffer, 0.5)\n : undefined;\n }\n\n /**\n * Returns the entity at the given point in viewport space.\n *\n * @param point A point in viewport space.\n * @returns The entity that was found.\n */\n public async getEntityTypeAtPoint(point: Point.Point): Promise<EntityType> {\n const viewport = this.getViewport();\n const featureMap = await this.getFrame()?.featureMap();\n\n if (featureMap != null) {\n const framePt = viewport.transformPointToFrame(point, featureMap);\n return featureMap.getEntityType(framePt);\n } else {\n return EntityType.NO_GEOMETRY;\n }\n }\n\n /**\n * Generates a ray from the given point, in viewport coordinates.\n *\n * @param point A point in viewport coordinates.\n * @returns A ray representing the direction of the point in world\n * coordinates.\n */\n public getRayFromPoint(point: Point.Point): Ray.Ray {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame != null) {\n return viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n } else throw new Error('Cannot get camera. Frame is undefined.');\n }\n\n /**\n * Emits a tap event with the provided position relative to the viewer\n * canvas, along with the set of modifier keys held (if applicable).\n *\n * @param position An {x, y} coordinate marking the position of the tap.\n * @param keyDetails A set of pressed keyboard keys that you want to include\n * in the tap event.\n */\n public async tap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(this.tapEmitter.emit, position, keyDetails, buttons);\n }\n\n public async doubleTap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(\n this.doubleTapEmitter.emit,\n position,\n keyDetails,\n buttons\n );\n }\n\n public async longPress(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(\n this.longPressEmitter.emit,\n position,\n keyDetails,\n buttons\n );\n }\n\n /**\n * Marks the start of an interaction. This method must be called before\n * performing any additional interaction operations. Use `endInteraction()` to\n * mark the end of an interaction.\n */\n public async beginInteraction(): Promise<void> {\n if (!this.isInteracting()) {\n this.interactionStartedEmitter.emit();\n this.sceneLoadingPromise = this.getScene();\n this.currentCamera = (await this.sceneLoadingPromise).camera();\n this.sceneLoadingPromise = undefined;\n await this.stream.beginInteraction();\n }\n }\n\n /**\n * Invokes a function to transform the scene's camera and request a new image\n * for the updated scene.\n *\n * @param t A function to transform the camera. Function will be passed the\n * camera and scene viewport and is expected to return an updated camera.\n */\n public async transformCamera(t: CameraTransform<T>): Promise<void>;\n public async transformCamera(\n t: CameraTransform<T>,\n renderOptions?: CameraRenderOptions\n ): Promise<void>;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public async transformCamera(...args: any[]): Promise<void> {\n const t = args[0];\n const renderOptions = args[1];\n\n if (this.isInteracting()) {\n const scene = await this.getScene();\n const viewport = this.getViewport();\n const frame = this.getFrame();\n const depthBuffer = await frame?.depthBuffer();\n\n this.currentCamera =\n this.currentCamera != null && viewport != null && frame != null\n ? t({\n camera: this.currentCamera,\n viewport,\n scale: scene.scale(),\n boundingBox: scene.boundingBox(),\n frame,\n depthBuffer,\n })\n : undefined;\n\n await this.currentCamera?.render(renderOptions);\n }\n }\n\n /**\n * Performs a twist operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer or the angle to twist the camera by around the view vector.\n */\n public async twistCamera(delta: number): Promise<void>;\n public async twistCamera(delta: Point.Point): Promise<void>;\n public async twistCamera(...args: any[]): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n if (args.length === 1 && typeof args[0] === 'number') {\n const angleInRadians = Angle.toRadians(-args[0]);\n return camera.rotateAroundAxis(angleInRadians, axis);\n } else if (args.length === 1) {\n const center = Point.create(viewport.width / 2, viewport.height / 2);\n const currentAngle = Angle.toDegrees(Angle.fromPoints(center, args[0]));\n const angleDelta =\n this.lastAngle != null ? currentAngle - this.lastAngle : 0;\n\n this.lastAngle = currentAngle;\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n const angleInRadians = Angle.toRadians(-angleDelta);\n return camera.rotateAroundAxis(angleInRadians, axis);\n }\n return camera;\n });\n }\n\n /**\n * Moves the camera's position and look at to the given screen coordinate.\n *\n * If the screen coordinate intersects with an object, the camera will track\n * the hit point so the mouse position is always under the mouse.\n *\n * If the screen coordinate doesn't intersect with an object, then ???.\n *\n * @param screenPt A point in screen coordinates.\n */\n public async panCameraToScreenPoint(screenPt: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, frame, viewport, depthBuffer }) => {\n // Capture the starting state of the pan.\n if (this.panData == null) {\n const startingCamera = camera.toFrameCamera();\n const direction = startingCamera.direction;\n\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n direction,\n camera.lookAt\n );\n const fallback = Ray.intersectPlane(ray, fallbackPlane);\n if (fallback == null) {\n console.warn(\n 'Cannot determine fallback for pan. Ray does not intersect plane.'\n );\n return camera;\n }\n\n // Create a plane for the hit point that will be used to determine the\n // delta of future mouse movements to the original hit point. Fallback\n // to a plane placed at the look at point, in case there's no hit.\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(screenPt, depthBuffer, fallback)\n : fallback;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(direction, hitPt);\n\n this.panData = { hitPt, hitPlane, startingCamera };\n }\n\n if (this.panData != null) {\n const { hitPt, hitPlane, startingCamera } = this.panData;\n\n // Use a ray that originates at the screen and intersects with the hit\n // plane to determine the move distance.\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const movePt = Ray.intersectPlane(ray, hitPlane);\n\n if (movePt != null) {\n const delta = Vector3.subtract(hitPt, movePt);\n return camera.update(startingCamera).moveBy(delta);\n }\n }\n return camera;\n });\n }\n\n /**\n * Performs a view all operation for the scene's bounding box, and requests a\n * new image for the updated scene.\n */\n public async viewAll(): Promise<void> {\n await (await this.getScene()).camera().viewAll().render();\n }\n\n /**\n * Performs a rotate operation of the scene around the camera's look at point,\n * and requests a new image for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async rotateCamera(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const upVector = Vector3.normalize(camera.up);\n const directionVector = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n const crossX = Vector3.cross(upVector, directionVector);\n const crossY = Vector3.cross(directionVector, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, directionVector);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n return camera.rotateAroundAxis(angle, rotationAxis);\n });\n }\n\n public async rotateCameraAtPoint(\n delta: Point.Point,\n point: Point.Point\n ): Promise<void> {\n return this.transformCamera(({ camera, viewport, depthBuffer }) => {\n if (this.worldRotationPoint == null) {\n this.worldRotationPoint =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, camera.lookAt)\n : camera.lookAt;\n }\n\n const upVector = Vector3.normalize(camera.up);\n const vv = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n const crossX = Vector3.cross(upVector, vv);\n const crossY = Vector3.cross(vv, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, vv);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n const updated = camera.rotateAroundAxisAtPoint(\n angle,\n this.worldRotationPoint,\n rotationAxis\n );\n\n return updated.update({\n // Scale the lookAt point to the same length as the distance to the\n // center of the bounding box to maintain zoom and pan behavior.\n lookAt: Vector3.add(\n Vector3.scale(\n Math.abs(camera.signedDistanceToBoundingBoxCenter()) /\n Vector3.magnitude(updated.viewVector),\n updated.viewVector\n ),\n updated.position\n ),\n });\n });\n }\n\n /**\n * Performs a zoom operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta The distance to zoom. Positive values zoom in and negative\n * values zoom out.\n */\n public async zoomCamera(delta: number): Promise<void> {\n return this.transformCamera(({ camera, viewport, frame, boundingBox }) => {\n if (viewport != null && frame != null) {\n const isPerspective = camera?.toFrameCamera().isPerspective();\n\n if (isPerspective) {\n const vv = camera.viewVector;\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 3 multiplier was chosen to match the desired zoom speed.\n const distance = Vector3.magnitude(vv);\n const relativeDeltaToViewportHeight =\n 3 * distance * (delta / viewport.height);\n\n // Scale the current viewVector by the scalar calculated above to determine how to adjust the camera position\n const v = Vector3.normalize(vv);\n const positionChange = Vector3.scale(\n relativeDeltaToViewportHeight,\n v\n );\n\n // Calculate the new camera position\n const position = Vector3.add(camera.position, positionChange);\n\n // Update the camera with the new position\n const newCamera = camera.update({ position });\n return newCamera;\n } else {\n // Retrieve properties of the current camera\n const orthographicCamera = camera as unknown as OrthographicCamera;\n const frameCam = camera.toFrameCamera();\n const dir = frameCam.direction;\n const ray = viewport.transformPointToRay(\n viewport.center,\n frame.image,\n frameCam\n );\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 4 multiplier was chosen to match the desired zoom speed.\n const relativeDeltaToViewportHeight = 4 * (delta / viewport.height);\n\n // Calculate the fovHeight after performing the zoom. zoomedFovHeight has the\n // same units of camera.fovHeight (the world units). The new fovHeight\n // has a minimum value, which is a function of the size of the bounding box,\n // which ensures the new fovHeight is a positive, non-zero number.\n const minimumFovHeight =\n Vector3.magnitude(BoundingBox.diagonal(boundingBox)) * 1e-5;\n const zoomedFovHeight = Math.max(\n minimumFovHeight,\n orthographicCamera.fovHeight * (1 - relativeDeltaToViewportHeight)\n );\n\n // Calculate the plane and point to zoom relative to\n const planeToZoomRelativeTo = Plane.fromNormalAndCoplanarPoint(\n dir,\n frameCam.lookAt\n );\n const pointToZoomRelativeTo = Ray.intersectPlane(\n ray,\n planeToZoomRelativeTo\n );\n\n if (pointToZoomRelativeTo != null) {\n // Project the current look at point onto the zoom plane\n const projectedLookAt = Plane.projectPoint(\n planeToZoomRelativeTo,\n orthographicCamera.lookAt\n );\n\n // Calculate the vector to determine how to adjust the camera's look at point.\n // Ensure that the viewVector is scaled to the expected length in order to\n // ensure other camera calculations are correct, for example, the occlusion\n // calculations for pins.\n const fovHeightRelativeChange =\n (orthographicCamera.fovHeight - zoomedFovHeight) /\n orthographicCamera.fovHeight;\n const lookAtChangeVector = Vector3.scale(\n fovHeightRelativeChange,\n Vector3.subtract(pointToZoomRelativeTo, projectedLookAt)\n );\n\n // Calculate the camera's new look at point\n const updatedLookAt = Vector3.add(\n orthographicCamera.lookAt,\n lookAtChangeVector\n );\n\n // Update the orthographic camera\n // Note rotationPoint should match lookAt after a zoom interaction\n const newCamera = camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n fovHeight: zoomedFovHeight,\n });\n return newCamera;\n }\n }\n }\n\n return camera;\n });\n }\n\n /**\n * Performs a pivot operation of the scene's camera, updating the lookAt\n * while maintaining the position, and requests a new image for the\n * updated scene.\n *\n * @param degreesLocalX The angle to rotate the lookAt point around the local x-axis\n * @param degreesLocalY The angle to rotate the lookAt point around the local y-axis\n */\n public async pivotCamera(\n degreesLocalX: number,\n degreesLocalY: number\n ): Promise<void> {\n return this.transformCamera(({ camera }) => {\n const { position, up, lookAt } = camera;\n const normalizedUp = Vector3.normalize(up);\n const normalizedViewVector = Vector3.normalize(camera.viewVector);\n const xVector = Vector3.cross(normalizedUp, normalizedViewVector);\n const yVector = Vector3.cross(normalizedViewVector, xVector);\n\n const updatedLookAtX = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalX),\n lookAt,\n xVector,\n position\n );\n const updatedLookAtY = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalY),\n updatedLookAtX,\n yVector,\n position\n );\n\n return camera.update({ ...camera, lookAt: updatedLookAtY });\n });\n }\n\n /**\n * Marks the end of an interaction.\n */\n public async endInteraction(): Promise<void> {\n await this.sceneLoadingPromise;\n\n if (this.isInteracting()) {\n this.currentCamera = undefined;\n this.worldRotationPoint = undefined;\n this.panData = undefined;\n this.zoomData = undefined;\n this.resetLastAngle();\n\n this.interactionFinishedEmitter.emit();\n await this.stream.endInteraction();\n }\n }\n\n /**\n * resets the last recorded angle for a twist op\n */\n public resetLastAngle(): void {\n this.lastAngle = undefined;\n }\n\n /**\n * Indicates if the API is in an interacting state.\n */\n public isInteracting(): boolean {\n return this.currentCamera != null;\n }\n\n /**\n * Returns the pixel threshold that should be used to detect\n * movement based on the type of pointer input being coarse or fine.\n * This threshold is based on the configured `coarsePointerThreshold`\n * or the `finePointerThreshold` respectively.\n *\n * @param isTouch - Whether the event is a touch or not, if false or\n * undefined, a media query will be used to determine pointer type\n * @returns The pixel threshold.\n */\n public pixelThreshold(isTouch?: boolean): number {\n const pixelThreshold = this.isCoarseInputDevice(isTouch)\n ? this.getConfig().coarsePointerThreshold\n : this.getConfig().finePointerThreshold;\n\n return pixelThreshold * window.devicePixelRatio;\n }\n\n /**\n * Performs a hit test at the given point and returns a list of hit results\n * indicating any scene items that exist at the given point.\n *\n * @param pt A point, in viewport coordinates.\n * @returns A promise that resolves with the list of hit results.\n */\n public async hitItems(\n pt: Point.Point\n ): Promise<vertexvis.protobuf.stream.IHit[]> {\n const res = await (await this.getScene()).raycaster().hitItems(pt);\n return res?.hits ?? [];\n }\n\n private emitTapEvent(\n emit: (details: TapEventDetails) => void,\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): void {\n const {\n altKey = false,\n ctrlKey = false,\n metaKey = false,\n shiftKey = false,\n } = keyDetails;\n emit({\n position,\n altKey,\n ctrlKey,\n metaKey,\n shiftKey,\n buttons,\n });\n }\n\n private isCoarseInputDevice(isTouch?: boolean): boolean {\n return isTouch || window.matchMedia('(pointer: coarse)').matches;\n }\n\n protected getWorldPoint(\n point: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackPoint: Vector3.Vector3\n ): Vector3.Vector3 {\n const viewport = this.getViewport();\n const framePt = viewport.transformPointToFrame(point, depthBuffer);\n const hasDepth = depthBuffer.hitTest(framePt);\n return hasDepth\n ? viewport.transformPointToWorldSpace(point, depthBuffer)\n : fallbackPoint;\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public abstract panCameraByDelta(delta: Point.Point): Promise<void>;\n\n public abstract zoomCameraToPoint(\n point: Point.Point,\n delta: number\n ): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"interactionApi.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApi.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,GAAG,EACH,OAAO,GACR,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EAEL,UAAU,GAIX,MAAM,UAAU,CAAC;AA8BlB;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAUlC,YACY,MAAiB,EACnB,OAAsB,EACpB,SAAoC,EACpC,QAAuB,EACvB,QAAyC,EAC5C,WAA2B,EAC1B,UAAyC,EACzC,gBAA+C,EAC/C,gBAA+C,EAC/C,yBAA6C,EAC7C,0BAA8C;QAV5C,WAAM,GAAN,MAAM,CAAW;QACnB,YAAO,GAAP,OAAO,CAAe;QACpB,cAAS,GAAT,SAAS,CAA2B;QACpC,aAAQ,GAAR,QAAQ,CAAe;QACvB,aAAQ,GAAR,QAAQ,CAAiC;QAC5C,gBAAW,GAAX,WAAW,CAAgB;QAC1B,eAAU,GAAV,UAAU,CAA+B;QACzC,qBAAgB,GAAhB,gBAAgB,CAA+B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KAAK,EACf,QAAQ,GAAG,KAAK,GACjB,GAAG,UAAU,CAAC;QACf,IAAI,CAAC;YACH,QAAQ;YACR,MAAM;YACN,OAAO;YACP,OAAO;YACP,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEO,mBAAmB,CAAC,OAAiB;QAC3C,OAAO,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC;IACnE,CAAC;IAES,aAAa,CACrB,KAAkB,EAClB,WAAwB,EACxB,aAA8B;QAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,QAAQ;YACb,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC;YACzD,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;CAeF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport {\n Angle,\n BoundingBox,\n Plane,\n Point,\n Ray,\n Vector3,\n} from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { ReceivedFrame } from '../..';\nimport { Cursor, CursorManager } from '../cursors';\nimport {\n Camera,\n CameraRenderOptions,\n OrthographicCamera,\n Scene,\n} from '../scenes';\nimport {\n DepthBuffer,\n EntityType,\n FrameCameraBase,\n Interactions,\n Viewport,\n} from '../types';\nimport { TapEventDetails, TapEventKeys } from './tapEventDetails';\n\nexport type SceneProvider = () => Promise<Scene>;\n\nexport type InteractionConfigProvider = () => Interactions.InteractionConfig;\n\nexport type CameraTransform<\n T extends Camera = Camera,\n R extends Camera = Camera,\n> = (data: {\n camera: T;\n viewport: Viewport;\n scale: Point.Point;\n boundingBox: BoundingBox.BoundingBox;\n frame: ReceivedFrame;\n depthBuffer?: DepthBuffer;\n}) => R;\n\nexport interface PanData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n startingCamera: FrameCameraBase;\n}\n\nexport interface ZoomData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n}\n\n/**\n * The `InteractionApi` provides methods that API developers can use to modify\n * the internal state of an interaction.\n */\nexport abstract class InteractionApi<T extends Camera = Camera> {\n protected currentCamera?: Camera;\n private activeRenderOptions?: CameraRenderOptions;\n private sceneLoadingPromise?: Promise<Scene>;\n private lastAngle: Angle.Angle | undefined;\n private worldRotationPoint?: Vector3.Vector3;\n\n protected panData?: PanData;\n protected zoomData?: ZoomData;\n\n public constructor(\n protected stream: StreamApi,\n private cursors: CursorManager,\n protected getConfig: InteractionConfigProvider,\n protected getScene: SceneProvider,\n protected getFrame: () => ReceivedFrame | undefined,\n public getViewport: () => Viewport,\n private tapEmitter: EventEmitter<TapEventDetails>,\n private doubleTapEmitter: EventEmitter<TapEventDetails>,\n private longPressEmitter: EventEmitter<TapEventDetails>,\n private interactionStartedEmitter: EventEmitter<void>,\n private interactionFinishedEmitter: EventEmitter<void>\n ) {\n this.tap = this.tap.bind(this);\n this.doubleTap = this.doubleTap.bind(this);\n this.longPress = this.longPress.bind(this);\n this.emitTapEvent = this.emitTapEvent.bind(this);\n }\n\n /**\n * Displays a cursor over the viewer with the given priority. Cursors with\n * higher priority will take precedence over cursors with lower priorities if\n * there's more than a single cursor added.\n *\n * @param cursor The cursor to add.\n * @param priority The priority of the cursor.\n * @returns A `Disposable` that can be used to remove the cursor.\n */\n public addCursor(cursor: Cursor, priority?: number): Disposable {\n return this.cursors.add(cursor, priority);\n }\n\n /**\n * Returns a 3D point in world space for the given 2D point in viewport space.\n *\n * @param point A point in 2D viewport space to transform.\n * @returns A 3D point in world space.\n */\n public async getWorldPointFromViewport(\n point: Point.Point\n ): Promise<Vector3.Vector3 | undefined> {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame == null) {\n throw new Error('Cannot get world point. Frame is undefined.');\n }\n\n const depthBuffer = await frame.depthBuffer();\n return depthBuffer != null\n ? viewport.transformPointToWorldSpace(point, depthBuffer, 0.5)\n : undefined;\n }\n\n /**\n * Returns the entity at the given point in viewport space.\n *\n * @param point A point in viewport space.\n * @returns The entity that was found.\n */\n public async getEntityTypeAtPoint(point: Point.Point): Promise<EntityType> {\n const viewport = this.getViewport();\n const featureMap = await this.getFrame()?.featureMap();\n\n if (featureMap != null) {\n const framePt = viewport.transformPointToFrame(point, featureMap);\n return featureMap.getEntityType(framePt);\n } else {\n return EntityType.NO_GEOMETRY;\n }\n }\n\n /**\n * Generates a ray from the given point, in viewport coordinates.\n *\n * @param point A point in viewport coordinates.\n * @returns A ray representing the direction of the point in world\n * coordinates.\n */\n public getRayFromPoint(point: Point.Point): Ray.Ray {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame != null) {\n return viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n } else throw new Error('Cannot get camera. Frame is undefined.');\n }\n\n /**\n * Emits a tap event with the provided position relative to the viewer\n * canvas, along with the set of modifier keys held (if applicable).\n *\n * @param position An {x, y} coordinate marking the position of the tap.\n * @param keyDetails A set of pressed keyboard keys that you want to include\n * in the tap event.\n */\n public async tap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(this.tapEmitter.emit, position, keyDetails, buttons);\n }\n\n public async doubleTap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(\n this.doubleTapEmitter.emit,\n position,\n keyDetails,\n buttons\n );\n }\n\n public async longPress(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(\n this.longPressEmitter.emit,\n position,\n keyDetails,\n buttons\n );\n }\n\n /**\n * Marks the start of an interaction. This method must be called before\n * performing any additional interaction operations. Use `endInteraction()` to\n * mark the end of an interaction.\n */\n public async beginInteraction(\n renderOptions: CameraRenderOptions = {}\n ): Promise<void> {\n if (!this.isInteracting()) {\n this.activeRenderOptions = renderOptions;\n this.interactionStartedEmitter.emit();\n this.sceneLoadingPromise = this.getScene();\n this.currentCamera = (await this.sceneLoadingPromise).camera();\n this.sceneLoadingPromise = undefined;\n await this.stream.beginInteraction();\n }\n }\n\n /**\n * Invokes a function to transform the scene's camera and request a new image\n * for the updated scene.\n *\n * @param t A function to transform the camera. Function will be passed the\n * camera and scene viewport and is expected to return an updated camera.\n */\n public async transformCamera(\n t: CameraTransform<T>,\n renderOptions: CameraRenderOptions = this.activeRenderOptions ?? {}\n ): Promise<void> {\n if (this.isInteracting()) {\n const scene = await this.getScene();\n const viewport = this.getViewport();\n const frame = this.getFrame();\n const depthBuffer = await frame?.depthBuffer();\n\n this.currentCamera =\n this.currentCamera != null && viewport != null && frame != null\n ? t({\n camera: this.currentCamera as T,\n viewport,\n scale: scene.scale(),\n boundingBox: scene.boundingBox(),\n frame,\n depthBuffer,\n })\n : undefined;\n\n await this.currentCamera?.render(renderOptions);\n }\n }\n\n /**\n * Performs a twist operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer or the angle to twist the camera by around the view vector.\n */\n public async twistCamera(delta: number): Promise<void>;\n public async twistCamera(delta: Point.Point): Promise<void>;\n public async twistCamera(...args: any[]): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n if (args.length === 1 && typeof args[0] === 'number') {\n const angleInRadians = Angle.toRadians(-args[0]);\n return camera.rotateAroundAxis(angleInRadians, axis);\n } else if (args.length === 1) {\n const center = Point.create(viewport.width / 2, viewport.height / 2);\n const currentAngle = Angle.toDegrees(Angle.fromPoints(center, args[0]));\n const angleDelta =\n this.lastAngle != null ? currentAngle - this.lastAngle : 0;\n\n this.lastAngle = currentAngle;\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n const angleInRadians = Angle.toRadians(-angleDelta);\n return camera.rotateAroundAxis(angleInRadians, axis);\n }\n return camera;\n });\n }\n\n /**\n * Moves the camera's position and look at to the given screen coordinate.\n *\n * If the screen coordinate intersects with an object, the camera will track\n * the hit point so the mouse position is always under the mouse.\n *\n * If the screen coordinate doesn't intersect with an object, then ???.\n *\n * @param screenPt A point in screen coordinates.\n */\n public async panCameraToScreenPoint(screenPt: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, frame, viewport, depthBuffer }) => {\n // Capture the starting state of the pan.\n if (this.panData == null) {\n const startingCamera = camera.toFrameCamera();\n const direction = startingCamera.direction;\n\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n direction,\n camera.lookAt\n );\n const fallback = Ray.intersectPlane(ray, fallbackPlane);\n if (fallback == null) {\n console.warn(\n 'Cannot determine fallback for pan. Ray does not intersect plane.'\n );\n return camera;\n }\n\n // Create a plane for the hit point that will be used to determine the\n // delta of future mouse movements to the original hit point. Fallback\n // to a plane placed at the look at point, in case there's no hit.\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(screenPt, depthBuffer, fallback)\n : fallback;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(direction, hitPt);\n\n this.panData = { hitPt, hitPlane, startingCamera };\n }\n\n if (this.panData != null) {\n const { hitPt, hitPlane, startingCamera } = this.panData;\n\n // Use a ray that originates at the screen and intersects with the hit\n // plane to determine the move distance.\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const movePt = Ray.intersectPlane(ray, hitPlane);\n\n if (movePt != null) {\n const delta = Vector3.subtract(hitPt, movePt);\n return camera.update(startingCamera).moveBy(delta);\n }\n }\n return camera;\n });\n }\n\n /**\n * Performs a view all operation for the scene's bounding box, and requests a\n * new image for the updated scene.\n */\n public async viewAll(): Promise<void> {\n await (await this.getScene()).camera().viewAll().render({});\n }\n\n /**\n * Performs a rotate operation of the scene around the camera's look at point,\n * and requests a new image for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async rotateCamera(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const upVector = Vector3.normalize(camera.up);\n const directionVector = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n const crossX = Vector3.cross(upVector, directionVector);\n const crossY = Vector3.cross(directionVector, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, directionVector);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n return camera.rotateAroundAxis(angle, rotationAxis);\n });\n }\n\n public async rotateCameraAtPoint(\n delta: Point.Point,\n point: Point.Point\n ): Promise<void> {\n return this.transformCamera(({ camera, viewport, depthBuffer }) => {\n if (this.worldRotationPoint == null) {\n this.worldRotationPoint =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, camera.lookAt)\n : camera.lookAt;\n }\n\n const upVector = Vector3.normalize(camera.up);\n const vv = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n const crossX = Vector3.cross(upVector, vv);\n const crossY = Vector3.cross(vv, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, vv);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n const updated = camera.rotateAroundAxisAtPoint(\n angle,\n this.worldRotationPoint,\n rotationAxis\n );\n\n return updated.update({\n // Scale the lookAt point to the same length as the distance to the\n // center of the bounding box to maintain zoom and pan behavior.\n lookAt: Vector3.add(\n Vector3.scale(\n Math.abs(camera.signedDistanceToBoundingBoxCenter()) /\n Vector3.magnitude(updated.viewVector),\n updated.viewVector\n ),\n updated.position\n ),\n });\n });\n }\n\n /**\n * Performs a zoom operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta The distance to zoom. Positive values zoom in and negative\n * values zoom out.\n */\n public async zoomCamera(delta: number): Promise<void> {\n return this.transformCamera(({ camera, viewport, frame, boundingBox }) => {\n if (viewport != null && frame != null) {\n const isPerspective = camera?.toFrameCamera().isPerspective();\n\n if (isPerspective) {\n const vv = camera.viewVector;\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 3 multiplier was chosen to match the desired zoom speed.\n const distance = Vector3.magnitude(vv);\n const relativeDeltaToViewportHeight =\n 3 * distance * (delta / viewport.height);\n\n // Scale the current viewVector by the scalar calculated above to determine how to adjust the camera position\n const v = Vector3.normalize(vv);\n const positionChange = Vector3.scale(\n relativeDeltaToViewportHeight,\n v\n );\n\n // Calculate the new camera position\n const position = Vector3.add(camera.position, positionChange);\n\n // Update the camera with the new position\n const newCamera = camera.update({ position });\n return newCamera;\n } else {\n // Retrieve properties of the current camera\n const orthographicCamera = camera as unknown as OrthographicCamera;\n const frameCam = camera.toFrameCamera();\n const dir = frameCam.direction;\n const ray = viewport.transformPointToRay(\n viewport.center,\n frame.image,\n frameCam\n );\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 4 multiplier was chosen to match the desired zoom speed.\n const relativeDeltaToViewportHeight = 4 * (delta / viewport.height);\n\n // Calculate the fovHeight after performing the zoom. zoomedFovHeight has the\n // same units of camera.fovHeight (the world units). The new fovHeight\n // has a minimum value, which is a function of the size of the bounding box,\n // which ensures the new fovHeight is a positive, non-zero number.\n const minimumFovHeight =\n Vector3.magnitude(BoundingBox.diagonal(boundingBox)) * 1e-5;\n const zoomedFovHeight = Math.max(\n minimumFovHeight,\n orthographicCamera.fovHeight * (1 - relativeDeltaToViewportHeight)\n );\n\n // Calculate the plane and point to zoom relative to\n const planeToZoomRelativeTo = Plane.fromNormalAndCoplanarPoint(\n dir,\n frameCam.lookAt\n );\n const pointToZoomRelativeTo = Ray.intersectPlane(\n ray,\n planeToZoomRelativeTo\n );\n\n if (pointToZoomRelativeTo != null) {\n // Project the current look at point onto the zoom plane\n const projectedLookAt = Plane.projectPoint(\n planeToZoomRelativeTo,\n orthographicCamera.lookAt\n );\n\n // Calculate the vector to determine how to adjust the camera's look at point.\n // Ensure that the viewVector is scaled to the expected length in order to\n // ensure other camera calculations are correct, for example, the occlusion\n // calculations for pins.\n const fovHeightRelativeChange =\n (orthographicCamera.fovHeight - zoomedFovHeight) /\n orthographicCamera.fovHeight;\n const lookAtChangeVector = Vector3.scale(\n fovHeightRelativeChange,\n Vector3.subtract(pointToZoomRelativeTo, projectedLookAt)\n );\n\n // Calculate the camera's new look at point\n const updatedLookAt = Vector3.add(\n orthographicCamera.lookAt,\n lookAtChangeVector\n );\n\n // Update the orthographic camera\n // Note rotationPoint should match lookAt after a zoom interaction\n const newCamera = camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n fovHeight: zoomedFovHeight,\n });\n return newCamera;\n }\n }\n }\n\n return camera;\n });\n }\n\n /**\n * Performs a pivot operation of the scene's camera, updating the lookAt\n * while maintaining the position, and requests a new image for the\n * updated scene.\n *\n * @param degreesLocalX The angle to rotate the lookAt point around the local x-axis\n * @param degreesLocalY The angle to rotate the lookAt point around the local y-axis\n */\n public async pivotCamera(\n degreesLocalX: number,\n degreesLocalY: number\n ): Promise<void> {\n return this.transformCamera(({ camera }) => {\n const { position, up, lookAt } = camera;\n const normalizedUp = Vector3.normalize(up);\n const normalizedViewVector = Vector3.normalize(camera.viewVector);\n const xVector = Vector3.cross(normalizedUp, normalizedViewVector);\n const yVector = Vector3.cross(normalizedViewVector, xVector);\n\n const updatedLookAtX = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalX),\n lookAt,\n xVector,\n position\n );\n const updatedLookAtY = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalY),\n updatedLookAtX,\n yVector,\n position\n );\n\n return camera.update({ ...camera, lookAt: updatedLookAtY });\n });\n }\n\n /**\n * Marks the end of an interaction.\n */\n public async endInteraction(): Promise<void> {\n await this.sceneLoadingPromise;\n\n if (this.isInteracting()) {\n this.currentCamera = undefined;\n this.worldRotationPoint = undefined;\n this.panData = undefined;\n this.zoomData = undefined;\n this.resetLastAngle();\n\n this.interactionFinishedEmitter.emit();\n await this.stream.endInteraction();\n }\n this.activeRenderOptions = undefined;\n }\n\n /**\n * resets the last recorded angle for a twist op\n */\n public resetLastAngle(): void {\n this.lastAngle = undefined;\n }\n\n /**\n * Indicates if the API is in an interacting state.\n */\n public isInteracting(): boolean {\n return this.currentCamera != null;\n }\n\n /**\n * Returns the pixel threshold that should be used to detect\n * movement based on the type of pointer input being coarse or fine.\n * This threshold is based on the configured `coarsePointerThreshold`\n * or the `finePointerThreshold` respectively.\n *\n * @param isTouch - Whether the event is a touch or not, if false or\n * undefined, a media query will be used to determine pointer type\n * @returns The pixel threshold.\n */\n public pixelThreshold(isTouch?: boolean): number {\n const pixelThreshold = this.isCoarseInputDevice(isTouch)\n ? this.getConfig().coarsePointerThreshold\n : this.getConfig().finePointerThreshold;\n\n return pixelThreshold * window.devicePixelRatio;\n }\n\n /**\n * Performs a hit test at the given point and returns a list of hit results\n * indicating any scene items that exist at the given point.\n *\n * @param pt A point, in viewport coordinates.\n * @returns A promise that resolves with the list of hit results.\n */\n public async hitItems(\n pt: Point.Point\n ): Promise<vertexvis.protobuf.stream.IHit[]> {\n const res = await (await this.getScene()).raycaster().hitItems(pt);\n return res?.hits ?? [];\n }\n\n private emitTapEvent(\n emit: (details: TapEventDetails) => void,\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): void {\n const {\n altKey = false,\n ctrlKey = false,\n metaKey = false,\n shiftKey = false,\n } = keyDetails;\n emit({\n position,\n altKey,\n ctrlKey,\n metaKey,\n shiftKey,\n buttons,\n });\n }\n\n private isCoarseInputDevice(isTouch?: boolean): boolean {\n return isTouch || window.matchMedia('(pointer: coarse)').matches;\n }\n\n protected getWorldPoint(\n point: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackPoint: Vector3.Vector3\n ): Vector3.Vector3 {\n const viewport = this.getViewport();\n const framePt = viewport.transformPointToFrame(point, depthBuffer);\n const hasDepth = depthBuffer.hitTest(framePt);\n return hasDepth\n ? viewport.transformPointToWorldSpace(point, depthBuffer)\n : fallbackPoint;\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public abstract panCameraByDelta(delta: Point.Point): Promise<void>;\n\n public abstract zoomCameraToPoint(\n point: Point.Point,\n delta: number\n ): Promise<void>;\n}\n"]}
@@ -81,7 +81,7 @@ export class ZoomInteraction extends MouseInteraction {
81
81
  super();
82
82
  this.interactionConfigProvider = interactionConfigProvider;
83
83
  this.type = 'zoom';
84
- this.didTransformBegin = false;
84
+ this.isTransforming = false;
85
85
  }
86
86
  async beginDrag(event, canvasPosition, api, element) {
87
87
  if (this.currentPosition == null) {
@@ -105,21 +105,21 @@ export class ZoomInteraction extends MouseInteraction {
105
105
  endDrag(event, api) {
106
106
  super.endDrag(event, api);
107
107
  this.stopInteractionTimer();
108
- this.didTransformBegin = false;
108
+ this.isTransforming = false;
109
109
  this.startPt = undefined;
110
110
  }
111
111
  async zoom(delta, api, extraDelayMs) {
112
- await this.operateWithTimer(api, () => api.zoomCamera(this.getDirectionalDelta(delta)), extraDelayMs);
112
+ await this.runWheelZoomInteraction(api, () => api.zoomCamera(this.getDirectionalDelta(delta)), extraDelayMs);
113
113
  }
114
114
  async zoomToPoint(pt, delta, api, extraDelayMs) {
115
- await this.operateWithTimer(api, () => api.zoomCameraToPoint(pt, this.getDirectionalDelta(delta)), extraDelayMs);
115
+ await this.runWheelZoomInteraction(api, () => api.zoomCameraToPoint(pt, this.getDirectionalDelta(delta)), extraDelayMs);
116
116
  }
117
117
  async beginInteraction(api) {
118
- this.didTransformBegin = true;
118
+ this.isTransforming = true;
119
119
  await api.beginInteraction();
120
120
  }
121
121
  async endInteraction(api) {
122
- this.didTransformBegin = false;
122
+ this.isTransforming = false;
123
123
  await api.endInteraction();
124
124
  }
125
125
  resetInteractionTimer(api, extraDelayMs) {
@@ -152,8 +152,8 @@ export class ZoomInteraction extends MouseInteraction {
152
152
  this.interactionTimer = undefined;
153
153
  }
154
154
  }
155
- async operateWithTimer(api, f, extraDelayMs) {
156
- if (!this.didTransformBegin) {
155
+ async runWheelZoomInteraction(api, f, extraDelayMs) {
156
+ if (!this.isTransforming) {
157
157
  await this.beginInteraction(api);
158
158
  }
159
159
  this.resetInteractionTimer(api, extraDelayMs);
@@ -1 +1 @@
1
- {"version":3,"file":"mouseInteractions.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/mouseInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAIhD,MAA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import { InteractionType } from './baseInteractionHandler';\nimport { InteractionApi, InteractionConfigProvider } from './interactionApi';\n\nexport abstract class MouseInteraction {\n protected currentPosition: Point.Point | undefined;\n\n protected abstract type: InteractionType;\n\n public setPosition(position?: Point.Point): void {\n this.currentPosition = position;\n }\n\n public getPosition(): Point.Point | undefined {\n return this.currentPosition;\n }\n\n public getType(): InteractionType {\n return this.type;\n }\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): void {\n // noop\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n // noop\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null) {\n api.endInteraction();\n this.currentPosition = undefined;\n }\n }\n\n public async zoom(delta: number, api: InteractionApi): Promise<void> {\n // noop\n }\n}\n\nexport class RotateInteraction extends MouseInteraction {\n public type: InteractionType = 'rotate';\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null) {\n const position = Point.create(event.screenX, event.screenY);\n const delta = Point.subtract(position, this.currentPosition);\n\n api.rotateCamera(delta);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class RotatePointInteraction extends MouseInteraction {\n public type: InteractionType = 'rotate-point';\n\n private startingPosition?: Point.Point;\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n this.startingPosition = canvasPosition;\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null && this.startingPosition != null) {\n const position = Point.create(event.screenX, event.screenY);\n const delta = Point.subtract(position, this.currentPosition);\n\n api.rotateCameraAtPoint(delta, this.startingPosition);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class ZoomInteraction extends MouseInteraction {\n public type: InteractionType = 'zoom';\n\n private didTransformBegin = false;\n private interactionTimer: number | undefined;\n private startPt?: Point.Point;\n\n public constructor(\n private interactionConfigProvider: InteractionConfigProvider\n ) {\n super();\n }\n\n public async beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): Promise<void> {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.clientX, event.clientY);\n const rect = element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n this.startPt = point;\n await api.beginInteraction();\n }\n }\n\n public async drag(event: MouseEvent, api: InteractionApi): Promise<void> {\n if (this.currentPosition != null) {\n const position = Point.create(event.clientX, event.clientY);\n const delta = Point.subtract(position, this.currentPosition);\n\n if (this.startPt != null) {\n await api.zoomCameraToPoint(this.startPt, delta.y);\n this.currentPosition = position;\n }\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n this.stopInteractionTimer();\n this.didTransformBegin = false;\n this.startPt = undefined;\n }\n\n public async zoom(\n delta: number,\n api: InteractionApi,\n extraDelayMs?: number\n ): Promise<void> {\n await this.operateWithTimer(\n api,\n () => api.zoomCamera(this.getDirectionalDelta(delta)),\n extraDelayMs\n );\n }\n\n public async zoomToPoint(\n pt: Point.Point,\n delta: number,\n api: InteractionApi,\n extraDelayMs?: number\n ): Promise<void> {\n await this.operateWithTimer(\n api,\n () => api.zoomCameraToPoint(pt, this.getDirectionalDelta(delta)),\n extraDelayMs\n );\n }\n\n private async beginInteraction(api: InteractionApi): Promise<void> {\n this.didTransformBegin = true;\n await api.beginInteraction();\n }\n\n private async endInteraction(api: InteractionApi): Promise<void> {\n this.didTransformBegin = false;\n await api.endInteraction();\n }\n\n private resetInteractionTimer(\n api: InteractionApi,\n extraDelayMs?: number\n ): void {\n this.stopInteractionTimer();\n this.startInteractionTimer(api, extraDelayMs);\n }\n\n private getDirectionalDelta(delta: number): number {\n return this.interactionConfigProvider().reverseMouseWheelDirection\n ? -delta\n : delta;\n }\n\n /**\n * If this value gets too low, can cause animation jitter in certain scenarios\n */\n private getInteractionDelay(): number {\n return this.interactionConfigProvider().mouseWheelInteractionEndDebounce;\n }\n\n /**\n * Uses a configured interaction delay, but certain interactions like wheel zoom benefit from extra delay\n */\n private startInteractionTimer(api: InteractionApi, extraDelayMs = 0): void {\n this.interactionTimer = window.setTimeout(async () => {\n this.interactionTimer = undefined;\n await this.endInteraction(api);\n }, extraDelayMs + this.getInteractionDelay());\n }\n\n private stopInteractionTimer(): void {\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n }\n\n private async operateWithTimer(\n api: InteractionApi,\n f: () => void | Promise<void>,\n extraDelayMs?: number\n ): Promise<void> {\n if (!this.didTransformBegin) {\n await this.beginInteraction(api);\n }\n\n this.resetInteractionTimer(api, extraDelayMs);\n f();\n }\n}\n\nexport class PanInteraction extends MouseInteraction {\n public type: InteractionType = 'pan';\n\n private canvasRect?: DOMRect;\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n this.canvasRect = element.getBoundingClientRect();\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null && this.canvasRect != null) {\n const position = getMouseClientPosition(event, this.canvasRect);\n api.panCameraToScreenPoint(position);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class TwistInteraction extends MouseInteraction {\n public type: InteractionType = 'twist';\n\n private canvasRect?: DOMRect;\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): void {\n this.currentPosition = Point.create(event.offsetX, event.offsetY);\n this.canvasRect = element.getBoundingClientRect();\n api.beginInteraction();\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n const position = getMouseClientPosition(event, this.canvasRect);\n this.currentPosition = position;\n\n api.twistCamera(position);\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class PivotInteraction extends MouseInteraction {\n public type: InteractionType = 'pivot';\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null) {\n const position = Point.create(event.screenX, event.screenY);\n const delta = Point.subtract(position, this.currentPosition);\n\n api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n"]}
1
+ {"version":3,"file":"mouseInteractions.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/mouseInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAIhD,MAAM,OAAgB,gBAAgB;IAK7B,WAAW,CAAC,QAAsB;QACvC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;IAClC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,SAAS,CACd,KAAiB,EACjB,cAA2B,EAC3B,GAAmB,EACnB,OAAoB;QAEpB,OAAO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,SAAS,CACd,KAAiB,EACjB,cAA2B,EAC3B,GAAmB;QAEnB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE,CAAC;YACjC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAClE,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAEM,IAAI,CAAC,KAAiB,EAAE,GAAmB;QAChD,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YAE7D,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;QAClC,CAAC;IACH,CAAC;IAEM,OAAO,CAAC,KAAiB,EAAE,GAAmB;QACnD,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\n\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionType } from './baseInteractionHandler';\nimport { InteractionApi, InteractionConfigProvider } from './interactionApi';\n\nexport abstract class MouseInteraction {\n protected currentPosition: Point.Point | undefined;\n\n protected abstract type: InteractionType;\n\n public setPosition(position?: Point.Point): void {\n this.currentPosition = position;\n }\n\n public getPosition(): Point.Point | undefined {\n return this.currentPosition;\n }\n\n public getType(): InteractionType {\n return this.type;\n }\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): void {\n // noop\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n // noop\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null) {\n api.endInteraction();\n this.currentPosition = undefined;\n }\n }\n\n public async zoom(delta: number, api: InteractionApi): Promise<void> {\n // noop\n }\n}\n\nexport class RotateInteraction extends MouseInteraction {\n public type: InteractionType = 'rotate';\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null) {\n const position = Point.create(event.screenX, event.screenY);\n const delta = Point.subtract(position, this.currentPosition);\n\n api.rotateCamera(delta);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class RotatePointInteraction extends MouseInteraction {\n public type: InteractionType = 'rotate-point';\n\n private startingPosition?: Point.Point;\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n this.startingPosition = canvasPosition;\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null && this.startingPosition != null) {\n const position = Point.create(event.screenX, event.screenY);\n const delta = Point.subtract(position, this.currentPosition);\n\n api.rotateCameraAtPoint(delta, this.startingPosition);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class ZoomInteraction extends MouseInteraction {\n public type: InteractionType = 'zoom';\n\n private isTransforming = false;\n private interactionTimer: number | undefined;\n private startPt?: Point.Point;\n\n public constructor(\n private interactionConfigProvider: InteractionConfigProvider\n ) {\n super();\n }\n\n public async beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): Promise<void> {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.clientX, event.clientY);\n const rect = element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n this.startPt = point;\n await api.beginInteraction();\n }\n }\n\n public async drag(event: MouseEvent, api: InteractionApi): Promise<void> {\n if (this.currentPosition != null) {\n const position = Point.create(event.clientX, event.clientY);\n const delta = Point.subtract(position, this.currentPosition);\n\n if (this.startPt != null) {\n await api.zoomCameraToPoint(this.startPt, delta.y);\n this.currentPosition = position;\n }\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n this.stopInteractionTimer();\n this.isTransforming = false;\n this.startPt = undefined;\n }\n\n public async zoom(\n delta: number,\n api: InteractionApi,\n extraDelayMs?: number\n ): Promise<void> {\n await this.runWheelZoomInteraction(\n api,\n () => api.zoomCamera(this.getDirectionalDelta(delta)),\n extraDelayMs\n );\n }\n\n public async zoomToPoint(\n pt: Point.Point,\n delta: number,\n api: InteractionApi,\n extraDelayMs?: number\n ): Promise<void> {\n await this.runWheelZoomInteraction(\n api,\n () => api.zoomCameraToPoint(pt, this.getDirectionalDelta(delta)),\n extraDelayMs\n );\n }\n\n private async beginInteraction(api: InteractionApi): Promise<void> {\n this.isTransforming = true;\n await api.beginInteraction();\n }\n\n private async endInteraction(api: InteractionApi): Promise<void> {\n this.isTransforming = false;\n await api.endInteraction();\n }\n\n private resetInteractionTimer(\n api: InteractionApi,\n extraDelayMs?: number\n ): void {\n this.stopInteractionTimer();\n this.startInteractionTimer(api, extraDelayMs);\n }\n\n private getDirectionalDelta(delta: number): number {\n return this.interactionConfigProvider().reverseMouseWheelDirection\n ? -delta\n : delta;\n }\n\n /**\n * If this value gets too low, can cause animation jitter in certain scenarios\n */\n private getInteractionDelay(): number {\n return this.interactionConfigProvider().mouseWheelInteractionEndDebounce;\n }\n\n /**\n * Uses a configured interaction delay, but certain interactions like wheel zoom benefit from extra delay\n */\n private startInteractionTimer(api: InteractionApi, extraDelayMs = 0): void {\n this.interactionTimer = window.setTimeout(async () => {\n this.interactionTimer = undefined;\n await this.endInteraction(api);\n }, extraDelayMs + this.getInteractionDelay());\n }\n\n private stopInteractionTimer(): void {\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n }\n\n private async runWheelZoomInteraction(\n api: InteractionApi,\n f: () => void | Promise<void>,\n extraDelayMs?: number\n ): Promise<void> {\n if (!this.isTransforming) {\n await this.beginInteraction(api);\n }\n\n this.resetInteractionTimer(api, extraDelayMs);\n f();\n }\n}\n\nexport class PanInteraction extends MouseInteraction {\n public type: InteractionType = 'pan';\n\n private canvasRect?: DOMRect;\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n this.canvasRect = element.getBoundingClientRect();\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null && this.canvasRect != null) {\n const position = getMouseClientPosition(event, this.canvasRect);\n api.panCameraToScreenPoint(position);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class TwistInteraction extends MouseInteraction {\n public type: InteractionType = 'twist';\n\n private canvasRect?: DOMRect;\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi,\n element: HTMLElement\n ): void {\n this.currentPosition = Point.create(event.offsetX, event.offsetY);\n this.canvasRect = element.getBoundingClientRect();\n api.beginInteraction();\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n const position = getMouseClientPosition(event, this.canvasRect);\n this.currentPosition = position;\n\n api.twistCamera(position);\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n\nexport class PivotInteraction extends MouseInteraction {\n public type: InteractionType = 'pivot';\n\n public beginDrag(\n event: MouseEvent,\n canvasPosition: Point.Point,\n api: InteractionApi\n ): void {\n if (this.currentPosition == null) {\n this.currentPosition = Point.create(event.screenX, event.screenY);\n api.beginInteraction();\n }\n }\n\n public drag(event: MouseEvent, api: InteractionApi): void {\n if (this.currentPosition != null) {\n const position = Point.create(event.screenX, event.screenY);\n const delta = Point.subtract(position, this.currentPosition);\n\n api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);\n this.currentPosition = position;\n }\n }\n\n public endDrag(event: MouseEvent, api: InteractionApi): void {\n super.endDrag(event, api);\n }\n}\n"]}
@@ -196,9 +196,9 @@ export class Camera {
196
196
  * Queues the rendering for a new frame using this camera. The returned
197
197
  * promise will resolve when a frame is received that contains this camera.
198
198
  */
199
- async render(renderOptions) {
200
- var _a, _b, _c;
201
- if (this.flyToOptions == null && renderOptions != null) {
199
+ async render(renderOptions = {}) {
200
+ var _a, _b, _c, _d;
201
+ if (this.flyToOptions == null && renderOptions.animation) {
202
202
  this.flyToOptions = {
203
203
  flyTo: {
204
204
  type: 'camera',
@@ -207,24 +207,24 @@ export class Camera {
207
207
  };
208
208
  }
209
209
  try {
210
- const corrId = UUID.create();
210
+ (_a = renderOptions.correlationId) !== null && _a !== void 0 ? _a : (renderOptions.correlationId = UUID.create());
211
211
  if (this.flyToOptions != null) {
212
- const payload = buildFlyToOperation(corrId, this.flyToOptions, renderOptions === null || renderOptions === void 0 ? void 0 : renderOptions.animation, this.toFrameCamera());
212
+ const payload = buildFlyToOperation(renderOptions.correlationId, this.flyToOptions, renderOptions.animation, this.toFrameCamera());
213
213
  const flyToResponse = await this.stream.flyTo(payload, true);
214
214
  return new CameraRenderResult(this.stream, this.decodeFrame, {
215
- correlationId: corrId,
216
- animationId: ((_b = (_a = flyToResponse.flyTo) === null || _a === void 0 ? void 0 : _a.animationId) === null || _b === void 0 ? void 0 : _b.hex) || undefined,
217
- }, ((_c = renderOptions === null || renderOptions === void 0 ? void 0 : renderOptions.animation) === null || _c === void 0 ? void 0 : _c.milliseconds) != null
215
+ correlationId: renderOptions.correlationId,
216
+ animationId: ((_c = (_b = flyToResponse.flyTo) === null || _b === void 0 ? void 0 : _b.animationId) === null || _c === void 0 ? void 0 : _c.hex) || undefined,
217
+ }, ((_d = renderOptions.animation) === null || _d === void 0 ? void 0 : _d.milliseconds) != null
218
218
  ? renderOptions.animation.milliseconds + DEFAULT_TIMEOUT_IN_MS
219
219
  : undefined);
220
220
  }
221
221
  else {
222
222
  this.stream.replaceCamera({
223
223
  camera: FrameCamera.toProtobuf(this.data),
224
- frameCorrelationId: { value: corrId },
224
+ frameCorrelationId: { value: renderOptions.correlationId },
225
225
  });
226
226
  return new CameraRenderResult(this.stream, this.decodeFrame, {
227
- correlationId: corrId,
227
+ correlationId: renderOptions.correlationId,
228
228
  });
229
229
  }
230
230
  }