@vertexvis/viewer 0.23.8-canary.2 → 0.23.8

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.
@@ -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;EASlC,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;IAV5C,WAAM,GAAN,MAAM,CAAW;IACnB,YAAO,GAAP,OAAO,CAAe;IACpB,cAAS,GAAT,SAAS,CAA2B;IACpC,aAAQ,GAAR,QAAQ,CAAe;IACvB,aAAQ,GAAR,QAAQ,CAAiC;IAC5C,gBAAW,GAAX,WAAW,CAAgB;IAC1B,eAAU,GAAV,UAAU,CAA+B;IACzC,qBAAgB,GAAhB,gBAAgB,CAA+B;IAC/C,qBAAgB,GAAhB,gBAAgB,CAA+B;IAC/C,8BAAyB,GAAzB,yBAAyB,CAAoB;IAC7C,+BAA0B,GAA1B,0BAA0B,CAAoB;IAEtD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,YAAY,GA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AClD,CAAC;EAED;;;;;;KAMG;EACI,KAAK,CAAC,QAAQ,CACnB,EAAe;;IAEf,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnE,OAAO,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,mCAAI,EAAE,CAAC;EACzB,CAAC;EAEO,YAAY,CAClB,IAAwC,EACxC,QAAqB,EACrB,aAAoC,EAAE,EACtC,OAAO,GAAG,CAAC;IAEX,MAAM,EACJ,MAAM,GAAG,KAAK,EACd,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,GACjB,GAAG,UAAU,CAAC;IACf,IAAI,CAAC;MACH,QAAQ;MACR,MAAM;MACN,OAAO;MACP,OAAO;MACP,QAAQ;MACR,OAAO;KACR,CAAC,CAAC;EACL,CAAC;EAEO,mBAAmB,CAAC,OAAiB;IAC3C,OAAO,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC;EACnE,CAAC;EAES,aAAa,CACrB,KAAkB,EAClB,WAAwB,EACxB,aAA8B;IAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,QAAQ;MACb,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC;MACzD,CAAC,CAAC,aAAa,CAAC;EACpB,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, boundingBox }) => {\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(\n ({ camera, viewport, boundingBox, depthBuffer }) => {\n if (this.worldRotationPoint == null) {\n const worldCenter = BoundingBox.center(boundingBox);\n this.worldRotationPoint =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, worldCenter)\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 /**\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;EASlC,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;IAV5C,WAAM,GAAN,MAAM,CAAW;IACnB,YAAO,GAAP,OAAO,CAAe;IACpB,cAAS,GAAT,SAAS,CAA2B;IACpC,aAAQ,GAAR,QAAQ,CAAe;IACvB,aAAQ,GAAR,QAAQ,CAAiC;IAC5C,gBAAW,GAAX,WAAW,CAAgB;IAC1B,eAAU,GAAV,UAAU,CAA+B;IACzC,qBAAgB,GAAhB,gBAAgB,CAA+B;IAC/C,qBAAgB,GAAhB,gBAAgB,CAA+B;IAC/C,8BAAyB,GAAzB,yBAAyB,CAAoB;IAC7C,+BAA0B,GAA1B,0BAA0B,CAAoB;IAEtD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC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Content":["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"]}
@@ -691,7 +691,7 @@ class InteractionApi {
691
691
  * viewer.
692
692
  */
693
693
  async rotateCamera(delta) {
694
- return this.transformCamera(({ camera, viewport, boundingBox }) => {
694
+ return this.transformCamera(({ camera, viewport }) => {
695
695
  const upVector = vector3.normalize(camera.up);
696
696
  const directionVector = vector3.normalize(vector3.subtract(camera.lookAt, camera.position));
697
697
  const crossX = vector3.cross(upVector, directionVector);
@@ -710,12 +710,11 @@ class InteractionApi {
710
710
  });
711
711
  }
712
712
  async rotateCameraAtPoint(delta, point) {
713
- return this.transformCamera(({ camera, viewport, boundingBox: boundingBox$1, depthBuffer }) => {
713
+ return this.transformCamera(({ camera, viewport, depthBuffer }) => {
714
714
  if (this.worldRotationPoint == null) {
715
- const worldCenter = boundingBox.center(boundingBox$1);
716
715
  this.worldRotationPoint =
717
716
  depthBuffer != null
718
- ? this.getWorldPoint(point, depthBuffer, worldCenter)
717
+ ? this.getWorldPoint(point, depthBuffer, camera.lookAt)
719
718
  : camera.lookAt;
720
719
  }
721
720
  const upVector = vector3.normalize(camera.up);
@@ -2932,8 +2931,13 @@ const Viewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
2932
2931
  */
2933
2932
  this.keyboardControls = true;
2934
2933
  /**
2935
- * Enables or disables the default rotation interaction being changed to
2936
- * rotate around the pointer down location.
2934
+ * Sets the rotation interaction behavior. True by default.
2935
+ *
2936
+ * When rotateAroundTapPoint is true and the user clicks on geometry, then the model will rotate
2937
+ * around the point that was clicked. When rotateAroundTapPoint is true and the user clicks
2938
+ * in empty space (not on geometry), then the model will rotate around the center of the viewport.
2939
+ *
2940
+ * When rotateAroundTapPoint is false, then the model will always rotate around the center of the viewport.
2937
2941
  */
2938
2942
  this.rotateAroundTapPoint = true;
2939
2943
  /**