@inweb/viewer-three 26.2.2 → 26.3.1
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":"viewer-three.module.js","sources":["../src/Viewer/helpers/PlaneHelper.ts","../src/Viewer/controls/OrbitControls.js","../src/Viewer/draggers/OrbitDragger.ts","../src/Viewer/draggers/CuttingPlaneDragger.ts","../src/Viewer/draggers/CuttingPlaneXAxis.ts","../src/Viewer/draggers/CuttingPlaneYAxis.ts","../src/Viewer/draggers/CuttingPlaneZAxis.ts","../src/Viewer/draggers/MeasureLineDragger.ts","../src/Viewer/draggers/PanDragger.ts","../src/Viewer/controls/WalkControls.ts","../src/Viewer/draggers/WalkDragger.ts","../src/Viewer/draggers/ZoomDragger.ts","../src/Viewer/draggers/index.ts","../src/Viewer/commands/ApplyModelTransform.ts","../src/Viewer/commands/ClearMarkup.ts","../src/Viewer/components/SelectionComponent.ts","../src/Viewer/commands/ClearSelected.ts","../src/Viewer/commands/ClearSlices.ts","../src/Viewer/commands/CreatePreview.ts","../src/Viewer/commands/Explode.ts","../src/Viewer/commands/ZoomTo.ts","../src/Viewer/commands/SetDefaultViewPosition.ts","../src/Viewer/commands/GetDefaultViewPositions.ts","../src/Viewer/commands/GetModels.ts","../src/Viewer/commands/GetSelected.ts","../src/Viewer/commands/HideSelected.ts","../src/Viewer/commands/IsolateSelected.ts","../src/Viewer/commands/RegenerateAll.ts","../src/Viewer/commands/ResetView.ts","../src/Viewer/commands/SelectModel.ts","../src/Viewer/commands/SetActiveDragger.ts","../src/Viewer/commands/SetMarkupColor.ts","../src/Viewer/commands/SetSelected.ts","../src/Viewer/commands/ShowAll.ts","../src/Viewer/commands/ZoomToExtents.ts","../src/Viewer/commands/ZoomToObjects.ts","../src/Viewer/commands/ZoomToSelected.ts","../src/Viewer/commands/index.ts","../src/Viewer/components/BackgroundComponent.ts","../src/Viewer/components/CameraComponent.ts","../src/Viewer/components/ExtentsComponent.ts","../src/Viewer/components/RenderLoopComponent.ts","../src/Viewer/components/ResizeCanvasComponent.ts","../src/Viewer/helpers/WCSHelper.ts","../src/Viewer/components/WCSHelperComponent.ts","../src/Viewer/components/index.ts","../src/Viewer/loaders/GLTFLoadingManager.ts","../src/Viewer/Viewer.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport {\n BufferGeometry,\n DoubleSide,\n Float32BufferAttribute,\n Line,\n LineBasicMaterial,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Plane,\n Vector3,\n} from \"three\";\n\nclass PlaneHelper extends Line {\n public plane: Plane;\n public size: number;\n public offset: Vector3;\n public helper: Object3D;\n\n constructor(plane: Plane, size = 1, color = 0xffff00, offset: Vector3 = new Vector3()) {\n // const positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];\n const positions = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];\n\n const geometry = new BufferGeometry();\n geometry.setAttribute(\"position\", new Float32BufferAttribute(positions, 3));\n geometry.computeBoundingSphere();\n\n super(geometry, new LineBasicMaterial({ color, toneMapped: false }));\n\n (this as any).type = \"PlaneHelper\";\n\n this.plane = plane;\n this.size = size;\n this.offset = offset;\n\n const positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const geometry2 = new BufferGeometry();\n geometry2.setAttribute(\"position\", new Float32BufferAttribute(positions2, 3));\n geometry2.computeBoundingSphere();\n\n this.helper = new Mesh(\n geometry2,\n new MeshBasicMaterial({\n color,\n opacity: 0.2,\n transparent: true,\n depthWrite: false,\n toneMapped: false,\n side: DoubleSide,\n })\n );\n this.add(this.helper);\n }\n\n dispose() {\n this.geometry.dispose();\n (this.material as any).dispose();\n (this.children[0] as any).geometry.dispose();\n (this.children[0] as any).material.dispose();\n }\n\n override updateMatrixWorld(force: boolean) {\n this.position.set(0, 0, 0);\n this.lookAt(this.plane.normal);\n\n this.position.copy(this.offset);\n this.translateZ(-(this.offset.dot(this.plane.normal) + this.plane.constant));\n\n this.scale.set(0.5 * this.size, 0.5 * this.size, 1);\n\n super.updateMatrixWorld(force);\n }\n}\n\nexport { PlaneHelper };\n","import { EventDispatcher, MOUSE, Quaternion, Spherical, TOUCH, Vector2, Vector3 } from \"three\";\n\n// OrbitControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nconst _changeEvent = { type: \"change\" };\nconst _startEvent = { type: \"start\" };\nconst _endEvent = { type: \"end\" };\n\nconst STATE = {\n NONE: -1,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_PAN: 4,\n TOUCH_DOLLY_PAN: 5,\n TOUCH_DOLLY_ROTATE: 6,\n};\n\nclass OrbitControls extends EventDispatcher {\n constructor(object, domElement) {\n super();\n\n this.object = object;\n this.domElement = domElement;\n this.domElement.style.touchAction = \"none\"; // disable touch scroll\n\n // Set to false to disable this control\n this.enabled = true;\n\n // \"target\" sets the location of focus, where the object orbits around\n this.target = new Vector3();\n\n // How far you can dolly in and out ( PerspectiveCamera only )\n this.minDistance = 0;\n this.maxDistance = Infinity;\n\n // How far you can zoom in and out ( OrthographicCamera only )\n this.minZoom = 0;\n this.maxZoom = Infinity;\n\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n\n // How far you can orbit horizontally, upper and lower limits.\n // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n this.minAzimuthAngle = -Infinity; // radians\n this.maxAzimuthAngle = Infinity; // radians\n\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n this.enableDamping = false;\n this.dampingFactor = 0.05;\n\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n this.enableZoom = true;\n this.zoomSpeed = 1.0;\n\n // Set to false to disable rotating\n this.enableRotate = true;\n this.rotateSpeed = 1.0;\n\n // Set to false to disable panning\n this.enablePan = true;\n this.panSpeed = 1.0;\n this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up\n this.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60\n\n // The four arrow keys\n this.keys = { LEFT: \"ArrowLeft\", UP: \"ArrowUp\", RIGHT: \"ArrowRight\", BOTTOM: \"ArrowDown\" };\n\n // Mouse buttons\n this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };\n\n // Touch fingers\n this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };\n\n // for reset\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.zoom0 = this.object.zoom;\n\n // the target DOM element for key events\n this._domElementKeyEvents = null;\n\n //\n // public methods\n //\n\n this.getPolarAngle = function () {\n return spherical.phi;\n };\n\n this.getAzimuthalAngle = function () {\n return spherical.theta;\n };\n\n this.getDistance = function () {\n return this.object.position.distanceTo(this.target);\n };\n\n this.listenToKeyEvents = function (domElement) {\n domElement.addEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = domElement;\n };\n\n this.stopListenToKeyEvents = function () {\n this._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = null;\n };\n\n this.saveState = function () {\n scope.target0.copy(scope.target);\n scope.position0.copy(scope.object.position);\n scope.zoom0 = scope.object.zoom;\n };\n\n this.reset = function () {\n scope.target.copy(scope.target0);\n scope.object.position.copy(scope.position0);\n scope.object.zoom = scope.zoom0;\n\n scope.object.updateProjectionMatrix();\n scope.dispatchEvent(_changeEvent);\n\n scope.update();\n\n scope.state = STATE.NONE;\n };\n\n // this method is exposed, but perhaps it would be better if we can make it private...\n this.update = (function () {\n const offset = new Vector3();\n\n // so camera.up is the orbit axis\n const quat = new Quaternion().setFromUnitVectors(object.up, new Vector3(0, 1, 0));\n const quatInverse = quat.clone().invert();\n\n const lastPosition = new Vector3();\n const lastQuaternion = new Quaternion();\n const lastTargetPosition = new Vector3();\n\n const twoPI = 2 * Math.PI;\n\n return function update() {\n const position = scope.object.position;\n\n offset.copy(position).sub(scope.target);\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat);\n\n // angle from z-axis around y-axis\n spherical.setFromVector3(offset);\n\n if (scope.autoRotate && scope.state === STATE.NONE) {\n rotateLeft(getAutoRotationAngle());\n }\n\n if (scope.enableDamping) {\n spherical.theta += sphericalDelta.theta * scope.dampingFactor;\n spherical.phi += sphericalDelta.phi * scope.dampingFactor;\n } else {\n spherical.theta += sphericalDelta.theta;\n spherical.phi += sphericalDelta.phi;\n }\n\n // restrict theta to be between desired limits\n\n let min = scope.minAzimuthAngle;\n let max = scope.maxAzimuthAngle;\n\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI) min += twoPI;\n else if (min > Math.PI) min -= twoPI;\n\n if (max < -Math.PI) max += twoPI;\n else if (max > Math.PI) max -= twoPI;\n\n if (min <= max) {\n spherical.theta = Math.max(min, Math.min(max, spherical.theta));\n } else {\n spherical.theta =\n spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);\n }\n }\n\n // restrict phi to be between desired limits\n spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));\n\n spherical.makeSafe();\n\n spherical.radius *= scope.scale;\n\n // restrict radius to be between desired limits\n spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));\n\n // move target to panned location\n\n if (scope.enableDamping === true) {\n scope.target.addScaledVector(scope.panOffset, scope.dampingFactor);\n } else {\n scope.target.add(scope.panOffset);\n }\n\n offset.setFromSpherical(spherical);\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse);\n\n position.copy(scope.target).add(offset);\n\n scope.object.lookAt(scope.target);\n\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor;\n sphericalDelta.phi *= 1 - scope.dampingFactor;\n\n scope.panOffset.multiplyScalar(1 - scope.dampingFactor);\n } else {\n sphericalDelta.set(0, 0, 0);\n\n scope.panOffset.set(0, 0, 0);\n }\n\n scope.scale = 1;\n\n // update condition is:\n // min(camera displacement, camera rotation in radians)^2 > EPS\n // using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n if (\n scope.zoomChanged ||\n lastPosition.distanceToSquared(scope.object.position) > EPS ||\n 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS ||\n lastTargetPosition.distanceToSquared(scope.target) > 0\n ) {\n scope.dispatchEvent(_changeEvent);\n\n lastPosition.copy(scope.object.position);\n lastQuaternion.copy(scope.object.quaternion);\n lastTargetPosition.copy(scope.target);\n\n scope.zoomChanged = false;\n\n return true;\n }\n\n return false;\n };\n })();\n\n this.dispose = function () {\n scope.domElement.removeEventListener(\"contextmenu\", onContextMenu);\n\n scope.domElement.removeEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.removeEventListener(\"pointercancel\", onPointerUp);\n scope.domElement.removeEventListener(\"wheel\", onMouseWheel);\n\n scope.domElement.removeEventListener(\"pointermove\", onPointerMove);\n scope.domElement.removeEventListener(\"pointerup\", onPointerUp);\n\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n scope._domElementKeyEvents = null;\n }\n\n //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n };\n\n //\n // internals\n //\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const scope = this;\n\n scope.state = STATE.NONE;\n\n const EPS = 0.000001;\n\n // current position in spherical coordinates\n const spherical = new Spherical();\n const sphericalDelta = new Spherical();\n\n scope.scale = 1;\n scope.panOffset = new Vector3();\n scope.zoomChanged = false;\n\n scope.rotateStart = new Vector2();\n scope.rotateEnd = new Vector2();\n scope.rotateDelta = new Vector2();\n\n scope.panStart = new Vector2();\n scope.panEnd = new Vector2();\n scope.panDelta = new Vector2();\n\n scope.dollyStart = new Vector2();\n scope.dollyEnd = new Vector2();\n scope.dollyDelta = new Vector2();\n scope.dollyScale = 0;\n\n scope.pointers = [];\n scope.pointerPositions = {};\n\n function getAutoRotationAngle() {\n return ((2 * Math.PI) / 60 / 60) * scope.autoRotateSpeed;\n }\n\n function getZoomScale() {\n return Math.pow(0.95, scope.zoomSpeed);\n }\n\n function rotateLeft(angle) {\n sphericalDelta.theta -= angle;\n }\n\n function rotateUp(angle) {\n sphericalDelta.phi -= angle;\n }\n\n const panLeft = (function () {\n const v = new Vector3();\n\n return function panLeft(distance, objectMatrix) {\n v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix\n v.multiplyScalar(-distance);\n\n scope.panOffset.add(v);\n };\n })();\n\n const panUp = (function () {\n const v = new Vector3();\n\n return function panUp(distance, objectMatrix) {\n if (scope.screenSpacePanning === true) {\n v.setFromMatrixColumn(objectMatrix, 1);\n } else {\n v.setFromMatrixColumn(objectMatrix, 0);\n v.crossVectors(scope.object.up, v);\n }\n\n v.multiplyScalar(distance);\n\n scope.panOffset.add(v);\n };\n })();\n\n // deltaX and deltaY are in pixels; right and down are positive\n const pan = (function () {\n const offset = new Vector3();\n\n return function pan(deltaX, deltaY) {\n const element = scope.domElement;\n\n if (scope.object.isPerspectiveCamera) {\n // perspective\n const position = scope.object.position;\n offset.copy(position).sub(scope.target);\n let targetDistance = offset.length();\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(((scope.object.fov / 2) * Math.PI) / 180.0);\n\n // we use only clientHeight here so aspect ratio does not distort speed\n panLeft((2 * deltaX * targetDistance) / element.clientHeight, scope.object.matrix);\n panUp((2 * deltaY * targetDistance) / element.clientHeight, scope.object.matrix);\n } else if (scope.object.isOrthographicCamera) {\n // orthographic\n panLeft(\n (deltaX * (scope.object.right - scope.object.left)) / scope.object.zoom / element.clientWidth,\n scope.object.matrix\n );\n panUp(\n (deltaY * (scope.object.top - scope.object.bottom)) / scope.object.zoom / element.clientHeight,\n scope.object.matrix\n );\n } else {\n // camera neither orthographic nor perspective\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.\");\n scope.enablePan = false;\n }\n };\n })();\n\n function dollyOut(dollyScale) {\n if (scope.object.isPerspectiveCamera) {\n scope.scale /= dollyScale;\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n scope.object.updateProjectionMatrix();\n scope.zoomChanged = true;\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n\n function dollyIn(dollyScale) {\n if (scope.object.isPerspectiveCamera) {\n scope.scale *= dollyScale;\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n scope.object.updateProjectionMatrix();\n scope.zoomChanged = true;\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n\n //\n // event callbacks - update the object state\n //\n\n function handleMouseDownRotate(event) {\n scope.rotateStart.set(event.clientX, event.clientY);\n }\n\n function handleMouseDownDolly(event) {\n scope.dollyStart.set(event.clientX, event.clientY);\n }\n\n function handleMouseDownPan(event) {\n scope.panStart.set(event.clientX, event.clientY);\n }\n\n function handleMouseMoveRotate(event) {\n scope.rotateEnd.set(event.clientX, event.clientY);\n\n scope.rotateDelta.subVectors(scope.rotateEnd, scope.rotateStart).multiplyScalar(scope.rotateSpeed);\n\n const element = scope.domElement;\n\n rotateLeft((2 * Math.PI * scope.rotateDelta.x) / element.clientHeight); // yes, height\n\n rotateUp((2 * Math.PI * scope.rotateDelta.y) / element.clientHeight);\n\n scope.rotateStart.copy(scope.rotateEnd);\n\n scope.update();\n }\n\n function handleMouseMoveDolly(event) {\n scope.dollyEnd.set(event.clientX, event.clientY);\n\n scope.dollyDelta.subVectors(scope.dollyEnd, scope.dollyStart);\n\n if (scope.dollyDelta.y < 0) {\n scope.dollyScale = 1 / getZoomScale();\n dollyOut(getZoomScale());\n } else if (scope.dollyDelta.y > 0) {\n scope.dollyScale = getZoomScale();\n dollyIn(getZoomScale());\n }\n\n scope.dollyStart.copy(scope.dollyEnd);\n\n scope.update();\n }\n\n function handleMouseMovePan(event) {\n scope.panEnd.set(event.clientX, event.clientY);\n\n scope.panDelta.subVectors(scope.panEnd, scope.panStart).multiplyScalar(scope.panSpeed);\n\n pan(scope.panDelta.x, scope.panDelta.y);\n\n scope.panStart.copy(scope.panEnd);\n\n scope.update();\n }\n\n function handleMouseWheel(event) {\n scope.dollyEnd.set(scope.domElement.clientWidth / 2, scope.domElement.clientHeight / 2);\n\n scope.dollyDelta.set(event.deltaX, event.deltaY);\n\n if (event.deltaY < 0) {\n scope.dollyScale = 1 / getZoomScale();\n dollyIn(getZoomScale());\n } else if (event.deltaY > 0) {\n scope.dollyScale = getZoomScale();\n dollyOut(getZoomScale());\n }\n\n scope.dollyStart.copy(scope.dollyEnd);\n\n scope.update();\n\n if (event.deltaY !== 0) {\n scope.state = STATE.DOLLY;\n scope.dispatchEvent(_changeEvent);\n scope.state = STATE.NONE;\n }\n }\n\n function handleKeyDown(event) {\n let needsUpdate = false;\n\n switch (event.code) {\n case scope.keys.UP:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateUp((2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(0, scope.keyPanSpeed);\n }\n\n needsUpdate = true;\n break;\n\n case scope.keys.BOTTOM:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateUp((-2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(0, -scope.keyPanSpeed);\n }\n\n needsUpdate = true;\n break;\n\n case scope.keys.LEFT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateLeft((2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(scope.keyPanSpeed, 0);\n }\n\n needsUpdate = true;\n break;\n\n case scope.keys.RIGHT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateLeft((-2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(-scope.keyPanSpeed, 0);\n }\n\n needsUpdate = true;\n break;\n }\n\n if (needsUpdate) {\n // prevent the browser from scrolling on cursor keys\n event.preventDefault();\n\n scope.update();\n }\n }\n\n function handleTouchStartRotate() {\n if (scope.pointers.length === 1) {\n scope.rotateStart.set(scope.pointers[0].pageX, scope.pointers[0].pageY);\n } else {\n const x = 0.5 * (scope.pointers[0].pageX + scope.pointers[1].pageX);\n const y = 0.5 * (scope.pointers[0].pageY + scope.pointers[1].pageY);\n\n scope.rotateStart.set(x, y);\n }\n }\n\n function handleTouchStartPan() {\n if (scope.pointers.length === 1) {\n scope.panStart.set(scope.pointers[0].pageX, scope.pointers[0].pageY);\n } else {\n const x = 0.5 * (scope.pointers[0].pageX + scope.pointers[1].pageX);\n const y = 0.5 * (scope.pointers[0].pageY + scope.pointers[1].pageY);\n\n scope.panStart.set(x, y);\n }\n }\n\n function handleTouchStartDolly() {\n const dx = scope.pointers[0].pageX - scope.pointers[1].pageX;\n const dy = scope.pointers[0].pageY - scope.pointers[1].pageY;\n\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n scope.dollyStart.set(0, distance);\n }\n\n function handleTouchStartDollyPan() {\n if (scope.enableZoom) handleTouchStartDolly();\n\n if (scope.enablePan) handleTouchStartPan();\n }\n\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom) handleTouchStartDolly();\n\n if (scope.enableRotate) handleTouchStartRotate();\n }\n\n function handleTouchMoveRotate(event) {\n if (scope.pointers.length == 1) {\n scope.rotateEnd.set(event.pageX, event.pageY);\n } else {\n const position = getSecondPointerPosition(event);\n\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n\n scope.rotateEnd.set(x, y);\n }\n\n scope.rotateDelta.subVectors(scope.rotateEnd, scope.rotateStart).multiplyScalar(scope.rotateSpeed);\n\n const element = scope.domElement;\n\n rotateLeft((2 * Math.PI * scope.rotateDelta.x) / element.clientHeight); // yes, height\n\n rotateUp((2 * Math.PI * scope.rotateDelta.y) / element.clientHeight);\n\n scope.rotateStart.copy(scope.rotateEnd);\n }\n\n function handleTouchMovePan(event) {\n if (scope.pointers.length === 1) {\n scope.panEnd.set(event.pageX, event.pageY);\n } else {\n const position = getSecondPointerPosition(event);\n\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n\n scope.panEnd.set(x, y);\n }\n\n scope.panDelta.subVectors(scope.panEnd, scope.panStart).multiplyScalar(scope.panSpeed);\n\n pan(scope.panDelta.x, scope.panDelta.y);\n\n scope.panStart.copy(scope.panEnd);\n }\n\n function handleTouchMoveDolly(event) {\n const position = getSecondPointerPosition(event);\n\n const dx = event.pageX - position.x;\n const dy = event.pageY - position.y;\n\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n scope.dollyEnd.set(0, distance);\n\n scope.dollyDelta.set(0, Math.pow(scope.dollyEnd.y / scope.dollyStart.y, scope.zoomSpeed));\n\n dollyOut(scope.dollyDelta.y);\n\n scope.dollyStart.copy(scope.dollyEnd);\n }\n\n function handleTouchMoveDollyPan(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n\n if (scope.enablePan) handleTouchMovePan(event);\n }\n\n function handleTouchMoveDollyRotate(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n\n if (scope.enableRotate) handleTouchMoveRotate(event);\n }\n\n //\n // event handlers - FSM: listen for events and reset state\n //\n\n function onPointerDown(event) {\n if (scope.enabled === false) return;\n\n if (scope.pointers.length === 0) {\n scope.domElement.setPointerCapture(event.pointerId);\n\n scope.domElement.addEventListener(\"pointermove\", onPointerMove);\n scope.domElement.addEventListener(\"pointerup\", onPointerUp);\n }\n\n //\n\n addPointer(event);\n\n if (event.pointerType === \"touch\") {\n onTouchStart(event);\n } else {\n onMouseDown(event);\n }\n }\n\n function onPointerMove(event) {\n if (scope.enabled === false) return;\n\n if (event.pointerType === \"touch\") {\n onTouchMove(event);\n } else {\n onMouseMove(event);\n }\n }\n\n function onPointerUp(event) {\n removePointer(event);\n\n if (scope.pointers.length === 0) {\n scope.domElement.releasePointerCapture(event.pointerId);\n\n scope.domElement.removeEventListener(\"pointermove\", onPointerMove);\n scope.domElement.removeEventListener(\"pointerup\", onPointerUp);\n }\n\n scope.dispatchEvent(_endEvent);\n\n scope.state = STATE.NONE;\n }\n\n function onMouseDown(event) {\n let mouseAction;\n\n switch (event.button) {\n case 0:\n mouseAction = scope.mouseButtons.LEFT;\n break;\n\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE;\n break;\n\n case 2:\n mouseAction = scope.mouseButtons.RIGHT;\n break;\n\n default:\n mouseAction = -1;\n }\n\n switch (mouseAction) {\n case MOUSE.DOLLY:\n if (scope.enableZoom === false) return;\n\n handleMouseDownDolly(event);\n\n scope.state = STATE.DOLLY;\n\n break;\n\n case MOUSE.ROTATE:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enablePan === false) return;\n\n handleMouseDownPan(event);\n\n scope.state = STATE.PAN;\n } else {\n if (scope.enableRotate === false) return;\n\n handleMouseDownRotate(event);\n\n scope.state = STATE.ROTATE;\n }\n\n break;\n\n case MOUSE.PAN:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enableRotate === false) return;\n\n handleMouseDownRotate(event);\n\n scope.state = STATE.ROTATE;\n } else {\n if (scope.enablePan === false) return;\n\n handleMouseDownPan(event);\n\n scope.state = STATE.PAN;\n }\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n if (scope.state !== STATE.NONE) {\n scope.dispatchEvent(_startEvent);\n }\n }\n\n function onMouseMove(event) {\n switch (scope.state) {\n case STATE.ROTATE:\n if (scope.enableRotate === false) return;\n\n handleMouseMoveRotate(event);\n\n break;\n\n case STATE.DOLLY:\n if (scope.enableZoom === false) return;\n\n handleMouseMoveDolly(event);\n\n break;\n\n case STATE.PAN:\n if (scope.enablePan === false) return;\n\n handleMouseMovePan(event);\n\n break;\n }\n }\n\n function onMouseWheel(event) {\n if (scope.enabled === false || scope.enableZoom === false || scope.state !== STATE.NONE) return;\n\n event.preventDefault();\n\n scope.dispatchEvent(_startEvent);\n\n handleMouseWheel(event);\n\n scope.dispatchEvent(_endEvent);\n }\n\n function onKeyDown(event) {\n if (scope.enabled === false || scope.enablePan === false) return;\n\n handleKeyDown(event);\n }\n\n function onTouchStart(event) {\n trackPointer(event);\n\n switch (scope.pointers.length) {\n case 1:\n switch (scope.touches.ONE) {\n case TOUCH.ROTATE:\n if (scope.enableRotate === false) return;\n\n handleTouchStartRotate();\n\n scope.state = STATE.TOUCH_ROTATE;\n\n break;\n\n case TOUCH.PAN:\n if (scope.enablePan === false) return;\n\n handleTouchStartPan();\n\n scope.state = STATE.TOUCH_PAN;\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n break;\n\n case 2:\n switch (scope.touches.TWO) {\n case TOUCH.DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n\n handleTouchStartDollyPan();\n\n scope.state = STATE.TOUCH_DOLLY_PAN;\n\n break;\n\n case TOUCH.DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n\n handleTouchStartDollyRotate();\n\n scope.state = STATE.TOUCH_DOLLY_ROTATE;\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n if (scope.state !== STATE.NONE) {\n scope.dispatchEvent(_startEvent);\n }\n }\n\n function onTouchMove(event) {\n trackPointer(event);\n\n switch (scope.state) {\n case STATE.TOUCH_ROTATE:\n if (scope.enableRotate === false) return;\n\n handleTouchMoveRotate(event);\n\n scope.update();\n\n break;\n\n case STATE.TOUCH_PAN:\n if (scope.enablePan === false) return;\n\n handleTouchMovePan(event);\n\n scope.update();\n\n break;\n\n case STATE.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n\n handleTouchMoveDollyPan(event);\n\n scope.update();\n\n break;\n\n case STATE.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n\n handleTouchMoveDollyRotate(event);\n\n scope.update();\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n }\n\n function onContextMenu(event) {\n if (scope.enabled === false) return;\n\n event.preventDefault();\n }\n\n function addPointer(event) {\n scope.pointers.push(event);\n }\n\n function removePointer(event) {\n delete scope.pointerPositions[event.pointerId];\n\n for (let i = 0; i < scope.pointers.length; i++) {\n if (scope.pointers[i].pointerId == event.pointerId) {\n scope.pointers.splice(i, 1);\n return;\n }\n }\n }\n\n function trackPointer(event) {\n let position = scope.pointerPositions[event.pointerId];\n\n if (position === undefined) {\n position = new Vector2();\n scope.pointerPositions[event.pointerId] = position;\n }\n\n position.set(event.pageX, event.pageY);\n }\n\n function getSecondPointerPosition(event) {\n const pointer = event.pointerId === scope.pointers[0].pointerId ? scope.pointers[1] : scope.pointers[0];\n\n return scope.pointerPositions[pointer.pointerId];\n }\n\n //\n\n scope.domElement.addEventListener(\"contextmenu\", onContextMenu);\n\n scope.domElement.addEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.addEventListener(\"pointercancel\", onPointerUp);\n scope.domElement.addEventListener(\"wheel\", onMouseWheel, { passive: false });\n\n // force an update at start\n\n this.update();\n }\n}\n\nexport { OrbitControls, STATE };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { MOUSE, TOUCH } from \"three\";\nimport { type IDragger } from \"@inweb/viewer-core\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { OrbitControls, STATE } from \"../controls/OrbitControls.js\";\n\nexport class OrbitDragger implements IDragger {\n protected viewer: Viewer;\n protected orbit: OrbitControls;\n protected changed: boolean;\n\n constructor(viewer: Viewer) {\n this.orbit = new OrbitControls(viewer.camera, viewer.canvas);\n this.orbit.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN };\n this.orbit.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };\n this.orbit.screenSpacePanning = true;\n this.orbit.rotateSpeed = 0.33;\n this.orbit.addEventListener(\"start\", this.controlsStart);\n this.orbit.addEventListener(\"change\", this.controlsChange);\n this.changed = false;\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.updateControls);\n this.viewer.on(\"viewposition\", this.updateControls);\n this.viewer.addEventListener(\"zoom\", this.updateControls);\n this.viewer.addEventListener(\"drawviewpoint\", this.updateControls);\n this.viewer.addEventListener(\"contextmenu\", this.stopContextMenu);\n this.updateControls();\n }\n\n initialize() {}\n\n dispose(): void {\n this.viewer.removeEventListener(\"databasechunk\", this.updateControls);\n this.viewer.off(\"viewposition\", this.updateControls);\n this.viewer.removeEventListener(\"zoom\", this.updateControls);\n this.viewer.removeEventListener(\"drawviewpoint\", this.updateControls);\n this.viewer.removeEventListener(\"contextmenu\", this.stopContextMenu);\n\n this.orbit.removeEventListener(\"start\", this.controlsStart);\n this.orbit.removeEventListener(\"change\", this.controlsChange);\n this.orbit.dispose();\n }\n\n updateControls = () => {\n this.orbit.maxDistance = this.viewer.camera.far;\n this.orbit.minDistance = this.viewer.camera.near;\n this.orbit.object = this.viewer.camera;\n this.orbit.target.copy(this.viewer.target);\n this.orbit.update();\n };\n\n controlsStart = () => {\n this.changed = false;\n };\n\n controlsChange = () => {\n this.viewer.target.copy(this.orbit.target);\n this.viewer.update();\n\n switch (this.orbit.state) {\n case STATE.PAN:\n case STATE.TOUCH_PAN:\n this.viewer.emitEvent({\n type: \"pan\",\n x: this.orbit.panEnd.x,\n y: this.orbit.panEnd.y,\n dX: this.orbit.panDelta.x,\n dY: this.orbit.panDelta.y,\n });\n break;\n\n case STATE.DOLLY:\n this.viewer.emitEvent({\n type: \"zoomat\",\n data: this.orbit.dollyScale,\n x: this.orbit.dollyEnd.x,\n y: this.orbit.dollyEnd.y,\n });\n break;\n }\n\n this.changed = true;\n };\n\n stopContextMenu = (event: PointerEvent) => {\n if (this.changed) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Object3D, Plane, Vector3 } from \"three\";\nimport { TransformControls } from \"three/examples/jsm/controls/TransformControls.js\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { PlaneHelper } from \"../helpers/PlaneHelper\";\nimport { OrbitDragger } from \"./OrbitDragger\";\n\nexport class CuttingPlaneDragger extends OrbitDragger {\n protected plane: Plane;\n protected planeCenter: Object3D;\n protected planeHelper: PlaneHelper;\n protected transform: TransformControls;\n\n constructor(viewer: Viewer, normal: Vector3, color: number) {\n super(viewer);\n\n const size = viewer.extents.getSize(new Vector3()).length();\n const center = viewer.extents.getCenter(new Vector3());\n const constant = -center.dot(normal);\n\n this.plane = new Plane(normal, constant);\n\n if (!viewer.renderer.clippingPlanes) viewer.renderer.clippingPlanes = [];\n viewer.renderer.clippingPlanes.push(this.plane);\n\n this.planeHelper = new PlaneHelper(this.plane, size, color, center);\n this.viewer.helpers.add(this.planeHelper);\n\n this.planeCenter = new Object3D();\n this.planeCenter.position.copy(viewer.extents.getCenter(new Vector3()));\n this.viewer.helpers.add(this.planeCenter);\n\n this.transform = new TransformControls(viewer.camera, viewer.canvas);\n this.transform.showX = !!normal.x;\n this.transform.showY = !!normal.y;\n this.transform.showZ = !!normal.z;\n this.transform.attach(this.planeCenter);\n this.transform.addEventListener(\"change\", this.transformChange);\n this.transform.addEventListener(\"dragging-changed\", this.transformDrag);\n this.viewer.helpers.add(this.transform.getHelper());\n\n this.viewer.on(\"explode\", this.viewerExplode);\n this.viewer.canvas.addEventListener(\"dblclick\", this.onDoubleClick, true);\n this.viewer.update();\n }\n\n override dispose() {\n this.viewer.off(\"explode\", this.viewerExplode);\n this.viewer.canvas.removeEventListener(\"dblclick\", this.onDoubleClick, true);\n\n this.transform.removeEventListener(\"change\", this.transformChange);\n this.transform.removeEventListener(\"dragging-changed\", this.transformDrag);\n this.transform.getHelper().removeFromParent();\n this.transform.detach();\n this.transform.dispose();\n\n this.planeHelper.removeFromParent();\n this.planeHelper.dispose();\n\n this.planeCenter.removeFromParent();\n\n // this.viewer.renderer.clippingPlanes = this.viewer.renderer.clippingPlanes.filter((plane) => plane !== this.plane);\n // this.viewer.update();\n\n super.dispose();\n }\n\n transformChange = () => {\n this.plane.constant = -this.planeCenter.position.dot(this.plane.normal);\n this.viewer.update();\n };\n\n transformDrag = (event) => {\n this.orbit.enabled = !event.value;\n };\n\n viewerExplode = () => {\n this.planeHelper.size = this.viewer.extents.getSize(new Vector3()).length();\n this.viewer.update();\n };\n\n onDoubleClick = (event: PointerEvent) => {\n event.stopPropagation();\n\n this.plane.negate();\n this.viewer.update();\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { CuttingPlaneDragger } from \"./CuttingPlaneDragger\";\n\nexport class CuttingPlaneXAxisDragger extends CuttingPlaneDragger {\n constructor(viewer: Viewer) {\n super(viewer, new Vector3(1, 0, 0), 0xff0000);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { CuttingPlaneDragger } from \"./CuttingPlaneDragger\";\n\nexport class CuttingPlaneYAxisDragger extends CuttingPlaneDragger {\n constructor(viewer: Viewer) {\n super(viewer, new Vector3(0, 1, 0), 0x00ff00);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { CuttingPlaneDragger } from \"./CuttingPlaneDragger\";\n\nexport class CuttingPlaneZAxisDragger extends CuttingPlaneDragger {\n constructor(viewer: Viewer) {\n super(viewer, new Vector3(0, 0, 1), 0x0000ff);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Camera, Matrix4, Object3D, Scene, Raycaster, Vector2, Vector3, Vector4 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { OrbitDragger } from \"./OrbitDragger\";\n\nconst PRECISION = 0.01;\n\nexport class MeasureLineDragger extends OrbitDragger {\n private overlay: MeasureOverlay;\n private line: MeasureLine;\n private snapper: MeasureSnapper;\n\n constructor(viewer: Viewer) {\n super(viewer);\n\n this.overlay = new MeasureOverlay(viewer.camera, viewer.canvas);\n this.overlay.attach();\n\n this.line = new MeasureLine(this.overlay);\n this.overlay.addLine(this.line);\n\n this.snapper = new MeasureSnapper(viewer.camera, viewer.canvas);\n this.snapper.update(viewer.scene);\n\n this.viewer.canvas.addEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.canvas.addEventListener(\"pointermove\", this.onPointerMove);\n this.viewer.canvas.addEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.canvas.addEventListener(\"pointercancel\", this.onPointerCancel);\n this.viewer.canvas.addEventListener(\"pointerleave\", this.onPointerLeave);\n\n this.viewer.addEventListener(\"render\", this.renderOverlay);\n this.viewer.addEventListener(\"hide\", this.updateSnapper);\n this.viewer.addEventListener(\"isolate\", this.updateSnapper);\n this.viewer.addEventListener(\"showall\", this.updateSnapper);\n }\n\n override dispose() {\n this.viewer.canvas.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.canvas.removeEventListener(\"pointermove\", this.onPointerMove);\n this.viewer.canvas.removeEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.canvas.removeEventListener(\"pointercancel\", this.onPointerCancel);\n this.viewer.canvas.removeEventListener(\"pointerleave\", this.onPointerLeave);\n\n this.viewer.removeEventListener(\"render\", this.renderOverlay);\n this.viewer.removeEventListener(\"hide\", this.updateSnapper);\n this.viewer.removeEventListener(\"isolate\", this.updateSnapper);\n this.viewer.removeEventListener(\"showall\", this.updateSnapper);\n\n this.overlay.detach();\n this.overlay.dispose();\n\n super.dispose();\n }\n\n onPointerDown = (event: PointerEvent) => {\n if (event.button !== 0) return;\n\n this.line.startPoint = this.snapper.getSnapPoint(event);\n this.line.render();\n\n this.viewer.canvas.setPointerCapture(event.pointerId);\n this.orbit.enabled = !this.line.startPoint;\n };\n\n onPointerMove = (event: PointerEvent) => {\n if (this.orbit.enabled && this.orbit.state !== -1) return;\n\n this.line.endPoint = this.snapper.getSnapPoint(event);\n this.line.render();\n\n if (this.line.startPoint) this.changed = true; // <- to prevent context menu\n };\n\n onPointerUp = (event: PointerEvent) => {\n if (this.line.startPoint && this.line.endPoint && this.line.getDistance() >= PRECISION) {\n this.line = new MeasureLine(this.overlay);\n this.overlay.addLine(this.line);\n } else {\n this.line.startPoint = undefined;\n this.line.endPoint = undefined;\n this.line.render();\n }\n\n this.viewer.canvas.releasePointerCapture(event.pointerId);\n this.orbit.enabled = true;\n };\n\n onPointerCancel = (event: PointerEvent) => {\n this.viewer.canvas.dispatchEvent(new PointerEvent(\"pointerup\", event));\n };\n\n onPointerLeave = () => {\n this.line.endPoint = undefined;\n this.line.render();\n };\n\n renderOverlay = () => {\n this.overlay.render();\n };\n\n updateSnapper = () => {\n this.snapper.update(this.viewer.scene);\n };\n}\n\nclass MeasureSnapper {\n private camera: Camera;\n private canvas: HTMLCanvasElement;\n private objects: Object3D[] = [];\n private raycaster: Raycaster;\n\n constructor(camera: Camera, canvas: HTMLCanvasElement) {\n this.camera = camera;\n this.canvas = canvas;\n this.raycaster = new Raycaster();\n }\n\n getSnapPoint(event: PointerEvent): Vector3 | undefined {\n const mouse = new Vector2(event.clientX, event.clientY);\n\n const rect = this.canvas.getBoundingClientRect();\n const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;\n const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;\n\n const coords = new Vector2(x, y);\n this.raycaster.setFromCamera(coords, this.camera);\n\n this.raycaster.params = {\n Mesh: {},\n Line: { threshold: 0.25 },\n Line2: { threshold: 0.25 },\n LOD: {},\n Points: { threshold: 0.1 },\n Sprite: {},\n };\n\n const intersects = this.raycaster.intersectObjects(this.objects, false);\n if (intersects.length === 0) return undefined;\n\n return intersects[0].point;\n }\n\n update(scene: Scene) {\n this.objects = [];\n scene.traverseVisible((child) => this.objects.push(child));\n }\n}\n\nclass MeasureOverlay {\n public camera: Camera;\n public canvas: HTMLCanvasElement;\n public container: HTMLElement;\n public lines: MeasureLine[] = [];\n public projector: MeasureProjector;\n\n constructor(camera: Camera, canvas: HTMLCanvasElement) {\n this.camera = camera;\n this.canvas = canvas;\n this.projector = new MeasureProjector(camera, canvas);\n }\n\n attach() {\n this.container = document.createElement(\"div\");\n this.container.id = \"measure-container\";\n this.container.style.background = \"rgba(0,0,0,0)\";\n this.container.style.position = \"absolute\";\n this.container.style.top = \"0px\";\n this.container.style.left = \"0px\";\n this.container.style.width = \"100%\";\n this.container.style.height = \"100%\";\n this.container.style.outline = \"none\";\n this.container.style.pointerEvents = \"none\";\n this.container.style.overflow = \"hidden\";\n\n this.canvas.parentElement.appendChild(this.container);\n }\n\n dispose() {\n this.clear();\n }\n\n detach() {\n this.container.remove();\n this.container = undefined;\n }\n\n clear() {\n this.lines.forEach((line) => line.dispose());\n this.lines = [];\n }\n\n render() {\n this.projector.updateProjectionMatrix();\n this.lines.forEach((line) => line.render());\n }\n\n update() {\n this.lines.forEach((line) => line.update());\n }\n\n addLine(line: MeasureLine) {\n this.lines.push(line);\n }\n\n removeLine(line: MeasureLine) {\n this.lines = this.lines.filter((x) => x !== line);\n }\n}\n\nconst _middlePoint = new Vector3();\n\nclass MeasureLine {\n private overlay: MeasureOverlay;\n\n private elementStartPoint: HTMLElement;\n private elementEndPoint: HTMLElement;\n private elementLine: HTMLElement;\n private elementLabel: HTMLElement;\n\n public startPoint: Vector3;\n public endPoint: Vector3;\n\n public id = Date.now();\n public unit = \"\";\n public scale = 1.0;\n public size = 10.0;\n public lineWidth = 2;\n\n public style = {\n border: \"2px solid #FFFFFF\",\n background: \"#009bff\",\n boxShadow: \"0 0 10px rgba(0,0,0,0.5)\",\n color: \"white\",\n font: \"1rem system-ui\",\n };\n\n constructor(overlay: MeasureOverlay) {\n this.overlay = overlay;\n\n this.elementStartPoint = overlay.container.appendChild(document.createElement(\"div\"));\n this.elementEndPoint = overlay.container.appendChild(document.createElement(\"div\"));\n this.elementLine = overlay.container.appendChild(document.createElement(\"div\"));\n this.elementLabel = overlay.container.appendChild(document.createElement(\"div\"));\n\n this.update();\n }\n\n dispose() {\n this.elementStartPoint.remove();\n this.elementEndPoint.remove();\n this.elementLine.remove();\n this.elementLabel.remove();\n }\n\n render() {\n const projector = this.overlay.projector;\n\n if (this.startPoint) {\n const { point, visible } = projector.projectPoint(this.startPoint);\n\n this.elementStartPoint.style.display = visible ? \"block\" : \"none\";\n this.elementStartPoint.style.left = `${point.x}px`;\n this.elementStartPoint.style.top = `${point.y}px`;\n } else {\n this.elementStartPoint.style.display = \"none\";\n }\n\n if (this.endPoint) {\n const { point, visible } = projector.projectPoint(this.endPoint);\n\n this.elementEndPoint.style.display = visible ? \"block\" : \"none\";\n this.elementEndPoint.style.left = `${point.x}px`;\n this.elementEndPoint.style.top = `${point.y}px`;\n } else {\n this.elementEndPoint.style.display = \"none\";\n }\n\n if (this.startPoint && this.endPoint) {\n const { point1, point2, visible } = projector.projectLine(this.startPoint, this.endPoint);\n\n point2.sub(point1);\n const angle = point2.angle();\n const width = point2.length();\n\n this.elementLine.style.display = visible ? \"block\" : \"none\";\n this.elementLine.style.left = `${point1.x}px`;\n this.elementLine.style.top = `${point1.y}px`;\n this.elementLine.style.width = `${width}px`;\n this.elementLine.style.transform = `translate(0px, ${-this.lineWidth / 2}px) rotate(${angle}rad)`;\n } else {\n this.elementLine.style.display = \"none\";\n }\n\n if (this.startPoint && this.endPoint) {\n _middlePoint.lerpVectors(this.startPoint, this.endPoint, 0.5);\n const { point, visible } = projector.projectPoint(_middlePoint);\n\n const distance = this.getDistance();\n\n this.elementLabel.style.display = visible && distance >= PRECISION ? \"block\" : \"none\";\n this.elementLabel.style.left = `${point.x}px`;\n this.elementLabel.style.top = `${point.y}px`;\n this.elementLabel.innerHTML = `${distance.toFixed(2)} ${this.unit}`;\n } else {\n this.elementLabel.style.display = \"none\";\n }\n }\n\n update() {\n this.elementStartPoint.id = `markup-dot-start-${this.id}`;\n this.elementStartPoint.style.position = \"absolute\";\n this.elementStartPoint.style.zIndex = \"2\";\n this.elementStartPoint.style.width = `${this.size}px`;\n this.elementStartPoint.style.height = `${this.size}px`;\n this.elementStartPoint.style.border = this.style.border;\n this.elementStartPoint.style.borderRadius = `${this.size}px`;\n this.elementStartPoint.style.background = this.style.background;\n this.elementStartPoint.style.boxShadow = this.style.boxShadow;\n this.elementStartPoint.style.transform = \"translate(-50%, -50%)\";\n\n this.elementEndPoint.id = `markup-dot-end-${this.id}`;\n this.elementEndPoint.style.position = \"absolute\";\n this.elementEndPoint.style.zIndex = \"2\";\n this.elementEndPoint.style.width = `${this.size}px`;\n this.elementEndPoint.style.height = `${this.size}px`;\n this.elementEndPoint.style.border = this.style.border;\n this.elementEndPoint.style.borderRadius = `${this.size}px`;\n this.elementEndPoint.style.background = this.style.background;\n this.elementEndPoint.style.boxShadow = this.style.boxShadow;\n this.elementEndPoint.style.transform = \"translate(-50%, -50%)\";\n\n this.elementLine.id = `markup-line-${this.id}`;\n this.elementLine.style.position = \"absolute\";\n this.elementLine.style.zIndex = \"1\";\n this.elementLine.style.height = `${this.lineWidth}px`;\n this.elementLine.style.background = this.style.background;\n this.elementLine.style.boxShadow = this.style.boxShadow;\n this.elementLine.style.transformOrigin = `0px ${this.lineWidth / 2}px`;\n\n this.elementLabel.id = `markup-label-${this.id}`;\n this.elementLabel.style.position = \"absolute\";\n this.elementLabel.style.zIndex = \"3\";\n this.elementLabel.style.padding = \"2px\";\n this.elementLabel.style.paddingInline = \"5px\";\n this.elementLabel.style.borderRadius = \"5px\";\n this.elementLabel.style.background = this.style.background;\n this.elementLabel.style.boxShadow = this.style.boxShadow;\n this.elementLabel.style.color = this.style.color;\n this.elementLabel.style.font = this.style.font;\n this.elementLabel.style.transform = \"translate(-50%, -50%)\";\n }\n\n getDistance(): number {\n return this.startPoint.distanceTo(this.endPoint) / this.scale;\n }\n}\n\nlet _widthHalf: number;\nlet _heightHalf: number;\nconst _viewMatrix = new Matrix4();\nconst _viewProjectionMatrix = new Matrix4();\nconst _vector = new Vector3();\nconst _vector1 = new Vector4();\nconst _vector2 = new Vector4();\nconst point = new Vector2();\nconst point1 = new Vector2();\nconst point2 = new Vector2();\n\nclass MeasureProjector {\n private camera: Camera;\n private canvas: HTMLElement;\n\n constructor(camera: Camera, canvas: HTMLCanvasElement) {\n this.camera = camera;\n this.canvas = canvas;\n }\n\n updateProjectionMatrix() {\n const rect = this.canvas.getBoundingClientRect();\n _widthHalf = rect.width / 2;\n _heightHalf = rect.height / 2;\n\n _viewMatrix.copy(this.camera.matrixWorldInverse);\n _viewProjectionMatrix.multiplyMatrices(this.camera.projectionMatrix, _viewMatrix);\n }\n\n projectPoint(p: Vector3) {\n _vector.copy(p).applyMatrix4(_viewProjectionMatrix);\n const visible = _vector.z >= -1 && _vector.z <= 1;\n\n point.x = (_vector.x + 1) * _widthHalf;\n point.y = (-_vector.y + 1) * _heightHalf;\n\n return { point, visible };\n }\n\n projectLine(p1: Vector3, p2: Vector3) {\n let visible: boolean;\n\n _vector1.copy(p1 as any).applyMatrix4(_viewProjectionMatrix);\n _vector2.copy(p2 as any).applyMatrix4(_viewProjectionMatrix);\n\n // see three/examples/jsm/renderers/Projector.js/clipLine for more details\n\n const bc1near = _vector1.z + _vector1.w;\n const bc2near = _vector2.z + _vector2.w;\n const bc1far = -_vector1.z + _vector1.w;\n const bc2far = -_vector2.z + _vector2.w;\n\n if (bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0) visible = true;\n else if ((bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0)) visible = false;\n else {\n let alpha1 = 0;\n let alpha2 = 1;\n\n if (bc1near < 0) alpha1 = Math.max(alpha1, bc1near / (bc1near - bc2near));\n else if (bc2near < 0) alpha2 = Math.min(alpha2, bc1near / (bc1near - bc2near));\n\n if (bc1far < 0) alpha1 = Math.max(alpha1, bc1far / (bc1far - bc2far));\n else if (bc2far < 0) alpha2 = Math.min(alpha2, bc1far / (bc1far - bc2far));\n\n visible = alpha2 >= alpha1;\n\n if (visible) {\n _vector1.lerp(_vector2, alpha1);\n _vector2.lerp(_vector1, 1 - alpha2);\n }\n }\n\n _vector1.multiplyScalar(1 / _vector1.w);\n _vector2.multiplyScalar(1 / _vector2.w);\n\n point1.x = (_vector1.x + 1) * _widthHalf;\n point1.y = (-_vector1.y + 1) * _heightHalf;\n\n point2.x = (_vector2.x + 1) * _widthHalf;\n point2.y = (-_vector2.y + 1) * _heightHalf;\n\n return { point1, point2, visible };\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { MOUSE } from \"three\";\n\nimport { OrbitDragger } from \"./OrbitDragger\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class PanDragger extends OrbitDragger {\n constructor(viewer: Viewer) {\n super(viewer);\n this.orbit.mouseButtons = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN };\n // this.controls.touches = { ONE: TOUCH.PAN, TWO: TOUCH.DOLLY_ROTATE };\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Clock, Camera, Controls, Quaternion, Vector2, Vector3 } from \"three\";\n\ninterface WalkControlsEventMap {\n change: { type: \"change\" };\n walkspeedchange: { type: \"walkspeedchange\"; data: number };\n}\n\nexport class WalkControls extends Controls<WalkControlsEventMap> {\n public movementSpeed = 0.2;\n public lookSpeed = 5;\n public multiplier = 5;\n\n private moveKeys: Set<string>;\n private moveWheel = 0;\n private moveClock: Clock;\n\n private quaternion: Quaternion;\n private downPosition: Vector2;\n private mouseDragOn = false;\n public rotateDelta: Vector2;\n\n constructor(camera: Camera, canvas: HTMLElement) {\n super(camera, canvas);\n\n this.moveKeys = new Set();\n this.moveClock = new Clock();\n\n this.quaternion = camera.quaternion.clone();\n this.downPosition = new Vector2(0, 0);\n this.rotateDelta = new Vector2(0, 0);\n\n this.domElement.addEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.addEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.addEventListener(\"pointerup\", this.onPointerUp);\n this.domElement.addEventListener(\"pointercancel\", this.onPointerCancel);\n this.domElement.addEventListener(\"wheel\", this.onWheel);\n\n window.addEventListener(\"keydown\", this.onKeyDown);\n window.addEventListener(\"keyup\", this.onKeyUp);\n }\n\n override dispose() {\n this.domElement.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.removeEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.removeEventListener(\"pointerup\", this.onPointerUp);\n this.domElement.removeEventListener(\"pointercancel\", this.onPointerCancel);\n this.domElement.removeEventListener(\"wheel\", this.onWheel);\n\n window.removeEventListener(\"keydown\", this.onKeyDown);\n window.removeEventListener(\"keyup\", this.onKeyUp);\n\n super.dispose();\n }\n\n onPointerDown = (event: PointerEvent) => {\n if (event.button !== 0) return;\n\n this.domElement.setPointerCapture(event.pointerId);\n this.downPosition.set(event.clientX, event.clientY);\n this.quaternion.copy(this.object.quaternion);\n this.mouseDragOn = true;\n };\n\n onPointerMove = (event: PointerEvent) => {\n if (!this.mouseDragOn) return;\n\n const movePosition = new Vector2(event.clientX, event.clientY);\n if (this.downPosition.distanceTo(movePosition) === 0) return;\n\n this.rotateDelta.copy(this.downPosition).sub(movePosition);\n this.rotateCamera(this.rotateDelta);\n this.dispatchEvent({ type: \"change\" });\n };\n\n onPointerUp = (event: PointerEvent) => {\n this.domElement.releasePointerCapture(event.pointerId);\n this.mouseDragOn = false;\n };\n\n onPointerCancel = (event: PointerEvent) => {\n this.domElement.dispatchEvent(new PointerEvent(\"pointerup\", event));\n };\n\n onWheel = (event: WheelEvent) => {\n this.moveWheel = event.deltaY;\n this.update();\n };\n\n onKeyDown = (event: KeyboardEvent) => {\n switch (event.code) {\n case \"NumpadSubtract\":\n case \"Minus\":\n if (this.multiplier > 1) {\n this.multiplier = this.multiplier - 1;\n this.dispatchEvent({ type: \"walkspeedchange\", data: this.multiplier });\n }\n break;\n\n case \"NumpadAdd\":\n case \"Equal\":\n if (this.multiplier < 10) {\n this.multiplier = this.multiplier + 1;\n this.dispatchEvent({ type: \"walkspeedchange\", data: this.multiplier });\n }\n break;\n\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"KeyW\":\n case \"KeyS\":\n case \"KeyA\":\n case \"KeyD\":\n case \"KeyQ\":\n case \"KeyE\":\n this.moveKeys.add(event.code);\n this.update();\n break;\n }\n };\n\n onKeyUp = (event: KeyboardEvent) => {\n if (this.moveKeys.delete(event.code)) this.update();\n };\n\n override update() {\n if (this.moveKeys.size > 0) {\n const timeDelta = this.moveClock.getDelta();\n const moveDelta = timeDelta * this.movementSpeed * this.multiplier;\n\n if (this.moveKeys.has(\"KeyW\")) this.object.translateZ(-moveDelta);\n if (this.moveKeys.has(\"KeyS\")) this.object.translateZ(moveDelta);\n\n if (this.moveKeys.has(\"KeyA\")) this.object.translateX(-moveDelta);\n if (this.moveKeys.has(\"KeyD\")) this.object.translateX(moveDelta);\n\n if (this.moveKeys.has(\"KeyQ\")) this.object.translateY(moveDelta);\n if (this.moveKeys.has(\"KeyE\")) this.object.translateY(-moveDelta);\n\n const lookDelta = this.lookSpeed + (this.multiplier - 1);\n\n if (this.moveKeys.has(\"ArrowUp\")) this.rotateCamera(this.rotateDelta.add(new Vector2(0, -lookDelta / 2)));\n if (this.moveKeys.has(\"ArrowDown\")) this.rotateCamera(this.rotateDelta.add(new Vector2(0, lookDelta / 2)));\n\n if (this.moveKeys.has(\"ArrowLeft\")) this.rotateCamera(this.rotateDelta.add(new Vector2(lookDelta, 0)));\n if (this.moveKeys.has(\"ArrowRight\")) this.rotateCamera(this.rotateDelta.add(new Vector2(-lookDelta, 0)));\n\n this.moveWheel = 0;\n this.dispatchEvent({ type: \"change\" });\n }\n\n if (this.moveWheel !== 0) {\n const moveDelta = this.moveWheel * 0.0001 * this.movementSpeed * this.multiplier;\n\n this.object.translateZ(-moveDelta);\n this.moveWheel += -1 * Math.sign(this.moveWheel);\n this.dispatchEvent({ type: \"change\" });\n }\n\n if (this.moveKeys.size === 0 && this.moveWheel === 0) {\n this.moveClock.stop();\n this.moveClock.autoStart = true;\n }\n }\n\n rotateCamera(delta: Vector2) {\n const rotateX = (Math.PI * delta.x) / this.domElement.clientWidth;\n const rotateY = (Math.PI * delta.y) / this.domElement.clientHeight;\n\n const xRotation = new Quaternion();\n xRotation.setFromAxisAngle(this.object.up, rotateX);\n\n const yRotation = new Quaternion();\n yRotation.setFromAxisAngle(new Vector3(1, 0, 0), rotateY);\n\n const quaternion = this.quaternion.clone();\n quaternion.premultiply(xRotation).multiply(yRotation).normalize();\n\n this.object.setRotationFromQuaternion(quaternion);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\nimport { type IDragger } from \"@inweb/viewer-core\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { WalkControls } from \"../controls/WalkControls\";\n\nexport class WalkDragger implements IDragger {\n protected viewer: Viewer;\n public controls: WalkControls;\n\n constructor(viewer: Viewer) {\n this.controls = new WalkControls(viewer.camera, viewer.canvas);\n this.controls.addEventListener(\"change\", this.controlsChange);\n this.controls.addEventListener(\"walkspeedchange\", this.walkspeedChange);\n this.viewer = viewer;\n this.viewer.on(\"render\", this.viewerRender);\n this.viewer.on(\"zoom\", this.viewerZoom);\n this.updateControls();\n }\n\n dispose() {\n this.viewer.off(\"render\", this.viewerRender);\n this.viewer.off(\"zoom\", this.viewerZoom);\n this.controls.removeEventListener(\"walkspeedchange\", this.walkspeedChange);\n this.controls.removeEventListener(\"change\", this.controlsChange);\n this.controls.dispose();\n }\n\n updateControls = () => {\n const size = this.viewer.extents.getSize(new Vector3());\n this.controls.movementSpeed = Math.min(size.x, size.y, size.z) / 2;\n };\n\n controlsChange = () => {\n this.viewer.update();\n };\n\n walkspeedChange = (event: any) => {\n this.viewer.emitEvent(event);\n };\n\n viewerRender = () => {\n this.controls.update();\n };\n\n viewerZoom = () => {\n this.controls.rotateDelta.set(0, 0);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { MOUSE } from \"three\";\n\nimport { OrbitDragger } from \"./OrbitDragger\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class ZoomDragger extends OrbitDragger {\n constructor(viewer: Viewer) {\n super(viewer);\n this.orbit.mouseButtons = { LEFT: MOUSE.DOLLY, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN };\n // this.controls.touches = { ONE: TOUCH.DOLLY_PAN, TWO: TOUCH.DOLLY_PAN };\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IDraggersRegistry, draggersRegistry } from \"@inweb/viewer-core\";\n\nimport { CuttingPlaneXAxisDragger } from \"./CuttingPlaneXAxis\";\nimport { CuttingPlaneYAxisDragger } from \"./CuttingPlaneYAxis\";\nimport { CuttingPlaneZAxisDragger } from \"./CuttingPlaneZAxis\";\nimport { MeasureLineDragger } from \"./MeasureLineDragger\";\nimport { OrbitDragger } from \"./OrbitDragger\";\nimport { PanDragger } from \"./PanDragger\";\nimport { WalkDragger } from \"./WalkDragger\";\nimport { ZoomDragger } from \"./ZoomDragger\";\n\n/**\n * Viewer draggers registry. Use this registry to register custom draggers.\n *\n * To implement custom dragger:\n *\n * 1. Define a dragger class implements {@link IDragger}.\n * 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.\n * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove` event and\n * zoom in/out when the left mouse button is pressed.\n * 4. Override {@link IDragger.dispose} and remove mouse event listeners from the viewer.\n * 5. Register dragger provider in the draggers registry by calling the {@link draggers.registerDragger}.\n *\n * @example Implementing a custom dragger.\n *\n * ```javascript\n * import { IDragger, draggers, Viewer } from \"@inweb/viewer-three\";\n *\n * class MyDragger implements IDragger {\n * protected viewer: Viewer;\n *\n * constructor(viewer: Viewer) {\n * this.viewer = viewer;\n * this.viewer.addEventListener(\"pointermove\", this.onPointerMove);\n * }\n *\n * override dispose() {\n * this.viewer.removeEventListener(\"pointermove\", this.onPointerMove);\n * }\n *\n * onPointerMove = (event: PointerEvent) => {\n * // place custom logic here\n * };\n * }\n *\n * draggers.registerDragger(\"MyDragger\", (viewer): IDragger => new MyDragger(viewer));\n * ```\n *\n * @example Activating a custom dragger.\n *\n * ```javascript\n * viewer.setActiveDragger(\"MyDragger\");\n * ```\n */\nexport const draggers: IDraggersRegistry = draggersRegistry(\"threejs\");\n\n// build-in draggers\n\ndraggers.registerDragger(\"Pan\", (viewer) => new PanDragger(viewer));\ndraggers.registerDragger(\"Orbit\", (viewer) => new OrbitDragger(viewer));\ndraggers.registerDragger(\"Zoom\", (viewer) => new ZoomDragger(viewer));\ndraggers.registerDragger(\"MeasureLine\", (viewer) => new MeasureLineDragger(viewer));\ndraggers.registerDragger(\"CuttingPlaneXAxis\", (viewer) => new CuttingPlaneXAxisDragger(viewer));\ndraggers.registerDragger(\"CuttingPlaneYAxis\", (viewer) => new CuttingPlaneYAxisDragger(viewer));\ndraggers.registerDragger(\"CuttingPlaneZAxis\", (viewer) => new CuttingPlaneZAxisDragger(viewer));\ndraggers.registerDragger(\"Walk\", (viewer) => new WalkDragger(viewer));\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Model, File, Assembly } from \"@inweb/client\";\nimport type { Viewer } from \"../Viewer\";\n\nexport function applyModelTransform(viewer: Viewer, model: Model | File | Assembly) {\n console.warn(\"applyModelTransform not implemented\");\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function clearMarkup(viewer: Viewer) {\n viewer.clearOverlay();\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Intersection, MeshBasicMaterial, Object3D, Raycaster, Vector2 } from \"three\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class SelectionComponent implements IComponent {\n protected viewer: Viewer;\n protected raycaster: Raycaster;\n protected downPosition: Vector2;\n protected facesMaterial: MeshBasicMaterial;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.raycaster = new Raycaster();\n this.downPosition = new Vector2();\n\n const { facesColor, facesTransparancy } = this.viewer.options;\n this.facesMaterial = new MeshBasicMaterial();\n this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);\n this.facesMaterial.opacity = (255 - facesTransparancy) / 255;\n this.facesMaterial.transparent = true;\n\n this.viewer.addEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.addEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.addEventListener(\"dblclick\", this.onDoubleClick);\n this.viewer.addEventListener(\"optionschange\", this.optionsChange);\n }\n\n dispose() {\n this.facesMaterial.dispose();\n\n this.viewer.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.removeEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.removeEventListener(\"dblclick\", this.onDoubleClick);\n this.viewer.removeEventListener(\"optionschange\", this.optionsChange);\n }\n\n onPointerDown = (event: PointerEvent) => {\n if (!event.isPrimary || event.button !== 0) return;\n\n this.getMousePosition(event, this.downPosition);\n };\n\n onPointerUp = (event: PointerEvent) => {\n if (!event.isPrimary) return;\n\n const upPosition = this.getMousePosition(event, new Vector2());\n if (this.downPosition.distanceTo(upPosition) !== 0) return;\n\n const intersects = this.getPointerIntersects(upPosition);\n\n this.clearSelection();\n if (intersects.length > 0) this.select(intersects[0].object);\n\n this.viewer.update();\n this.viewer.emitEvent({ type: \"select\", data: undefined, handles: this.viewer.getSelected() });\n };\n\n onDoubleClick = (event: MouseEvent) => {\n if (event.button !== 0) return;\n\n this.viewer.executeCommand(\"zoomToSelected\");\n };\n\n getMousePosition(event: MouseEvent, target: Vector2): Vector2 {\n return target.set(event.clientX, event.clientY);\n }\n\n getPointerIntersects(mouse: Vector2): Array<Intersection<Object3D>> {\n const rect = this.viewer.canvas.getBoundingClientRect();\n const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;\n const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;\n\n const coords = new Vector2(x, y);\n this.raycaster.setFromCamera(coords, this.viewer.camera);\n\n const objects = [];\n this.viewer.scene.traverseVisible((child) => objects.push(child));\n\n this.raycaster.params = this.raycaster.params = {\n Mesh: {},\n Line: { threshold: 0.25 },\n Line2: { threshold: 0.25 },\n LOD: {},\n Points: { threshold: 0.1 },\n Sprite: {},\n };\n\n return this.raycaster.intersectObjects(objects, false);\n }\n\n select(object: any) {\n if (object.isSelected) return;\n\n object.isSelected = true;\n object.originalMaterial = object.material;\n object.material = this.facesMaterial;\n\n this.viewer.selected.push(object);\n }\n\n clearSelection() {\n this.viewer.selected.forEach((object: any) => {\n object.isSelected = false;\n object.material = object.originalMaterial;\n });\n this.viewer.selected.length = 0;\n }\n\n optionsChange = () => {\n const { facesColor, facesTransparancy } = this.viewer.options;\n this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);\n this.facesMaterial.opacity = (255 - facesTransparancy) / 255;\n\n this.viewer.update();\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { SelectionComponent } from \"../components/SelectionComponent\";\n\nexport function clearSelected(viewer: Viewer): void {\n const selection = new SelectionComponent(viewer);\n selection.clearSelection();\n selection.dispose();\n\n viewer.update();\n viewer.emitEvent({ type: \"select\", data: undefined, handles: [] });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function clearSlices(viewer: Viewer) {\n viewer.clearSlices();\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function createPreview(viewer: Viewer, type = \"image/jpeg\", encoderOptions = 0.25): string {\n viewer.update(true);\n return viewer.canvas.toDataURL(type, encoderOptions);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3, Vector3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\n\nfunction calcExplodeDepth(object, depth: number): number {\n let res = depth;\n object.children.forEach((x) => {\n const objectDepth = calcExplodeDepth(x, depth + 1);\n if (res < objectDepth) res = objectDepth;\n });\n\n object.originalPosition = object.position.clone();\n object.originalCenter = new Box3().setFromObject(object).getCenter(new Vector3());\n object.isExplodeLocked = depth > 2 && object.children.length === 0;\n\n return res;\n}\n\nfunction explodeScene(scene, scale = 0, coeff = 4) {\n scale /= 100;\n\n if (!scene.explodeDepth) scene.explodeDepth = calcExplodeDepth(scene, 1);\n const maxDepth = scene.explodeDepth;\n\n const scaledExplodeDepth = scale * maxDepth + 1;\n const explodeDepth = 0 | scaledExplodeDepth;\n const currentSegmentFraction = scaledExplodeDepth - explodeDepth;\n\n function explodeObject(object, depth: number) {\n object.position.copy(object.originalPosition);\n\n if (depth > 0 && depth <= explodeDepth && !object.isExplodeLocked) {\n let objectScale = scale * coeff;\n if (depth === explodeDepth) objectScale *= currentSegmentFraction;\n\n const parentCenter = object.parent.originalCenter;\n const objectCenter = object.originalCenter;\n const objectOffset = objectCenter.clone().sub(parentCenter).multiplyScalar(objectScale);\n\n object.position.add(objectOffset);\n }\n\n object.children.forEach((x) => explodeObject(x, depth + 1));\n }\n\n explodeObject(scene, 0);\n}\n\nexport function explode(viewer: Viewer, index = 0): void {\n viewer.models.forEach((model) => explodeScene(model.scene, index));\n viewer.scene.updateMatrixWorld();\n\n viewer.update();\n viewer.emitEvent({ type: \"explode\", data: index });\n}\n\nexport function collect(viewer: Viewer) {\n explode(viewer, 0);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3, MathUtils, Sphere, Vector2, Vector3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\n\nexport function zoomTo(viewer: Viewer, box: Box3): void {\n if (box.isEmpty()) return;\n\n const center = box.getCenter(new Vector3());\n const sphere = box.getBoundingSphere(new Sphere());\n\n const rendererSize = viewer.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n const camera = viewer.camera as any;\n\n if (camera.isPerspectiveCamera) {\n const offset = new Vector3(0, 0, 1);\n offset.applyQuaternion(camera.quaternion);\n offset.multiplyScalar(sphere.radius / Math.tan(MathUtils.DEG2RAD * camera.fov * 0.5));\n\n camera.position.copy(center).add(offset);\n camera.updateMatrixWorld();\n }\n if (camera.isOrthographicCamera) {\n camera.top = sphere.radius;\n camera.bottom = -sphere.radius;\n camera.left = camera.bottom * aspect;\n camera.right = camera.top * aspect;\n camera.zoom = 1;\n camera.updateProjectionMatrix();\n\n const offset = new Vector3(0, 0, 1);\n offset.applyQuaternion(camera.quaternion);\n offset.multiplyScalar(viewer.extents.getBoundingSphere(new Sphere()).radius * 3);\n\n camera.position.copy(center).add(offset);\n camera.updateMatrixWorld();\n }\n\n viewer.target.copy(center);\n\n viewer.update();\n viewer.emitEvent({ type: \"zoom\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Sphere, Vector3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport const defaultViewPositions = {\n top: new Vector3(0, 0, 1),\n bottom: new Vector3(0, 0, -1),\n left: new Vector3(-1, 0, 0),\n right: new Vector3(1, 0, 0),\n front: new Vector3(0, -1, 0),\n back: new Vector3(0, 1, 0),\n sw: new Vector3(-0.5, -0.5, 1.0).normalize(),\n se: new Vector3(0.5, -0.5, 1.0).normalize(),\n ne: new Vector3(0.5, 0.5, 1.0).normalize(),\n nw: new Vector3(-0.5, 0.5, 1.0).normalize(),\n};\n\nexport function setDefaultViewPosition(viewer: Viewer, position: string): void {\n const direction = defaultViewPositions[position] || defaultViewPositions[\"sw\"];\n\n const center = viewer.extents.getCenter(new Vector3());\n const sphere = viewer.extents.getBoundingSphere(new Sphere());\n const offset = direction.clone().multiplyScalar(sphere.radius);\n\n const camera = viewer.camera;\n camera.position.copy(center).add(offset);\n camera.lookAt(center);\n camera.updateMatrixWorld();\n\n viewer.target.copy(center);\n\n viewer.update();\n viewer.emit({ type: \"viewposition\", data: position });\n\n zoomTo(viewer, viewer.extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { defaultViewPositions } from \"./SetDefaultViewPosition\";\n\nexport function getDefaultViewPositions(): string[] {\n return Object.keys(defaultViewPositions);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function getModels(viewer: Viewer): string[] {\n return viewer.models.map((model) => model.userData?.handle || \"\").filter((handle) => handle);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function getSelected(viewer: Viewer): string[] {\n return viewer.selected.map((object) => object.userData?.handle).filter((handle) => handle);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { SelectionComponent } from \"../components/SelectionComponent\";\n\nexport function hideSelected(viewer: Viewer): void {\n viewer.selected.forEach((object) => (object.visible = false));\n\n const selection = new SelectionComponent(viewer);\n selection.clearSelection();\n selection.dispose();\n\n viewer.update();\n viewer.emitEvent({ type: \"hide\" });\n viewer.emitEvent({ type: \"select\", data: undefined, handles: [] });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function isolateSelected(viewer: Viewer): void {\n const visibleSet = new Set();\n viewer.selected.forEach((object) => {\n visibleSet.add(object);\n object.traverseAncestors((object2) => visibleSet.add(object2));\n });\n\n viewer.scene.traverse((object) => (object.visible = visibleSet.has(object)));\n\n viewer.update();\n viewer.emitEvent({ type: \"isolate\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function regenerateAll(viewer: Viewer): void {\n viewer.emit({ type: \"regenerateall\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function resetView(viewer: Viewer): void {\n viewer.executeCommand(\"setActiveDragger\");\n viewer.executeCommand(\"clearSlices\");\n viewer.executeCommand(\"clearOverlay\");\n viewer.executeCommand(\"setMarkupColor\");\n viewer.executeCommand(\"clearSelected\");\n viewer.executeCommand(\"showAll\");\n viewer.executeCommand(\"explode\", 0);\n viewer.executeCommand(\"zoomToExtents\", true);\n viewer.executeCommand(\"k3DViewSW\");\n\n viewer.emit({ type: \"resetview\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function selectModel(viewer: Viewer, handle: string): void {\n console.warn(\"selectModel not implemented\");\n viewer.emit({ type: \"select\", data: [] });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function setActiveDragger(viewer: Viewer, dragger = \"\") {\n viewer.setActiveDragger(dragger);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function setMarkupColor(viewer: Viewer, r = 255, g = 0, b = 0) {\n viewer.markup.setMarkupColor(r, g, b);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { SelectionComponent } from \"../components/SelectionComponent\";\n\nexport function setSelected(viewer: Viewer, handles: string[] = []): void {\n const handleSet = new Set(handles);\n const objects = [];\n viewer.scene.traverseVisible((child) => {\n if (handleSet.has(child.userData?.handle)) objects.push(child);\n });\n\n const selection = new SelectionComponent(viewer);\n selection.clearSelection();\n objects.forEach((object) => selection.select(object));\n selection.dispose();\n\n viewer.update();\n viewer.emitEvent({ type: \"select\", data: undefined, handles });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function showAll(viewer: Viewer): void {\n viewer.scene.traverse((object) => (object.visible = true));\n\n viewer.update();\n viewer.emitEvent({ type: \"showall\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport function zoomToExtents(viewer: Viewer): void {\n zoomTo(viewer, viewer.extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport function zoomToObjects(viewer: Viewer, handles: string[] = []): void {\n const handleSet = new Set(handles);\n const objects = [];\n viewer.scene.traverseVisible((child) => {\n if (handleSet.has(child.userData?.handle)) objects.push(child);\n });\n\n const extents = objects.reduce((result: Box3, object) => result.expandByObject(object), new Box3());\n if (extents.isEmpty()) extents.copy(viewer.extents);\n\n zoomTo(viewer, extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport function zoomToSelected(viewer: Viewer): void {\n const extents = viewer.selected.reduce((result: Box3, object) => result.expandByObject(object), new Box3());\n if (extents.isEmpty()) extents.copy(viewer.extents);\n\n zoomTo(viewer, extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { ICommandsRegistry, commandsRegistry } from \"@inweb/viewer-core\";\n\nimport { applyModelTransform } from \"./ApplyModelTransform\";\nimport { clearMarkup } from \"./ClearMarkup\";\nimport { clearSelected } from \"./ClearSelected\";\nimport { clearSlices } from \"./ClearSlices\";\nimport { createPreview } from \"./CreatePreview\";\nimport { explode, collect } from \"./Explode\";\nimport { getDefaultViewPositions } from \"./GetDefaultViewPositions\";\nimport { getModels } from \"./GetModels\";\nimport { getSelected } from \"./GetSelected\";\nimport { hideSelected } from \"./HideSelected\";\nimport { isolateSelected } from \"./IsolateSelected\";\nimport { regenerateAll } from \"./RegenerateAll\";\nimport { resetView } from \"./ResetView\";\nimport { selectModel } from \"./SelectModel\";\nimport { setActiveDragger } from \"./SetActiveDragger\";\nimport { setDefaultViewPosition } from \"./SetDefaultViewPosition\";\nimport { setMarkupColor } from \"./SetMarkupColor\";\nimport { setSelected } from \"./SetSelected\";\nimport { showAll } from \"./ShowAll\";\nimport { zoomToExtents } from \"./ZoomToExtents\";\nimport { zoomToObjects } from \"./ZoomToObjects\";\nimport { zoomToSelected } from \"./ZoomToSelected\";\n\n/**\n * A commands registry. Use this registry to register custom commands.\n *\n * To implement custom command:\n *\n * 1. Define a command handler with a first `viewer` parameter.\n * 2. Register command handler in the commands registry by calling the {@link commands.registerCommand}.\n *\n * @example Implementing a custom command.\n *\n * ```javascript\n * import { commands, Viewer } from \"@inweb/viewer-three\";\n *\n * function commandHandler(viewer: Viewer, name = \"world\"): void {\n * console.log(`Hello ${name}!!!`);\n * }\n *\n * commands.registerCommand(\"sayHello\", commandHandler);\n * ```\n *\n * @example Calling a custom command.\n *\n * ```javascript\n * viewer.executeCommand(\"sayHello\", \"user\");\n * ```\n */\nexport const commands: ICommandsRegistry = commandsRegistry(\"threejs\");\n\n// build-in commands\n\ncommands.registerCommand(\"applyModelTransform\", applyModelTransform);\ncommands.registerCommand(\"clearMarkup\", clearMarkup);\ncommands.registerCommand(\"clearSelected\", clearSelected);\ncommands.registerCommand(\"clearSlices\", clearSlices);\ncommands.registerCommand(\"createPreview\", createPreview);\ncommands.registerCommand(\"explode\", explode);\ncommands.registerCommand(\"collect\", collect);\ncommands.registerCommand(\"getDefaultViewPositions\", getDefaultViewPositions);\ncommands.registerCommand(\"getModels\", getModels);\ncommands.registerCommand(\"getSelected\", getSelected);\ncommands.registerCommand(\"hideSelected\", hideSelected);\ncommands.registerCommand(\"isolateSelected\", isolateSelected);\ncommands.registerCommand(\"regenerateAll\", regenerateAll);\ncommands.registerCommand(\"resetView\", resetView);\ncommands.registerCommand(\"selectModel\", selectModel);\ncommands.registerCommand(\"setActiveDragger\", setActiveDragger);\ncommands.registerCommand(\"setDefaultViewPosition\", setDefaultViewPosition);\ncommands.registerCommand(\"setMarkupColor\", setMarkupColor);\ncommands.registerCommand(\"setSelected\", setSelected);\ncommands.registerCommand(\"showAll\", showAll);\ncommands.registerCommand(\"zoomToExtents\", zoomToExtents);\ncommands.registerCommand(\"zoomToObjects\", zoomToObjects);\ncommands.registerCommand(\"zoomToSelected\", zoomToSelected);\n\ncommands.registerCommand(\"top\", (viewer) => setDefaultViewPosition(viewer, \"top\"));\ncommands.registerCommand(\"bottom\", (viewer) => setDefaultViewPosition(viewer, \"bottom\"));\ncommands.registerCommand(\"left\", (viewer) => setDefaultViewPosition(viewer, \"left\"));\ncommands.registerCommand(\"right\", (viewer) => setDefaultViewPosition(viewer, \"right\"));\ncommands.registerCommand(\"front\", (viewer) => setDefaultViewPosition(viewer, \"front\"));\ncommands.registerCommand(\"back\", (viewer) => setDefaultViewPosition(viewer, \"back\"));\ncommands.registerCommand(\"sw\", (viewer) => setDefaultViewPosition(viewer, \"sw\"));\ncommands.registerCommand(\"se\", (viewer) => setDefaultViewPosition(viewer, \"se\"));\ncommands.registerCommand(\"ne\", (viewer) => setDefaultViewPosition(viewer, \"ne\"));\ncommands.registerCommand(\"nw\", (viewer) => setDefaultViewPosition(viewer, \"nw\"));\n\ncommands.registerCommandAlias(\"clearMarkup\", \"clearOverlay\");\ncommands.registerCommandAlias(\"clearSelected\", \"unselect\");\ncommands.registerCommandAlias(\"zoomToExtents\", \"zoomExtents\");\n\ncommands.registerCommandAlias(\"top\", \"k3DViewTop\");\ncommands.registerCommandAlias(\"bottom\", \"k3DViewBottom\");\ncommands.registerCommandAlias(\"left\", \"k3DViewLeft\");\ncommands.registerCommandAlias(\"right\", \"k3DViewRight\");\ncommands.registerCommandAlias(\"front\", \"k3DViewFront\");\ncommands.registerCommandAlias(\"back\", \"k3DViewBack\");\ncommands.registerCommandAlias(\"se\", \"k3DViewSE\");\ncommands.registerCommandAlias(\"sw\", \"k3DViewSW\");\ncommands.registerCommandAlias(\"ne\", \"k3DViewNE\");\ncommands.registerCommandAlias(\"nw\", \"k3DViewNW\");\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Color, PMREMGenerator } from \"three\";\nimport { RoomEnvironment } from \"three/examples/jsm/environments/RoomEnvironment.js\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class BackgroundComponent implements IComponent {\n protected viewer: Viewer;\n protected backgroundColor: Color;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n\n this.backgroundColor = new Color(0xffffff);\n\n const environment = new RoomEnvironment();\n const pmremGenerator = new PMREMGenerator(this.viewer.renderer);\n\n this.viewer.renderer.setClearColor(this.backgroundColor);\n this.viewer.scene.background = this.backgroundColor;\n this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;\n this.viewer.addEventListener(\"optionschange\", this.syncOptions);\n\n environment.dispose();\n }\n\n dispose() {\n this.viewer.removeEventListener(\"optionschange\", this.syncOptions);\n this.viewer.scene.environment = undefined;\n this.viewer.scene.background = undefined;\n }\n\n syncOptions = () => {\n this.backgroundColor.setHex(0xffffff);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Sphere, Vector2 } from \"three\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class CameraComponent implements IComponent {\n protected viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.geometryEnd);\n }\n\n dispose() {\n this.viewer.removeEventListener(\"databasechunk\", this.geometryEnd);\n }\n\n geometryEnd = () => {\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const rendererSize = this.viewer.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n let sceneCamera: any;\n this.viewer.scene.traverse((object: any) => {\n if (object.isCamera)\n if (!sceneCamera) sceneCamera = object;\n else if (object.isPerspectiveCamera && sceneCamera.isOrthographicCamera) sceneCamera = object;\n });\n if (sceneCamera) {\n this.viewer.camera = sceneCamera.clone();\n this.viewer.camera.up.set(0, 0, 1);\n this.viewer.camera.scale.set(1, 1, 1); // <- visualize fix\n }\n\n const camera = this.viewer.camera as any;\n\n if (camera.isPerspectiveCamera) {\n camera.aspect = aspect;\n camera.near = extentsSize / 100;\n camera.far = extentsSize * 100;\n camera.updateProjectionMatrix();\n }\n if (camera.isOrthographicCamera) {\n camera.left = camera.bottom * aspect;\n camera.right = camera.top * aspect;\n camera.near = 0;\n camera.far = extentsSize * 100;\n camera.updateProjectionMatrix();\n }\n\n if (!sceneCamera) {\n this.viewer.executeCommand(\"setDefaultViewPosition\");\n }\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3, Vector3 } from \"three\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class ExtentsComponent implements IComponent {\n private viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.syncExtents);\n this.viewer.addEventListener(\"clear\", this.syncExtents);\n this.viewer.on(\"explode\", this.syncExtents);\n this.viewer.on(\"isolate\", this.syncExtents);\n this.viewer.on(\"hide\", this.syncExtents);\n this.viewer.on(\"showall\", this.syncExtents);\n }\n\n dispose() {\n this.viewer.removeEventListener(\"databasechunk\", this.syncExtents);\n this.viewer.removeEventListener(\"clear\", this.syncExtents);\n this.viewer.off(\"explode\", this.syncExtents);\n this.viewer.off(\"isolate\", this.syncExtents);\n this.viewer.off(\"hide\", this.syncExtents);\n this.viewer.off(\"showall\", this.syncExtents);\n }\n\n syncExtents = () => {\n const extents = new Box3();\n this.viewer.scene.traverseVisible((object) => !object.children.length && extents.expandByObject(object));\n\n this.viewer.extents.copy(extents);\n this.viewer.target.copy(extents.getCenter(new Vector3()));\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class RenderLoopComponent implements IComponent {\n protected viewer: Viewer;\n protected requestId: number;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.animate();\n }\n\n dispose() {\n cancelAnimationFrame(this.requestId);\n }\n\n animate = (time = 0) => {\n this.requestId = requestAnimationFrame(this.animate);\n this.viewer.render(time);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class ResizeCanvasComponent implements IComponent {\n protected viewer: Viewer;\n protected resizeObserver: ResizeObserver;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.resizeObserver = new ResizeObserver(this.resizeViewer);\n this.resizeObserver.observe(viewer.canvas.parentElement);\n }\n\n dispose() {\n this.resizeObserver.disconnect();\n }\n\n resizeViewer = (entries: ResizeObserverEntry[]) => {\n const { width, height } = entries[0].contentRect;\n\n if (!width || !height) return; // <- invisible viewer, or viewer with parent removed\n\n const camera = this.viewer.camera as any;\n const aspect = width / height;\n\n if (camera.isPerspectiveCamera) {\n camera.aspect = aspect;\n camera.updateProjectionMatrix();\n }\n if (camera.isOrthographicCamera) {\n camera.left = camera.bottom * aspect;\n camera.right = camera.top * aspect;\n camera.updateProjectionMatrix();\n }\n\n this.viewer.renderer.setSize(width, height, true);\n\n this.viewer.update(true);\n this.viewer.emitEvent({ type: \"resize\", width, height });\n };\n}\n","import {\n Camera,\n CylinderGeometry,\n CanvasTexture,\n Color,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n OrthographicCamera,\n Sprite,\n SpriteMaterial,\n SRGBColorSpace,\n Vector4,\n WebGLRenderer,\n} from \"three\";\n\nexport class WCSHelper extends Object3D {\n private camera: Camera;\n private orthoCamera: OrthographicCamera;\n public size: number;\n\n constructor(camera: Camera) {\n super();\n\n this.camera = camera;\n this.size = 160;\n\n this.orthoCamera = new OrthographicCamera(-2, 2, 2, -2, 0, 4);\n this.orthoCamera.position.set(0, 0, 2);\n\n const matRed = new MeshBasicMaterial({ toneMapped: false, color: \"#aa0000\" });\n const matGreen = new MeshBasicMaterial({ toneMapped: false, color: \"#00aa00\" });\n const matBlue = new MeshBasicMaterial({ toneMapped: false, color: \"#0000aa\" });\n\n const spriteRed = this.getSpriteMaterial(matRed.color, \"X\");\n const spriteGreen = this.getSpriteMaterial(matGreen.color, \"Y\");\n const spriteBlue = this.getSpriteMaterial(matBlue.color, \"Z\");\n\n const lineGeometry = new CylinderGeometry(0.01, 0.01, 1, 3);\n lineGeometry.translate(0, 0.5, 0);\n\n const arrowGeometry = new CylinderGeometry(0, 0.1, 0.25, 12);\n arrowGeometry.translate(0, 0.625, 0);\n\n const axesMap = {\n X: [\n [new Mesh(arrowGeometry, matRed), [0.5, 0, 0], [0, 0, -Math.PI / 2]],\n [new Mesh(lineGeometry, matRed), [0, 0, 0], [0, 0, -Math.PI / 2]],\n [new Sprite(spriteRed), [1.55, 0, 0]],\n ],\n Y: [\n [new Mesh(arrowGeometry, matGreen), [0, 0.5, 0], null],\n [new Mesh(lineGeometry, matGreen), null, null],\n [new Sprite(spriteGreen), [0, 1.55, 0]],\n ],\n Z: [\n [new Mesh(arrowGeometry, matBlue), [0, 0, 0.5], [Math.PI / 2, 0, 0]],\n [new Mesh(lineGeometry, matBlue), null, [Math.PI / 2, 0, 0]],\n [new Sprite(spriteBlue), [0, 0, 1.55]],\n ],\n };\n\n Object.keys(axesMap).forEach((key) => {\n axesMap[key].forEach((objects: any) => {\n const object = objects[0];\n const position = objects[1];\n const rotation = objects[2];\n\n object.name = key;\n if (position) object.position.set(position[0], position[1], position[2]);\n if (rotation) object.rotation.set(rotation[0], rotation[1], rotation[2]);\n object.updateMatrixWorld();\n\n this.add(object);\n });\n });\n }\n\n dispose() {\n this.traverse((object: any) => {\n if (object.geometry) object.geometry.dispose();\n if (object.material) object.material.dispose();\n });\n }\n\n getSpriteMaterial(color: Color, text: string) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = 64;\n canvas.height = 64;\n\n const context = canvas.getContext(\"2d\");\n context.clearRect(0, 0, 64, 64);\n context.font = \"24px Arial\";\n context.textAlign = \"center\";\n context.fillStyle = color.getStyle();\n context.fillText(text, 32, 41);\n\n const texture = new CanvasTexture(canvas);\n texture.colorSpace = SRGBColorSpace;\n\n return new SpriteMaterial({ map: texture, toneMapped: false });\n }\n\n render(renderer: WebGLRenderer) {\n this.quaternion.copy(this.camera.quaternion).invert();\n this.updateMatrixWorld();\n\n const clippingPlanes = renderer.clippingPlanes;\n const viewport = renderer.getViewport(new Vector4());\n\n renderer.setViewport(this.position.x, this.position.y, this.size, this.size);\n renderer.clippingPlanes = [];\n renderer.clearDepth();\n renderer.render(this, this.orthoCamera);\n\n renderer.setViewport(viewport);\n renderer.clippingPlanes = clippingPlanes;\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\nimport { WCSHelper } from \"../helpers/WCSHelper\";\n\nexport class WCSHelperComponent implements IComponent {\n private wcsHelper: WCSHelper;\n private viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.wcsHelper = new WCSHelper(viewer.camera);\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.geometryEnd);\n this.viewer.addEventListener(\"drawviewpoint\", this.geometryEnd);\n this.viewer.addEventListener(\"render\", this.viewerRender);\n }\n\n dispose() {\n this.viewer.removeEventListener(\"databasechunk\", this.geometryEnd);\n this.viewer.removeEventListener(\"drawviewpoint\", this.geometryEnd);\n this.viewer.removeEventListener(\"render\", this.viewerRender);\n this.wcsHelper.dispose();\n }\n\n geometryEnd = () => {\n this.wcsHelper.dispose();\n this.wcsHelper = new WCSHelper(this.viewer.camera);\n };\n\n viewerRender = () => {\n if (!this.viewer.options.showWCS) return;\n if (this.viewer.extents.isEmpty()) return;\n\n this.wcsHelper.render(this.viewer.renderer);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponentsRegistry, componentsRegistry } from \"@inweb/viewer-core\";\n\n// import { AxesHelperComponent } from \"./AxesHelperComponent\";\nimport { BackgroundComponent } from \"./BackgroundComponent\";\nimport { CameraComponent } from \"./CameraComponent\";\nimport { ExtentsComponent } from \"./ExtentsComponent\";\n// import { ExtentsHelperComponent } from \"./ExtentsHelperComponent\";\n// import { LightComponent } from \"./LightComponent\";\n// import { LightHelperComponent } from \"./LightHelperComponent\";\nimport { RenderLoopComponent } from \"./RenderLoopComponent\";\nimport { ResizeCanvasComponent } from \"./ResizeCanvasComponent\";\nimport { SelectionComponent } from \"./SelectionComponent\";\nimport { WCSHelperComponent } from \"./WCSHelperComponent\";\n\n/**\n * Viewer components registry. Use this registry to register custom components.\n *\n * To implement custom component:\n *\n * 1. Define a component class implements {@link IComponent}.\n * 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.\n * 3. Define the component logic in the event listeners. For example, listen for the `mousedown` event and\n * select objects when the left mouse button is pressed.\n * 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.\n * 5. Register component provider in the components registry by calling the\n * {@link components.registerComponent}.\n *\n * @example Implementing a custom component.\n *\n * ```javascript\n * import { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n *\n * class MyComponent implements IComponent {\n * protected viewer: Viewer;\n *\n * constructor(viewer: Viewer) {\n * this.viewer = viewer;\n * this.viewer.addEventListener(\"mousedown\", this.onMouseDown);\n * }\n *\n * override dispose() {\n * this.viewer.removeEventListener(\"mousedown\", this.onMouseDown);\n * }\n *\n * onMouseDown = (event: PointerEvent) => {\n * // place custom logic here\n * };\n * }\n *\n * components.registerComponent(\"MyComponent\", (viewer): IComponent => new MyComponent(viewer));\n * ```\n */\nexport const components: IComponentsRegistry = componentsRegistry(\"threejs\");\n\n// build-in components\n\ncomponents.registerComponent(\"ExtentsComponent\", (viewer) => new ExtentsComponent(viewer));\ncomponents.registerComponent(\"CameraComponent\", (viewer) => new CameraComponent(viewer));\ncomponents.registerComponent(\"BackgroundComponent\", (viewer) => new BackgroundComponent(viewer));\n// components.registerComponent(\"LightComponent\", (viewer) => new LightComponent(viewer));\ncomponents.registerComponent(\"ResizeCanvasComponent\", (viewer) => new ResizeCanvasComponent(viewer));\ncomponents.registerComponent(\"RenderLoopComponent\", (viewer) => new RenderLoopComponent(viewer));\ncomponents.registerComponent(\"SelectionComponent\", (viewer) => new SelectionComponent(viewer));\n\ncomponents.registerComponent(\"WCSHelperComponent\", (viewer) => new WCSHelperComponent(viewer));\n// components.registerComponent(\"AxesHelperComponent\", (viewer) => new AxesHelperComponent(viewer));\n// components.registerComponent(\"ExtentsHelperComponent\", (viewer) => new ExtentsHelperComponent(viewer));\n// components.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { LoadingManager, LoaderUtils } from \"three\";\n\nexport class GLTFLoadingManager extends LoadingManager {\n public path = \"\";\n public resourcePath = \"\";\n public fileURL = \"\";\n public dataURLs = new Map();\n\n constructor(\n file: string | globalThis.File | ArrayBuffer | Blob,\n externalData: Map<string, string | File | ArrayBuffer | Blob> = new Map(),\n params: { path?: string } = {}\n ) {\n super();\n\n this.path = params.path || \"\";\n\n if (typeof file === \"string\") {\n this.fileURL = file;\n this.resourcePath = LoaderUtils.extractUrlBase(file);\n } else {\n externalData.forEach((value, key) => (this.fileURL = value === file ? key : this.fileURL));\n externalData.set(this.fileURL, file);\n }\n\n externalData.forEach((value, key) => {\n let dataURL: string;\n if (typeof value === \"string\") dataURL = value;\n else dataURL = URL.createObjectURL(new Blob([value]));\n this.dataURLs.set(key, dataURL);\n });\n\n this.setURLModifier((url: string) => {\n const key = decodeURI(url)\n .replace(this.path, \"\")\n .replace(this.resourcePath, \"\")\n .replace(/^(\\.?\\/)/, \"\");\n const dataURL = this.dataURLs.get(key);\n return dataURL ?? url;\n });\n }\n\n dispose() {\n this.dataURLs.forEach(URL.revokeObjectURL);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport {\n Box3,\n LinearToneMapping,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n Plane,\n Scene,\n Sphere,\n Vector2,\n Vector3,\n WebGLRenderer,\n} from \"three\";\nimport { GLTF, GLTFLoader } from \"three/examples/jsm/loaders/GLTFLoader.js\";\nimport { GLTFLoadingManager } from \"./loaders/GLTFLoadingManager\";\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\nimport { Assembly, Client, Model, File } from \"@inweb/client\";\nimport {\n CANVAS_EVENTS,\n CanvasEventMap,\n IClippingPlane,\n IComponent,\n IEntity,\n IDragger,\n IOptions,\n IOrthogonalCamera,\n IPerspectiveCamera,\n IPoint,\n IViewer,\n IViewpoint,\n Options,\n OptionsEventMap,\n ViewerEventMap,\n} from \"@inweb/viewer-core\";\nimport { IMarkup, IWorldTransform, Markup } from \"@inweb/markup\";\n\nimport { draggers } from \"./draggers\";\nimport { commands } from \"./commands\";\nimport { components } from \"./components\";\n\n/**\n * 3D viewer powered by {@link https://threejs.org/ | Three.js}.\n */\nexport class Viewer\n extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap>\n implements IViewer, IWorldTransform\n{\n public client: Client | undefined;\n protected _options: Options;\n\n private canvaseventlistener: (event: any) => void;\n\n public canvas: HTMLCanvasElement | undefined;\n public canvasEvents: string[];\n\n public scene: Scene | undefined;\n public helpers: Scene | undefined;\n public camera: PerspectiveCamera | OrthographicCamera | undefined;\n public renderer: WebGLRenderer | undefined;\n public models: Array<GLTF>;\n public selected: Array<Object3D>;\n public extents: Box3;\n public target: Vector3;\n\n private _activeDragger: IDragger | null;\n private _components: Array<IComponent>;\n\n private renderNeeded: boolean;\n private renderTime: DOMHighResTimeStamp;\n\n private _markup: IMarkup;\n\n /**\n * @param client - The `Client` instance that is used to load model reference files from the Open Cloud\n * Server. Do not specify `Client` if you need a standalone viewer instance to view `glTF` files from\n * the web or from local computer.\n */\n constructor(client?: Client) {\n super();\n this._options = new Options(this);\n\n this.client = client;\n\n this.canvasEvents = CANVAS_EVENTS;\n this.canvaseventlistener = (event: Event) => this.emit(event);\n\n this.models = [];\n this.selected = [];\n this.extents = new Box3();\n this.target = new Vector3();\n\n this._activeDragger = null;\n this._components = [];\n\n this.renderTime = 0;\n\n this.render = this.render.bind(this);\n this.update = this.update.bind(this);\n\n this._markup = new Markup();\n }\n\n get options(): IOptions {\n return this._options;\n }\n\n get draggers(): string[] {\n return [...draggers.getDraggers().keys()];\n }\n\n get components(): string[] {\n return [...components.getComponents().keys()];\n }\n\n /**\n * 2D markup core instance used to create markups.\n *\n * @readonly\n */\n get markup(): IMarkup {\n return this._markup;\n }\n\n initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent<EventTarget>) => void): Promise<this> {\n this.addEventListener(\"optionschange\", (event) => this.syncOptions(event.data));\n\n this.scene = new Scene();\n this.helpers = new Scene();\n\n const rect = canvas.parentElement.getBoundingClientRect();\n const width = rect.width || 1;\n const height = rect.height || 1;\n const aspect = width / height;\n this.camera = new PerspectiveCamera(45, aspect, 0.01, 1000);\n this.camera.up.set(0, 0, 1);\n\n this.renderer = new WebGLRenderer({ canvas, antialias: true, preserveDrawingBuffer: true });\n this.renderer.setPixelRatio(window.devicePixelRatio);\n this.renderer.setSize(width, height);\n this.renderer.toneMapping = LinearToneMapping;\n\n this.canvas = canvas;\n this.canvasEvents.forEach((x) => canvas.addEventListener(x, this.canvaseventlistener));\n\n this._markup.initialize(this.canvas, this.canvasEvents, this, this);\n\n for (const name of components.getComponents().keys()) {\n this._components.push(components.createComponent(name, this));\n }\n\n this.syncOptions();\n this.syncOverlay();\n\n this.renderTime = performance.now();\n this.render(this.renderTime);\n\n if (typeof onProgress === \"function\")\n onProgress(new ProgressEvent(\"progress\", { lengthComputable: true, loaded: 1, total: 1 }));\n\n this.emitEvent({ type: \"initializeprogress\", data: 1, loaded: 1, total: 1 });\n this.emitEvent({ type: \"initialize\" });\n\n return Promise.resolve(this);\n }\n\n dispose(): this {\n this.cancel();\n this.emitEvent({ type: \"dispose\" });\n\n this._components.forEach((component: IComponent) => component.dispose());\n this._components = [];\n\n this.setActiveDragger();\n this.removeAllListeners();\n\n this.clear();\n\n this._markup.dispose();\n\n if (this.canvas) {\n this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));\n this.canvas = undefined;\n }\n\n if (this.renderer) this.renderer.dispose();\n\n this.renderer = undefined;\n this.camera = undefined;\n this.scene = undefined;\n this.helpers = undefined;\n\n return this;\n }\n\n isInitialized(): boolean {\n return !!this.renderer;\n }\n\n public render(time: DOMHighResTimeStamp): void {\n if (!this.renderNeeded) return;\n if (!this.renderer) return;\n\n this.renderNeeded = false;\n\n this.renderer.setViewport(0, 0, this.canvas.offsetWidth, this.canvas.offsetHeight);\n this.renderer.autoClear = true;\n this.renderer.render(this.scene, this.camera);\n\n const clippingPlanes = this.renderer.clippingPlanes;\n this.renderer.clippingPlanes = [];\n this.renderer.autoClear = false;\n this.renderer.render(this.helpers, this.camera);\n this.renderer.clippingPlanes = clippingPlanes;\n\n this._activeDragger?.updatePreview?.();\n\n const deltaTime = (time - this.renderTime) / 1000;\n this.renderTime = time;\n this.emitEvent({ type: \"render\", time, deltaTime });\n }\n\n public update(force = false): void {\n this.renderNeeded = true;\n if (force) this.render(performance.now());\n this.emitEvent({ type: \"update\", data: force });\n }\n\n public syncOptions(options: IOptions = this.options): void {\n // this.update();\n }\n\n loadReferences(model: Model | File | Assembly): Promise<this> {\n // todo: load reference as text fonts\n return Promise.resolve(this);\n }\n\n /**\n * Loads a file from Open Cloud Server into the viewer.\n *\n * The file geometry data on the server must be converted to `glTF` format.\n *\n * This method requires a `Client` instance to be specified when creating the viewer to load model\n * reference files from the Open Cloud Server. For a standalone viewer instance use\n * {@link openGltfFile | openGltfFile()}.\n *\n * If there was an active dragger before opening the file, it will be deactivated. After opening the\n * file, you must manually activate the required dragger.\n *\n * Fires:\n *\n * - {@link OpenEvent | open}\n * - {@link GeometryStartEvent | geometrystart}\n * - {@link GeometryProgressEvent | geometryprogress}\n * - {@link DatabaseChunkEvent | databasechunk}\n * - {@link GeometryChunkEvent | geometrychunk}\n * - {@link GeometryEndEvent | geometryend}\n * - {@link GeometryErrorEvent | geometryerror}\n *\n * @param file - File, assembly or specific model to load. If a `File` instance with multiple models is\n * specified, the default model will be loaded. If there is no default model, first availiable model\n * will be loaded.\n */\n async open(file: Model | File | Assembly): Promise<this> {\n if (!this.renderer) return this;\n\n this.cancel();\n this.clear();\n\n this.emitEvent({ type: \"open\", file, model: file });\n\n let model: Model | undefined = undefined;\n if (file) {\n const models = (await file.getModels()) || [];\n model = models.find((model: Model) => model.default) || models[0];\n }\n if (!model) throw new Error(\"No default model found\");\n\n const geometryType = model.database.split(\".\").pop();\n if (geometryType !== \"gltf\") throw new Error(`Unknown geometry type: ${geometryType}`);\n\n const url = `${model.httpClient.serverUrl}${model.path}/${model.database}`;\n const params = { requestHeader: model.httpClient.headers };\n\n await this.loadReferences(model);\n await this.loadGltfFile(url, undefined, params);\n\n return this;\n }\n\n cancel(): this {\n this.emitEvent({ type: \"cancel\" });\n return this;\n }\n\n /**\n * Loads a `glTF` file into the viewer.\n *\n * If there was an active dragger before opening the file, it will be deactivated. After opening the\n * file, you must manually activate the required dragger.\n *\n * Fires:\n *\n * - {@link OpenEvent | open}\n * - {@link GeometryStartEvent | geometrystart}\n * - {@link GeometryProgressEvent | geometryprogress}\n * - {@link DatabaseChunkEvent | databasechunk}\n * - {@link GeometryEndEvent | geometryend}\n * - {@link GeometryErrorEvent | geometryerror}\n *\n * @param file - File URL or binary data buffer to load.\n * @param externalData - External resource map such as binary data buffers or images. Each resource\n * should be represented by a `uri` and a corresponding resource URL, or\n * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object, or\n * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}\n * or {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, or\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string,\n * @param params - Loader parameters.\n * @param params.path - The base path from which to find subsequent glTF resources such as textures and\n * .bin data files. If not defined, the base path of the file URL will be used.\n * @param params.requestHeader - The\n * {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP\n * request.\n * @param params.crossOrigin - The crossOrigin string to implement CORS for loading the url from a\n * different domain that allows CORS. Default is `anonymous`.\n * @param params.withCredentials - Whether the XMLHttpRequest uses credentials such as cookies,\n * authorization headers or TLS client certificates. See\n * {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}.\n */\n openGltfFile(\n file: string | globalThis.File | ArrayBuffer | Blob,\n externalData: Map<string, string | globalThis.File | ArrayBuffer | Blob> = new Map(),\n params: {\n path?: string;\n requestHeader?: HeadersInit;\n crossOrigin?: string;\n withCredentials?: boolean;\n } = {}\n ): Promise<this> {\n if (!this.renderer) return Promise.resolve(this);\n\n this.cancel();\n this.clear();\n\n this.emitEvent({ type: \"open\" });\n\n return this.loadGltfFile(file, externalData, params);\n }\n\n /**\n * Appends a `glTF` file to the existing opened file.\n *\n * Fires:\n *\n * - {@link OpenEvent | open}\n * - {@link GeometryStartEvent | geometrystart}\n * - {@link GeometryProgressEvent | geometryprogress}\n * - {@link DatabaseChunkEvent | databasechunk}\n * - {@link GeometryEndEvent | geometryend}\n * - {@link GeometryErrorEvent | geometryerror}\n *\n * @param file - File URL or binary data buffer to load.\n * @param externalData - External resource map such as binary data buffers or images. Each resource\n * should be represented by a `uri` and a corresponding resource URL, or\n * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object, or\n * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}\n * or {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, or\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string,\n * @param params - Loader parameters.\n * @param params.path - The base path from which to find subsequent glTF resources such as textures and\n * .bin data files.\n * @param params.requestHeader - The\n * {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP\n * request.\n * @param params.crossOrigin - The crossOrigin string to implement CORS for loading the url from a\n * different domain that allows CORS. Default is `anonymous`.\n * @param params.withCredentials - Whether the XMLHttpRequest uses credentials such as cookies,\n * authorization headers or TLS client certificates. See\n * {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}.\n */\n async loadGltfFile(\n file: string | globalThis.File | ArrayBuffer | Blob,\n externalData: Map<string, string | globalThis.File | ArrayBuffer | Blob> = new Map(),\n params: {\n path?: string;\n requestHeader?: HeadersInit;\n crossOrigin?: string;\n withCredentials?: boolean;\n } = {}\n ): Promise<this> {\n const manager = new GLTFLoadingManager(file, externalData, params);\n try {\n this.emitEvent({ type: \"geometrystart\" });\n\n const loader = new GLTFLoader(manager);\n loader.setPath(manager.path);\n loader.setRequestHeader(params.requestHeader as any);\n loader.setCrossOrigin(params.crossOrigin || loader.crossOrigin);\n loader.setWithCredentials(params.withCredentials || loader.withCredentials);\n\n const gltf = await loader.loadAsync(manager.fileURL, (event: ProgressEvent) => {\n const { lengthComputable, loaded, total } = event;\n const progress = lengthComputable ? loaded / total : 1;\n this.emitEvent({ type: \"geometryprogress\", data: progress });\n });\n\n if (!this.scene) return this;\n if (!gltf.scene) throw new Error(\"No glTF scene found\");\n\n this.models.push(gltf);\n this.scene.add(gltf.scene);\n\n this.syncOptions();\n this.syncOverlay();\n this.update();\n\n this.emitEvent({ type: \"databasechunk\" });\n this.emitEvent({ type: \"geometryend\", data: gltf.scene });\n } catch (error) {\n this.emitEvent({ type: \"geometryerror\", data: error });\n throw error;\n } finally {\n manager.dispose();\n }\n\n return this;\n }\n\n clear(): this {\n if (!this.renderer) return this;\n\n function disposeMaterial(material: any) {\n const materials = Array.isArray(material) ? material : [material];\n materials.forEach((material: any) => {\n // Object.keys(material).forEach((key) => material[key]?.dispose?.());\n material.dispose();\n });\n }\n\n function disposeObject(object: any) {\n if (object.geometry) object.geometry.dispose();\n if (object.material) disposeMaterial(object.material);\n }\n\n this.setActiveDragger();\n this.clearSlices();\n this.clearOverlay();\n this.clearSelected();\n\n this.helpers.traverse(disposeObject);\n this.helpers.clear();\n\n this.models.forEach((gltf) => gltf.scene.traverse(disposeObject));\n this.models.forEach((gltf) => gltf.scene.removeFromParent());\n this.models = [];\n\n this.scene.clear();\n\n this.syncOptions();\n this.syncOverlay();\n this.update(true);\n\n this.emitEvent({ type: \"clear\" });\n\n return this;\n }\n\n syncOverlay(): void {\n if (!this.renderer) return;\n\n this._markup.syncOverlay();\n this.update();\n }\n\n clearOverlay(): void {\n if (!this.renderer) return;\n\n this._markup.clearOverlay();\n this.update();\n }\n\n clearSlices(): void {\n if (!this.renderer) return;\n\n this.renderer.clippingPlanes = [];\n this.update();\n }\n\n getSelected(): string[] {\n return this.executeCommand(\"getSelected\");\n }\n\n setSelected(handles?: string[]): void {\n this.executeCommand(\"setSelected\", handles);\n }\n\n clearSelected(): void {\n this.executeCommand(\"clearSelected\");\n }\n\n hideSelected(): void {\n this.executeCommand(\"hideSelected\");\n }\n\n isolateSelected(): void {\n this.executeCommand(\"isolateSelected\");\n }\n\n showAll(): void {\n this.executeCommand(\"showAll\");\n }\n\n explode(index = 0): void {\n this.executeCommand(\"explode\", index);\n }\n\n collect(): void {\n this.executeCommand(\"collect\");\n }\n\n activeDragger(): IDragger | null {\n return this._activeDragger;\n }\n\n setActiveDragger(name = \"\"): IDragger | null {\n if (!this._activeDragger || this._activeDragger.name !== name) {\n const oldDragger = this._activeDragger;\n let newDragger = null;\n\n if (this._activeDragger) {\n this._activeDragger.dispose();\n this._activeDragger = null;\n }\n if (this.isInitialized()) {\n newDragger = draggers.createDragger(name, this);\n if (newDragger) {\n this._activeDragger = newDragger;\n this._activeDragger.initialize?.();\n }\n }\n\n const canvas = this.canvas;\n if (canvas) {\n if (oldDragger) canvas.classList.remove(`oda-cursor-${oldDragger.name.toLowerCase()}`);\n if (newDragger) canvas.classList.add(`oda-cursor-${newDragger.name.toLowerCase()}`);\n }\n\n this.emitEvent({ type: \"changeactivedragger\", data: name });\n this.update();\n }\n return this._activeDragger;\n }\n\n resetActiveDragger(): void {\n const dragger = this._activeDragger;\n if (dragger) {\n this.setActiveDragger();\n this.setActiveDragger(dragger.name);\n }\n }\n\n is3D(): boolean {\n return true;\n }\n\n screenToWorld(position: { x: number; y: number }): { x: number; y: number; z: number } {\n if (!this.renderer) return { x: position.x, y: position.y, z: 0 };\n\n const rect = this.canvas.getBoundingClientRect();\n const x = position.x / (rect.width / 2) - 1;\n const y = -position.y / (rect.height / 2) + 1;\n\n const point = new Vector3(x, y, -1);\n point.unproject(this.camera);\n\n return { x: point.x, y: point.y, z: point.z };\n }\n\n worldToScreen(position: { x: number; y: number; z: number }): { x: number; y: number } {\n if (!this.renderer) return { x: position.x, y: position.y };\n\n const point = new Vector3(position.x, position.y, position.z);\n point.project(this.camera);\n\n const rect = this.canvas.getBoundingClientRect();\n const x = (point.x + 1) * (rect.width / 2);\n const y = (-point.y + 1) * (rect.height / 2);\n\n return { x, y };\n }\n\n getScale(): { x: number; y: number; z: number } {\n return { x: 1, y: 1, z: 1 };\n }\n\n executeCommand(id: string, ...args: any[]): any {\n return commands.executeCommand(id, this, ...args);\n }\n\n getComponent(name: string): IComponent {\n return this._components.find((component) => component.name === name);\n }\n\n drawViewpoint(viewpoint: IViewpoint): void {\n if (!this.renderer) return;\n\n const getVector3FromPoint3d = ({ x, y, z }): Vector3 => new Vector3(x, y, z);\n\n const setOrthogonalCamera = (orthogonal_camera: IOrthogonalCamera) => {\n if (orthogonal_camera) {\n const extentsSize = this.extents.getBoundingSphere(new Sphere()).radius * 2;\n const rendererSize = this.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n this.camera = new OrthographicCamera();\n this.camera.top = orthogonal_camera.field_height / 2;\n this.camera.bottom = -orthogonal_camera.field_height / 2;\n this.camera.left = this.camera.bottom * aspect;\n this.camera.right = this.camera.top * aspect;\n this.camera.near = 0;\n this.camera.far = extentsSize * 100;\n this.camera.zoom = orthogonal_camera.view_to_world_scale;\n this.camera.updateProjectionMatrix();\n\n this.camera.up.copy(getVector3FromPoint3d(orthogonal_camera.up_vector));\n this.camera.position.copy(getVector3FromPoint3d(orthogonal_camera.view_point));\n this.camera.lookAt(getVector3FromPoint3d(orthogonal_camera.direction).add(this.camera.position));\n this.camera.updateMatrixWorld();\n }\n };\n\n const setPerspectiveCamera = (perspective_camera: IPerspectiveCamera) => {\n if (perspective_camera) {\n const extentsSize = this.extents.getBoundingSphere(new Sphere()).radius * 2;\n const rendererSize = this.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n this.camera = new PerspectiveCamera();\n this.camera.fov = perspective_camera.field_of_view;\n this.camera.aspect = aspect;\n this.camera.near = extentsSize / 100;\n this.camera.far = extentsSize * 100;\n this.camera.updateProjectionMatrix();\n\n this.camera.up.copy(getVector3FromPoint3d(perspective_camera.up_vector));\n this.camera.position.copy(getVector3FromPoint3d(perspective_camera.view_point));\n this.camera.lookAt(getVector3FromPoint3d(perspective_camera.direction).add(this.camera.position));\n this.camera.updateMatrixWorld();\n }\n };\n\n const setClippingPlanes = (clipping_planes: IClippingPlane[]) => {\n clipping_planes?.forEach((clipping_plane) => {\n const plane = new Plane();\n plane.setFromNormalAndCoplanarPoint(\n getVector3FromPoint3d(clipping_plane.direction),\n getVector3FromPoint3d(clipping_plane.location)\n );\n\n this.renderer.clippingPlanes.push(plane);\n });\n };\n\n const setSelection = (selection: IEntity[]) => {\n if (selection) this.setSelected(selection.map((component) => component.handle));\n };\n\n const draggerName = this._activeDragger?.name;\n\n this.setActiveDragger();\n this.clearSlices();\n this.clearOverlay();\n\n this.clearSelected();\n this.showAll();\n this.explode();\n\n setOrthogonalCamera(viewpoint.orthogonal_camera);\n setPerspectiveCamera(viewpoint.perspective_camera);\n setClippingPlanes(viewpoint.clipping_planes);\n setSelection(viewpoint.selection);\n this._markup.setViewpoint(viewpoint);\n\n this.target = getVector3FromPoint3d(viewpoint.custom_fields?.camera_target ?? this.target);\n\n this.setActiveDragger(draggerName);\n this.emitEvent({ type: \"drawviewpoint\", data: viewpoint });\n this.update();\n }\n\n createViewpoint(): IViewpoint {\n if (!this.renderer) return {};\n\n const getPoint3dFromVector3 = ({ x, y, z }): IPoint => ({ x, y, z });\n\n const getOrthogonalCamera = (): IOrthogonalCamera => {\n if (this.camera[\"isOrthographicCamera\"])\n return {\n view_point: getPoint3dFromVector3(this.camera.position),\n direction: getPoint3dFromVector3(this.camera.getWorldDirection(new Vector3())),\n up_vector: getPoint3dFromVector3(this.camera.up),\n field_width: this.camera[\"right\"] - this.camera[\"left\"],\n field_height: this.camera[\"top\"] - this.camera[\"bottom\"],\n view_to_world_scale: this.camera.zoom,\n };\n else return undefined;\n };\n\n const getPerspectiveCamera = (): IPerspectiveCamera => {\n if (this.camera[\"isPerspectiveCamera\"])\n return {\n view_point: getPoint3dFromVector3(this.camera.position),\n direction: getPoint3dFromVector3(this.camera.getWorldDirection(new Vector3())),\n up_vector: getPoint3dFromVector3(this.camera.up),\n field_of_view: this.camera[\"fov\"],\n };\n else return undefined;\n };\n\n const getClippingPlanes = (): IClippingPlane[] => {\n const clipping_planes = [];\n this.renderer.clippingPlanes.forEach((plane: Plane) => {\n const clipping_plane = {\n location: getPoint3dFromVector3(plane.coplanarPoint(new Vector3())),\n direction: getPoint3dFromVector3(plane.normal),\n };\n clipping_planes.push(clipping_plane);\n });\n return clipping_planes;\n };\n\n const getSelection = (): IEntity[] => {\n return this.getSelected().map((handle) => ({ handle }));\n };\n\n const viewpoint: IViewpoint = { custom_fields: {} };\n\n viewpoint.orthogonal_camera = getOrthogonalCamera();\n viewpoint.perspective_camera = getPerspectiveCamera();\n viewpoint.clipping_planes = getClippingPlanes();\n viewpoint.selection = getSelection();\n viewpoint.description = new Date().toDateString();\n this._markup.getViewpoint(viewpoint);\n\n viewpoint.custom_fields.camera_target = getPoint3dFromVector3(this.target);\n\n this.emitEvent({ type: \"createviewpoint\", data: viewpoint });\n\n return viewpoint;\n }\n}\n"],"names":["PlaneHelper","Line","constructor","plane","size","color","offset","Vector3","positions","geometry","BufferGeometry","setAttribute","Float32BufferAttribute","computeBoundingSphere","super","LineBasicMaterial","toneMapped","this","type","positions2","geometry2","helper","Mesh","MeshBasicMaterial","opacity","transparent","depthWrite","side","DoubleSide","add","dispose","material","children","updateMatrixWorld","force","position","set","lookAt","normal","copy","translateZ","dot","constant","scale","_changeEvent","_startEvent","_endEvent","STATE","NONE","ROTATE","DOLLY","PAN","TOUCH_ROTATE","TOUCH_PAN","TOUCH_DOLLY_PAN","TOUCH_DOLLY_ROTATE","OrbitControls","EventDispatcher","object","domElement","style","touchAction","enabled","target","minDistance","maxDistance","Infinity","minZoom","maxZoom","minPolarAngle","maxPolarAngle","Math","PI","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","enableZoom","zoomSpeed","enableRotate","rotateSpeed","enablePan","panSpeed","screenSpacePanning","keyPanSpeed","autoRotate","autoRotateSpeed","keys","LEFT","UP","RIGHT","BOTTOM","mouseButtons","MOUSE","MIDDLE","touches","ONE","TOUCH","TWO","DOLLY_PAN","target0","clone","position0","zoom0","zoom","_domElementKeyEvents","getPolarAngle","spherical","phi","getAzimuthalAngle","theta","getDistance","distanceTo","listenToKeyEvents","addEventListener","onKeyDown","stopListenToKeyEvents","removeEventListener","saveState","scope","reset","updateProjectionMatrix","dispatchEvent","update","state","quat","Quaternion","setFromUnitVectors","up","quatInverse","invert","lastPosition","lastQuaternion","lastTargetPosition","twoPI","sub","applyQuaternion","setFromVector3","rotateLeft","getAutoRotationAngle","sphericalDelta","min","max","isFinite","makeSafe","radius","addScaledVector","panOffset","setFromSpherical","multiplyScalar","zoomChanged","distanceToSquared","EPS","quaternion","onContextMenu","onPointerDown","onPointerUp","onMouseWheel","onPointerMove","Spherical","rotateStart","Vector2","rotateEnd","rotateDelta","panStart","panEnd","panDelta","dollyStart","dollyEnd","dollyDelta","dollyScale","pointers","pointerPositions","getZoomScale","pow","angle","rotateUp","panLeft","v","distance","objectMatrix","setFromMatrixColumn","panUp","crossVectors","pan","deltaX","deltaY","element","isPerspectiveCamera","targetDistance","length","tan","fov","clientHeight","matrix","isOrthographicCamera","right","left","clientWidth","top","bottom","console","warn","dollyOut","dollyIn","handleMouseDownRotate","event","clientX","clientY","handleMouseDownDolly","handleMouseDownPan","handleMouseMoveRotate","subVectors","x","y","handleMouseMoveDolly","handleMouseMovePan","handleMouseWheel","handleKeyDown","needsUpdate","code","ctrlKey","metaKey","shiftKey","preventDefault","handleTouchStartRotate","pageX","pageY","handleTouchStartPan","handleTouchStartDolly","dx","dy","sqrt","handleTouchStartDollyPan","handleTouchStartDollyRotate","handleTouchMoveRotate","getSecondPointerPosition","handleTouchMovePan","handleTouchMoveDolly","handleTouchMoveDollyPan","handleTouchMoveDollyRotate","setPointerCapture","pointerId","addPointer","pointerType","onTouchStart","onMouseDown","onTouchMove","onMouseMove","removePointer","releasePointerCapture","mouseAction","button","trackPointer","DOLLY_ROTATE","push","i","splice","undefined","pointer","passive","OrbitDragger","viewer","updateControls","orbit","camera","far","near","controlsStart","changed","controlsChange","emitEvent","dX","dY","data","stopContextMenu","stopPropagation","canvas","on","initialize","off","CuttingPlaneDragger","transformChange","planeCenter","transformDrag","value","viewerExplode","planeHelper","extents","getSize","onDoubleClick","negate","center","getCenter","Plane","renderer","clippingPlanes","helpers","Object3D","transform","TransformControls","showX","showY","showZ","z","attach","getHelper","removeFromParent","detach","CuttingPlaneXAxisDragger","CuttingPlaneYAxisDragger","CuttingPlaneZAxisDragger","PRECISION","MeasureLineDragger","line","startPoint","snapper","getSnapPoint","render","endPoint","MeasureLine","overlay","addLine","onPointerCancel","PointerEvent","onPointerLeave","renderOverlay","updateSnapper","scene","MeasureOverlay","MeasureSnapper","objects","raycaster","Raycaster","mouse","rect","getBoundingClientRect","width","height","coords","setFromCamera","params","threshold","Line2","LOD","Points","Sprite","intersects","intersectObjects","point","traverseVisible","child","lines","projector","MeasureProjector","container","document","createElement","id","background","outline","pointerEvents","overflow","parentElement","appendChild","clear","remove","forEach","removeLine","filter","_middlePoint","Date","now","unit","lineWidth","border","boxShadow","font","elementStartPoint","elementEndPoint","elementLine","elementLabel","visible","projectPoint","display","point1","point2","projectLine","lerpVectors","innerHTML","toFixed","zIndex","borderRadius","transformOrigin","padding","paddingInline","_widthHalf","_heightHalf","_viewMatrix","Matrix4","_viewProjectionMatrix","_vector","_vector1","Vector4","_vector2","matrixWorldInverse","multiplyMatrices","projectionMatrix","p","applyMatrix4","p1","p2","bc1near","w","bc2near","bc1far","bc2far","alpha1","alpha2","lerp","PanDragger","WalkControls","Controls","movementSpeed","lookSpeed","multiplier","moveWheel","mouseDragOn","downPosition","movePosition","rotateCamera","onWheel","moveKeys","onKeyUp","delete","Set","moveClock","Clock","window","timeDelta","getDelta","moveDelta","has","translateX","translateY","lookDelta","sign","stop","autoStart","delta","rotateX","rotateY","xRotation","setFromAxisAngle","yRotation","premultiply","multiply","normalize","setRotationFromQuaternion","WalkDragger","controls","walkspeedChange","viewerRender","viewerZoom","ZoomDragger","draggers","draggersRegistry","registerDragger","applyModelTransform","model","clearMarkup","clearOverlay","SelectionComponent","isPrimary","getMousePosition","upPosition","getPointerIntersects","clearSelection","select","handles","getSelected","executeCommand","optionsChange","facesColor","facesTransparancy","options","facesMaterial","setRGB","r","g","b","isSelected","originalMaterial","selected","clearSelected","selection","clearSlices","createPreview","encoderOptions","toDataURL","calcExplodeDepth","depth","res","objectDepth","originalPosition","originalCenter","Box3","setFromObject","isExplodeLocked","explodeScene","coeff","explodeDepth","maxDepth","scaledExplodeDepth","currentSegmentFraction","explodeObject","objectScale","parentCenter","parent","objectCenter","objectOffset","explode","index","models","collect","zoomTo","box","isEmpty","sphere","getBoundingSphere","Sphere","rendererSize","aspect","MathUtils","DEG2RAD","defaultViewPositions","front","back","sw","se","ne","nw","setDefaultViewPosition","direction","emit","getDefaultViewPositions","Object","getModels","map","_a","userData","handle","hideSelected","isolateSelected","visibleSet","traverseAncestors","object2","traverse","regenerateAll","resetView","selectModel","setActiveDragger","dragger","setMarkupColor","markup","setSelected","handleSet","showAll","zoomToExtents","zoomToObjects","reduce","result","expandByObject","zoomToSelected","commands","commandsRegistry","registerCommand","registerCommandAlias","BackgroundComponent","syncOptions","backgroundColor","setHex","Color","environment","RoomEnvironment","pmremGenerator","PMREMGenerator","setClearColor","fromScene","texture","CameraComponent","geometryEnd","extentsSize","sceneCamera","isCamera","ExtentsComponent","syncExtents","RenderLoopComponent","animate","time","requestId","requestAnimationFrame","cancelAnimationFrame","ResizeCanvasComponent","resizeViewer","entries","contentRect","setSize","resizeObserver","ResizeObserver","observe","disconnect","WCSHelper","orthoCamera","OrthographicCamera","matRed","matGreen","matBlue","spriteRed","getSpriteMaterial","spriteGreen","spriteBlue","lineGeometry","CylinderGeometry","translate","arrowGeometry","axesMap","X","Y","Z","key","rotation","name","text","context","getContext","clearRect","textAlign","fillStyle","getStyle","fillText","CanvasTexture","colorSpace","SRGBColorSpace","SpriteMaterial","viewport","getViewport","setViewport","clearDepth","WCSHelperComponent","wcsHelper","showWCS","components","componentsRegistry","registerComponent","GLTFLoadingManager","LoadingManager","file","externalData","Map","path","resourcePath","fileURL","dataURLs","LoaderUtils","extractUrlBase","dataURL","URL","createObjectURL","Blob","setURLModifier","url","decodeURI","replace","get","revokeObjectURL","Viewer","EventEmitter2","client","_options","Options","canvasEvents","CANVAS_EVENTS","canvaseventlistener","_activeDragger","_components","renderTime","bind","_markup","Markup","getDraggers","getComponents","onProgress","Scene","PerspectiveCamera","WebGLRenderer","antialias","preserveDrawingBuffer","setPixelRatio","devicePixelRatio","toneMapping","LinearToneMapping","createComponent","syncOverlay","performance","ProgressEvent","lengthComputable","loaded","total","Promise","resolve","cancel","component","removeAllListeners","isInitialized","renderNeeded","offsetWidth","offsetHeight","autoClear","_b","updatePreview","deltaTime","loadReferences","open","find","default","Error","geometryType","database","split","pop","httpClient","serverUrl","requestHeader","headers","loadGltfFile","openGltfFile","manager","loader","GLTFLoader","setPath","setRequestHeader","setCrossOrigin","crossOrigin","setWithCredentials","withCredentials","gltf","loadAsync","progress","error","disposeMaterial","materials","Array","isArray","disposeObject","activeDragger","oldDragger","newDragger","createDragger","classList","toLowerCase","resetActiveDragger","is3D","screenToWorld","unproject","worldToScreen","project","getScale","args","getComponent","drawViewpoint","viewpoint","getVector3FromPoint3d","setOrthogonalCamera","orthogonal_camera","field_height","view_to_world_scale","up_vector","view_point","setPerspectiveCamera","perspective_camera","field_of_view","setClippingPlanes","clipping_planes","clipping_plane","setFromNormalAndCoplanarPoint","location","setSelection","draggerName","setViewpoint","custom_fields","camera_target","_c","createViewpoint","getPoint3dFromVector3","getOrthogonalCamera","getWorldDirection","field_width","getPerspectiveCamera","getClippingPlanes","coplanarPoint","getSelection","description","toDateString","getViewpoint"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,MAAMA,oBAAoBC;IAMxB,WAAAC,CAAYC,OAAcC,OAAO,GAAGC,QAAQ,UAAUC,SAAkB,IAAIC;QAE1E,MAAMC,YAAY,EAAC,GAAG,GAAG,IAAG,GAAI,GAAG,IAAK,IAAI,GAAE,GAAG,IAAG,GAAI,GAAG,GAAG,GAAG;QAEjE,MAAMC,WAAW,IAAIC;QACrBD,SAASE,aAAa,YAAY,IAAIC,uBAAuBJ,WAAW;QACxEC,SAASI;QAETC,MAAML,UAAU,IAAIM,kBAAkB;YAAEV;YAAOW,YAAY;;QAE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AO;gBAChD8f,cAActvB,KAAKwP,OAAO,SAASxP,KAAKwP,OAAO;gBAC/C+f,qBAAqBvvB,KAAKwP,OAAOjK;oBAEhC,OAAO0J;AAAS;QAGvB,MAAM4hB,uBAAuB;YAC3B,IAAI7wB,KAAKwP,OAAO,wBACd,OAAO;gBACLigB,YAAYgB,sBAAsBzwB,KAAKwP,OAAOtO;gBAC9C4f,WAAW2P,sBAAsBzwB,KAAKwP,OAAOmhB,kBAAkB,IAAIrxB;gBACnEkwB,WAAWiB,sBAAsBzwB,KAAKwP,OAAOzI;gBAC7C6oB,eAAe5vB,KAAKwP,OAAO;oBAE1B,OAAOP;AAAS;QAGvB,MAAM6hB,oBAAoB;YACxB,MAAMhB,kBAAkB;YACxB9vB,KAAKsR,SAASC,eAAeuE,SAAS5W;gBACpC,MAAM6wB,iBAAiB;oBACrBE,UAAUQ,sBAAsBvxB,MAAM6xB,cAAc,IAAIzxB;oBACxDwhB,WAAW2P,sBAAsBvxB,MAAMmC;;gBAEzCyuB,gBAAgBhhB,KAAKihB;AAAe;YAEtC,OAAOD;AAAe;QAGxB,MAAMkB,eAAe,MACZhxB,KAAK+c,cAAcoE,KAAKG,WAAY;YAAEA;;QAG/C,MAAM4N,YAAwB;YAAEmB,eAAe;;QAE/CnB,UAAUG,oBAAoBqB;QAC9BxB,UAAUS,qBAAqBkB;QAC/B3B,UAAUY,kBAAkBgB;QAC5B5B,UAAUpR,YAAYkT;QACtB9B,UAAU+B,eAAc,IAAI/a,MAAOgb;QACnClxB,KAAK+pB,QAAQoH,aAAajC;QAE1BA,UAAUmB,cAAcC,gBAAgBG,sBAAsBzwB,KAAK8C;QAEnE9C,KAAK8P,UAAU;YAAE7P,MAAM;YAAmBgQ,MAAMif;;QAEhD,OAAOA;;;;"}
|
|
1
|
+
{"version":3,"file":"viewer-three.module.js","sources":["../src/Viewer/helpers/PlaneHelper.ts","../src/Viewer/controls/OrbitControls.js","../src/Viewer/draggers/OrbitDragger.ts","../src/Viewer/draggers/CuttingPlaneDragger.ts","../src/Viewer/draggers/CuttingPlaneXAxis.ts","../src/Viewer/draggers/CuttingPlaneYAxis.ts","../src/Viewer/draggers/CuttingPlaneZAxis.ts","../src/Viewer/draggers/MeasureLineDragger.ts","../src/Viewer/draggers/PanDragger.ts","../src/Viewer/controls/WalkControls.ts","../src/Viewer/draggers/WalkDragger.ts","../src/Viewer/draggers/ZoomDragger.ts","../src/Viewer/draggers/index.ts","../src/Viewer/commands/ApplyModelTransform.ts","../src/Viewer/commands/ClearMarkup.ts","../src/Viewer/components/SelectionComponent.ts","../src/Viewer/commands/ClearSelected.ts","../src/Viewer/commands/ClearSlices.ts","../src/Viewer/commands/CreatePreview.ts","../src/Viewer/commands/Explode.ts","../src/Viewer/commands/ZoomTo.ts","../src/Viewer/commands/SetDefaultViewPosition.ts","../src/Viewer/commands/GetDefaultViewPositions.ts","../src/Viewer/commands/GetModels.ts","../src/Viewer/commands/GetSelected.ts","../src/Viewer/commands/HideSelected.ts","../src/Viewer/commands/IsolateSelected.ts","../src/Viewer/commands/RegenerateAll.ts","../src/Viewer/commands/ResetView.ts","../src/Viewer/commands/SelectModel.ts","../src/Viewer/commands/SetActiveDragger.ts","../src/Viewer/commands/SetMarkupColor.ts","../src/Viewer/commands/SetSelected.ts","../src/Viewer/commands/ShowAll.ts","../src/Viewer/commands/ZoomToExtents.ts","../src/Viewer/commands/ZoomToObjects.ts","../src/Viewer/commands/ZoomToSelected.ts","../src/Viewer/commands/index.ts","../src/Viewer/components/BackgroundComponent.ts","../src/Viewer/components/CameraComponent.ts","../src/Viewer/components/ExtentsComponent.ts","../src/Viewer/components/RenderLoopComponent.ts","../src/Viewer/components/ResizeCanvasComponent.ts","../src/Viewer/helpers/WCSHelper.ts","../src/Viewer/components/WCSHelperComponent.ts","../src/Viewer/components/index.ts","../src/Viewer/loaders/GLTFLoadingManager.ts","../src/Viewer/Viewer.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport {\n BufferGeometry,\n DoubleSide,\n Float32BufferAttribute,\n Line,\n LineBasicMaterial,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Plane,\n Vector3,\n} from \"three\";\n\nclass PlaneHelper extends Line {\n public plane: Plane;\n public size: number;\n public offset: Vector3;\n public helper: Object3D;\n\n constructor(plane: Plane, size = 1, color = 0xffff00, offset: Vector3 = new Vector3()) {\n // const positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];\n const positions = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];\n\n const geometry = new BufferGeometry();\n geometry.setAttribute(\"position\", new Float32BufferAttribute(positions, 3));\n geometry.computeBoundingSphere();\n\n super(geometry, new LineBasicMaterial({ color, toneMapped: false }));\n\n (this as any).type = \"PlaneHelper\";\n\n this.plane = plane;\n this.size = size;\n this.offset = offset;\n\n const positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const geometry2 = new BufferGeometry();\n geometry2.setAttribute(\"position\", new Float32BufferAttribute(positions2, 3));\n geometry2.computeBoundingSphere();\n\n this.helper = new Mesh(\n geometry2,\n new MeshBasicMaterial({\n color,\n opacity: 0.2,\n transparent: true,\n depthWrite: false,\n toneMapped: false,\n side: DoubleSide,\n })\n );\n this.add(this.helper);\n }\n\n dispose() {\n this.geometry.dispose();\n (this.material as any).dispose();\n (this.children[0] as any).geometry.dispose();\n (this.children[0] as any).material.dispose();\n }\n\n override updateMatrixWorld(force: boolean) {\n this.position.set(0, 0, 0);\n this.lookAt(this.plane.normal);\n\n this.position.copy(this.offset);\n this.translateZ(-(this.offset.dot(this.plane.normal) + this.plane.constant));\n\n this.scale.set(0.5 * this.size, 0.5 * this.size, 1);\n\n super.updateMatrixWorld(force);\n }\n}\n\nexport { PlaneHelper };\n","import { EventDispatcher, MOUSE, Quaternion, Spherical, TOUCH, Vector2, Vector3 } from \"three\";\n\n// OrbitControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nconst _changeEvent = { type: \"change\" };\nconst _startEvent = { type: \"start\" };\nconst _endEvent = { type: \"end\" };\n\nconst STATE = {\n NONE: -1,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_PAN: 4,\n TOUCH_DOLLY_PAN: 5,\n TOUCH_DOLLY_ROTATE: 6,\n};\n\nclass OrbitControls extends EventDispatcher {\n constructor(object, domElement) {\n super();\n\n this.object = object;\n this.domElement = domElement;\n this.domElement.style.touchAction = \"none\"; // disable touch scroll\n\n // Set to false to disable this control\n this.enabled = true;\n\n // \"target\" sets the location of focus, where the object orbits around\n this.target = new Vector3();\n\n // How far you can dolly in and out ( PerspectiveCamera only )\n this.minDistance = 0;\n this.maxDistance = Infinity;\n\n // How far you can zoom in and out ( OrthographicCamera only )\n this.minZoom = 0;\n this.maxZoom = Infinity;\n\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n\n // How far you can orbit horizontally, upper and lower limits.\n // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n this.minAzimuthAngle = -Infinity; // radians\n this.maxAzimuthAngle = Infinity; // radians\n\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n this.enableDamping = false;\n this.dampingFactor = 0.05;\n\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n this.enableZoom = true;\n this.zoomSpeed = 1.0;\n\n // Set to false to disable rotating\n this.enableRotate = true;\n this.rotateSpeed = 1.0;\n\n // Set to false to disable panning\n this.enablePan = true;\n this.panSpeed = 1.0;\n this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up\n this.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60\n\n // The four arrow keys\n this.keys = { LEFT: \"ArrowLeft\", UP: \"ArrowUp\", RIGHT: \"ArrowRight\", BOTTOM: \"ArrowDown\" };\n\n // Mouse buttons\n this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };\n\n // Touch fingers\n this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };\n\n // for reset\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.zoom0 = this.object.zoom;\n\n // the target DOM element for key events\n this._domElementKeyEvents = null;\n\n //\n // public methods\n //\n\n this.getPolarAngle = function () {\n return spherical.phi;\n };\n\n this.getAzimuthalAngle = function () {\n return spherical.theta;\n };\n\n this.getDistance = function () {\n return this.object.position.distanceTo(this.target);\n };\n\n this.listenToKeyEvents = function (domElement) {\n domElement.addEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = domElement;\n };\n\n this.stopListenToKeyEvents = function () {\n this._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = null;\n };\n\n this.saveState = function () {\n scope.target0.copy(scope.target);\n scope.position0.copy(scope.object.position);\n scope.zoom0 = scope.object.zoom;\n };\n\n this.reset = function () {\n scope.target.copy(scope.target0);\n scope.object.position.copy(scope.position0);\n scope.object.zoom = scope.zoom0;\n\n scope.object.updateProjectionMatrix();\n scope.dispatchEvent(_changeEvent);\n\n scope.update();\n\n scope.state = STATE.NONE;\n };\n\n // this method is exposed, but perhaps it would be better if we can make it private...\n this.update = (function () {\n const offset = new Vector3();\n\n // so camera.up is the orbit axis\n const quat = new Quaternion().setFromUnitVectors(object.up, new Vector3(0, 1, 0));\n const quatInverse = quat.clone().invert();\n\n const lastPosition = new Vector3();\n const lastQuaternion = new Quaternion();\n const lastTargetPosition = new Vector3();\n\n const twoPI = 2 * Math.PI;\n\n return function update() {\n const position = scope.object.position;\n\n offset.copy(position).sub(scope.target);\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat);\n\n // angle from z-axis around y-axis\n spherical.setFromVector3(offset);\n\n if (scope.autoRotate && scope.state === STATE.NONE) {\n rotateLeft(getAutoRotationAngle());\n }\n\n if (scope.enableDamping) {\n spherical.theta += sphericalDelta.theta * scope.dampingFactor;\n spherical.phi += sphericalDelta.phi * scope.dampingFactor;\n } else {\n spherical.theta += sphericalDelta.theta;\n spherical.phi += sphericalDelta.phi;\n }\n\n // restrict theta to be between desired limits\n\n let min = scope.minAzimuthAngle;\n let max = scope.maxAzimuthAngle;\n\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI) min += twoPI;\n else if (min > Math.PI) min -= twoPI;\n\n if (max < -Math.PI) max += twoPI;\n else if (max > Math.PI) max -= twoPI;\n\n if (min <= max) {\n spherical.theta = Math.max(min, Math.min(max, spherical.theta));\n } else {\n spherical.theta =\n spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);\n }\n }\n\n // restrict phi to be between desired limits\n spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));\n\n spherical.makeSafe();\n\n spherical.radius *= scope.scale;\n\n // restrict radius to be between desired limits\n spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));\n\n // move target to panned location\n\n if (scope.enableDamping === true) {\n scope.target.addScaledVector(scope.panOffset, scope.dampingFactor);\n } else {\n scope.target.add(scope.panOffset);\n }\n\n offset.setFromSpherical(spherical);\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse);\n\n position.copy(scope.target).add(offset);\n\n scope.object.lookAt(scope.target);\n\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor;\n sphericalDelta.phi *= 1 - scope.dampingFactor;\n\n scope.panOffset.multiplyScalar(1 - scope.dampingFactor);\n } else {\n sphericalDelta.set(0, 0, 0);\n\n scope.panOffset.set(0, 0, 0);\n }\n\n scope.scale = 1;\n\n // update condition is:\n // min(camera displacement, camera rotation in radians)^2 > EPS\n // using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n if (\n scope.zoomChanged ||\n lastPosition.distanceToSquared(scope.object.position) > EPS ||\n 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS ||\n lastTargetPosition.distanceToSquared(scope.target) > 0\n ) {\n scope.dispatchEvent(_changeEvent);\n\n lastPosition.copy(scope.object.position);\n lastQuaternion.copy(scope.object.quaternion);\n lastTargetPosition.copy(scope.target);\n\n scope.zoomChanged = false;\n\n return true;\n }\n\n return false;\n };\n })();\n\n this.dispose = function () {\n scope.domElement.removeEventListener(\"contextmenu\", onContextMenu);\n\n scope.domElement.removeEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.removeEventListener(\"pointercancel\", onPointerUp);\n scope.domElement.removeEventListener(\"wheel\", onMouseWheel);\n\n scope.domElement.removeEventListener(\"pointermove\", onPointerMove);\n scope.domElement.removeEventListener(\"pointerup\", onPointerUp);\n\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n scope._domElementKeyEvents = null;\n }\n\n //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n };\n\n //\n // internals\n //\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const scope = this;\n\n scope.state = STATE.NONE;\n\n const EPS = 0.000001;\n\n // current position in spherical coordinates\n const spherical = new Spherical();\n const sphericalDelta = new Spherical();\n\n scope.scale = 1;\n scope.panOffset = new Vector3();\n scope.zoomChanged = false;\n\n scope.rotateStart = new Vector2();\n scope.rotateEnd = new Vector2();\n scope.rotateDelta = new Vector2();\n\n scope.panStart = new Vector2();\n scope.panEnd = new Vector2();\n scope.panDelta = new Vector2();\n\n scope.dollyStart = new Vector2();\n scope.dollyEnd = new Vector2();\n scope.dollyDelta = new Vector2();\n scope.dollyScale = 0;\n\n scope.pointers = [];\n scope.pointerPositions = {};\n\n function getAutoRotationAngle() {\n return ((2 * Math.PI) / 60 / 60) * scope.autoRotateSpeed;\n }\n\n function getZoomScale() {\n return Math.pow(0.95, scope.zoomSpeed);\n }\n\n function rotateLeft(angle) {\n sphericalDelta.theta -= angle;\n }\n\n function rotateUp(angle) {\n sphericalDelta.phi -= angle;\n }\n\n const panLeft = (function () {\n const v = new Vector3();\n\n return function panLeft(distance, objectMatrix) {\n v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix\n v.multiplyScalar(-distance);\n\n scope.panOffset.add(v);\n };\n })();\n\n const panUp = (function () {\n const v = new Vector3();\n\n return function panUp(distance, objectMatrix) {\n if (scope.screenSpacePanning === true) {\n v.setFromMatrixColumn(objectMatrix, 1);\n } else {\n v.setFromMatrixColumn(objectMatrix, 0);\n v.crossVectors(scope.object.up, v);\n }\n\n v.multiplyScalar(distance);\n\n scope.panOffset.add(v);\n };\n })();\n\n // deltaX and deltaY are in pixels; right and down are positive\n const pan = (function () {\n const offset = new Vector3();\n\n return function pan(deltaX, deltaY) {\n const element = scope.domElement;\n\n if (scope.object.isPerspectiveCamera) {\n // perspective\n const position = scope.object.position;\n offset.copy(position).sub(scope.target);\n let targetDistance = offset.length();\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(((scope.object.fov / 2) * Math.PI) / 180.0);\n\n // we use only clientHeight here so aspect ratio does not distort speed\n panLeft((2 * deltaX * targetDistance) / element.clientHeight, scope.object.matrix);\n panUp((2 * deltaY * targetDistance) / element.clientHeight, scope.object.matrix);\n } else if (scope.object.isOrthographicCamera) {\n // orthographic\n panLeft(\n (deltaX * (scope.object.right - scope.object.left)) / scope.object.zoom / element.clientWidth,\n scope.object.matrix\n );\n panUp(\n (deltaY * (scope.object.top - scope.object.bottom)) / scope.object.zoom / element.clientHeight,\n scope.object.matrix\n );\n } else {\n // camera neither orthographic nor perspective\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.\");\n scope.enablePan = false;\n }\n };\n })();\n\n function dollyOut(dollyScale) {\n if (scope.object.isPerspectiveCamera) {\n scope.scale /= dollyScale;\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n scope.object.updateProjectionMatrix();\n scope.zoomChanged = true;\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n\n function dollyIn(dollyScale) {\n if (scope.object.isPerspectiveCamera) {\n scope.scale *= dollyScale;\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n scope.object.updateProjectionMatrix();\n scope.zoomChanged = true;\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n\n //\n // event callbacks - update the object state\n //\n\n function handleMouseDownRotate(event) {\n scope.rotateStart.set(event.clientX, event.clientY);\n }\n\n function handleMouseDownDolly(event) {\n scope.dollyStart.set(event.clientX, event.clientY);\n }\n\n function handleMouseDownPan(event) {\n scope.panStart.set(event.clientX, event.clientY);\n }\n\n function handleMouseMoveRotate(event) {\n scope.rotateEnd.set(event.clientX, event.clientY);\n\n scope.rotateDelta.subVectors(scope.rotateEnd, scope.rotateStart).multiplyScalar(scope.rotateSpeed);\n\n const element = scope.domElement;\n\n rotateLeft((2 * Math.PI * scope.rotateDelta.x) / element.clientHeight); // yes, height\n\n rotateUp((2 * Math.PI * scope.rotateDelta.y) / element.clientHeight);\n\n scope.rotateStart.copy(scope.rotateEnd);\n\n scope.update();\n }\n\n function handleMouseMoveDolly(event) {\n scope.dollyEnd.set(event.clientX, event.clientY);\n\n scope.dollyDelta.subVectors(scope.dollyEnd, scope.dollyStart);\n\n if (scope.dollyDelta.y < 0) {\n scope.dollyScale = 1 / getZoomScale();\n dollyOut(getZoomScale());\n } else if (scope.dollyDelta.y > 0) {\n scope.dollyScale = getZoomScale();\n dollyIn(getZoomScale());\n }\n\n scope.dollyStart.copy(scope.dollyEnd);\n\n scope.update();\n }\n\n function handleMouseMovePan(event) {\n scope.panEnd.set(event.clientX, event.clientY);\n\n scope.panDelta.subVectors(scope.panEnd, scope.panStart).multiplyScalar(scope.panSpeed);\n\n pan(scope.panDelta.x, scope.panDelta.y);\n\n scope.panStart.copy(scope.panEnd);\n\n scope.update();\n }\n\n function handleMouseWheel(event) {\n scope.dollyEnd.set(scope.domElement.clientWidth / 2, scope.domElement.clientHeight / 2);\n\n scope.dollyDelta.set(event.deltaX, event.deltaY);\n\n if (event.deltaY < 0) {\n scope.dollyScale = 1 / getZoomScale();\n dollyIn(getZoomScale());\n } else if (event.deltaY > 0) {\n scope.dollyScale = getZoomScale();\n dollyOut(getZoomScale());\n }\n\n scope.dollyStart.copy(scope.dollyEnd);\n\n scope.update();\n\n if (event.deltaY !== 0) {\n scope.state = STATE.DOLLY;\n scope.dispatchEvent(_changeEvent);\n scope.state = STATE.NONE;\n }\n }\n\n function handleKeyDown(event) {\n let needsUpdate = false;\n\n switch (event.code) {\n case scope.keys.UP:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateUp((2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(0, scope.keyPanSpeed);\n }\n\n needsUpdate = true;\n break;\n\n case scope.keys.BOTTOM:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateUp((-2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(0, -scope.keyPanSpeed);\n }\n\n needsUpdate = true;\n break;\n\n case scope.keys.LEFT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateLeft((2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(scope.keyPanSpeed, 0);\n }\n\n needsUpdate = true;\n break;\n\n case scope.keys.RIGHT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateLeft((-2 * Math.PI * scope.rotateSpeed) / scope.domElement.clientHeight);\n } else {\n pan(-scope.keyPanSpeed, 0);\n }\n\n needsUpdate = true;\n break;\n }\n\n if (needsUpdate) {\n // prevent the browser from scrolling on cursor keys\n event.preventDefault();\n\n scope.update();\n }\n }\n\n function handleTouchStartRotate() {\n if (scope.pointers.length === 1) {\n scope.rotateStart.set(scope.pointers[0].pageX, scope.pointers[0].pageY);\n } else {\n const x = 0.5 * (scope.pointers[0].pageX + scope.pointers[1].pageX);\n const y = 0.5 * (scope.pointers[0].pageY + scope.pointers[1].pageY);\n\n scope.rotateStart.set(x, y);\n }\n }\n\n function handleTouchStartPan() {\n if (scope.pointers.length === 1) {\n scope.panStart.set(scope.pointers[0].pageX, scope.pointers[0].pageY);\n } else {\n const x = 0.5 * (scope.pointers[0].pageX + scope.pointers[1].pageX);\n const y = 0.5 * (scope.pointers[0].pageY + scope.pointers[1].pageY);\n\n scope.panStart.set(x, y);\n }\n }\n\n function handleTouchStartDolly() {\n const dx = scope.pointers[0].pageX - scope.pointers[1].pageX;\n const dy = scope.pointers[0].pageY - scope.pointers[1].pageY;\n\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n scope.dollyStart.set(0, distance);\n }\n\n function handleTouchStartDollyPan() {\n if (scope.enableZoom) handleTouchStartDolly();\n\n if (scope.enablePan) handleTouchStartPan();\n }\n\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom) handleTouchStartDolly();\n\n if (scope.enableRotate) handleTouchStartRotate();\n }\n\n function handleTouchMoveRotate(event) {\n if (scope.pointers.length == 1) {\n scope.rotateEnd.set(event.pageX, event.pageY);\n } else {\n const position = getSecondPointerPosition(event);\n\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n\n scope.rotateEnd.set(x, y);\n }\n\n scope.rotateDelta.subVectors(scope.rotateEnd, scope.rotateStart).multiplyScalar(scope.rotateSpeed);\n\n const element = scope.domElement;\n\n rotateLeft((2 * Math.PI * scope.rotateDelta.x) / element.clientHeight); // yes, height\n\n rotateUp((2 * Math.PI * scope.rotateDelta.y) / element.clientHeight);\n\n scope.rotateStart.copy(scope.rotateEnd);\n }\n\n function handleTouchMovePan(event) {\n if (scope.pointers.length === 1) {\n scope.panEnd.set(event.pageX, event.pageY);\n } else {\n const position = getSecondPointerPosition(event);\n\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n\n scope.panEnd.set(x, y);\n }\n\n scope.panDelta.subVectors(scope.panEnd, scope.panStart).multiplyScalar(scope.panSpeed);\n\n pan(scope.panDelta.x, scope.panDelta.y);\n\n scope.panStart.copy(scope.panEnd);\n }\n\n function handleTouchMoveDolly(event) {\n const position = getSecondPointerPosition(event);\n\n const dx = event.pageX - position.x;\n const dy = event.pageY - position.y;\n\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n scope.dollyEnd.set(0, distance);\n\n scope.dollyDelta.set(0, Math.pow(scope.dollyEnd.y / scope.dollyStart.y, scope.zoomSpeed));\n\n dollyOut(scope.dollyDelta.y);\n\n scope.dollyStart.copy(scope.dollyEnd);\n }\n\n function handleTouchMoveDollyPan(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n\n if (scope.enablePan) handleTouchMovePan(event);\n }\n\n function handleTouchMoveDollyRotate(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n\n if (scope.enableRotate) handleTouchMoveRotate(event);\n }\n\n //\n // event handlers - FSM: listen for events and reset state\n //\n\n function onPointerDown(event) {\n if (scope.enabled === false) return;\n\n if (scope.pointers.length === 0) {\n scope.domElement.setPointerCapture(event.pointerId);\n\n scope.domElement.addEventListener(\"pointermove\", onPointerMove);\n scope.domElement.addEventListener(\"pointerup\", onPointerUp);\n }\n\n //\n\n addPointer(event);\n\n if (event.pointerType === \"touch\") {\n onTouchStart(event);\n } else {\n onMouseDown(event);\n }\n }\n\n function onPointerMove(event) {\n if (scope.enabled === false) return;\n\n if (event.pointerType === \"touch\") {\n onTouchMove(event);\n } else {\n onMouseMove(event);\n }\n }\n\n function onPointerUp(event) {\n removePointer(event);\n\n if (scope.pointers.length === 0) {\n scope.domElement.releasePointerCapture(event.pointerId);\n\n scope.domElement.removeEventListener(\"pointermove\", onPointerMove);\n scope.domElement.removeEventListener(\"pointerup\", onPointerUp);\n }\n\n scope.dispatchEvent(_endEvent);\n\n scope.state = STATE.NONE;\n }\n\n function onMouseDown(event) {\n let mouseAction;\n\n switch (event.button) {\n case 0:\n mouseAction = scope.mouseButtons.LEFT;\n break;\n\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE;\n break;\n\n case 2:\n mouseAction = scope.mouseButtons.RIGHT;\n break;\n\n default:\n mouseAction = -1;\n }\n\n switch (mouseAction) {\n case MOUSE.DOLLY:\n if (scope.enableZoom === false) return;\n\n handleMouseDownDolly(event);\n\n scope.state = STATE.DOLLY;\n\n break;\n\n case MOUSE.ROTATE:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enablePan === false) return;\n\n handleMouseDownPan(event);\n\n scope.state = STATE.PAN;\n } else {\n if (scope.enableRotate === false) return;\n\n handleMouseDownRotate(event);\n\n scope.state = STATE.ROTATE;\n }\n\n break;\n\n case MOUSE.PAN:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enableRotate === false) return;\n\n handleMouseDownRotate(event);\n\n scope.state = STATE.ROTATE;\n } else {\n if (scope.enablePan === false) return;\n\n handleMouseDownPan(event);\n\n scope.state = STATE.PAN;\n }\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n if (scope.state !== STATE.NONE) {\n scope.dispatchEvent(_startEvent);\n }\n }\n\n function onMouseMove(event) {\n switch (scope.state) {\n case STATE.ROTATE:\n if (scope.enableRotate === false) return;\n\n handleMouseMoveRotate(event);\n\n break;\n\n case STATE.DOLLY:\n if (scope.enableZoom === false) return;\n\n handleMouseMoveDolly(event);\n\n break;\n\n case STATE.PAN:\n if (scope.enablePan === false) return;\n\n handleMouseMovePan(event);\n\n break;\n }\n }\n\n function onMouseWheel(event) {\n if (scope.enabled === false || scope.enableZoom === false || scope.state !== STATE.NONE) return;\n\n event.preventDefault();\n\n scope.dispatchEvent(_startEvent);\n\n handleMouseWheel(event);\n\n scope.dispatchEvent(_endEvent);\n }\n\n function onKeyDown(event) {\n if (scope.enabled === false || scope.enablePan === false) return;\n\n handleKeyDown(event);\n }\n\n function onTouchStart(event) {\n trackPointer(event);\n\n switch (scope.pointers.length) {\n case 1:\n switch (scope.touches.ONE) {\n case TOUCH.ROTATE:\n if (scope.enableRotate === false) return;\n\n handleTouchStartRotate();\n\n scope.state = STATE.TOUCH_ROTATE;\n\n break;\n\n case TOUCH.PAN:\n if (scope.enablePan === false) return;\n\n handleTouchStartPan();\n\n scope.state = STATE.TOUCH_PAN;\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n break;\n\n case 2:\n switch (scope.touches.TWO) {\n case TOUCH.DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n\n handleTouchStartDollyPan();\n\n scope.state = STATE.TOUCH_DOLLY_PAN;\n\n break;\n\n case TOUCH.DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n\n handleTouchStartDollyRotate();\n\n scope.state = STATE.TOUCH_DOLLY_ROTATE;\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n\n if (scope.state !== STATE.NONE) {\n scope.dispatchEvent(_startEvent);\n }\n }\n\n function onTouchMove(event) {\n trackPointer(event);\n\n switch (scope.state) {\n case STATE.TOUCH_ROTATE:\n if (scope.enableRotate === false) return;\n\n handleTouchMoveRotate(event);\n\n scope.update();\n\n break;\n\n case STATE.TOUCH_PAN:\n if (scope.enablePan === false) return;\n\n handleTouchMovePan(event);\n\n scope.update();\n\n break;\n\n case STATE.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n\n handleTouchMoveDollyPan(event);\n\n scope.update();\n\n break;\n\n case STATE.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n\n handleTouchMoveDollyRotate(event);\n\n scope.update();\n\n break;\n\n default:\n scope.state = STATE.NONE;\n }\n }\n\n function onContextMenu(event) {\n if (scope.enabled === false) return;\n\n event.preventDefault();\n }\n\n function addPointer(event) {\n scope.pointers.push(event);\n }\n\n function removePointer(event) {\n delete scope.pointerPositions[event.pointerId];\n\n for (let i = 0; i < scope.pointers.length; i++) {\n if (scope.pointers[i].pointerId == event.pointerId) {\n scope.pointers.splice(i, 1);\n return;\n }\n }\n }\n\n function trackPointer(event) {\n let position = scope.pointerPositions[event.pointerId];\n\n if (position === undefined) {\n position = new Vector2();\n scope.pointerPositions[event.pointerId] = position;\n }\n\n position.set(event.pageX, event.pageY);\n }\n\n function getSecondPointerPosition(event) {\n const pointer = event.pointerId === scope.pointers[0].pointerId ? scope.pointers[1] : scope.pointers[0];\n\n return scope.pointerPositions[pointer.pointerId];\n }\n\n //\n\n scope.domElement.addEventListener(\"contextmenu\", onContextMenu);\n\n scope.domElement.addEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.addEventListener(\"pointercancel\", onPointerUp);\n scope.domElement.addEventListener(\"wheel\", onMouseWheel, { passive: false });\n\n // force an update at start\n\n this.update();\n }\n}\n\nexport { OrbitControls, STATE };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { MOUSE, TOUCH } from \"three\";\nimport { type IDragger } from \"@inweb/viewer-core\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { OrbitControls, STATE } from \"../controls/OrbitControls.js\";\n\nexport class OrbitDragger implements IDragger {\n protected viewer: Viewer;\n protected orbit: OrbitControls;\n protected changed: boolean;\n\n constructor(viewer: Viewer) {\n this.orbit = new OrbitControls(viewer.camera, viewer.canvas);\n this.orbit.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN };\n this.orbit.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };\n this.orbit.screenSpacePanning = true;\n this.orbit.rotateSpeed = 0.33;\n this.orbit.addEventListener(\"start\", this.controlsStart);\n this.orbit.addEventListener(\"change\", this.controlsChange);\n this.changed = false;\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.updateControls);\n this.viewer.on(\"viewposition\", this.updateControls);\n this.viewer.addEventListener(\"zoom\", this.updateControls);\n this.viewer.addEventListener(\"drawviewpoint\", this.updateControls);\n this.viewer.addEventListener(\"contextmenu\", this.stopContextMenu);\n this.updateControls();\n }\n\n initialize() {}\n\n dispose(): void {\n this.viewer.removeEventListener(\"databasechunk\", this.updateControls);\n this.viewer.off(\"viewposition\", this.updateControls);\n this.viewer.removeEventListener(\"zoom\", this.updateControls);\n this.viewer.removeEventListener(\"drawviewpoint\", this.updateControls);\n this.viewer.removeEventListener(\"contextmenu\", this.stopContextMenu);\n\n this.orbit.removeEventListener(\"start\", this.controlsStart);\n this.orbit.removeEventListener(\"change\", this.controlsChange);\n this.orbit.dispose();\n }\n\n updateControls = () => {\n this.orbit.maxDistance = this.viewer.camera.far;\n this.orbit.minDistance = this.viewer.camera.near;\n this.orbit.object = this.viewer.camera;\n this.orbit.target.copy(this.viewer.target);\n this.orbit.update();\n };\n\n controlsStart = () => {\n this.changed = false;\n };\n\n controlsChange = () => {\n this.viewer.target.copy(this.orbit.target);\n this.viewer.update();\n\n switch (this.orbit.state) {\n case STATE.PAN:\n case STATE.TOUCH_PAN:\n this.viewer.emitEvent({\n type: \"pan\",\n x: this.orbit.panEnd.x,\n y: this.orbit.panEnd.y,\n dX: this.orbit.panDelta.x,\n dY: this.orbit.panDelta.y,\n });\n break;\n\n case STATE.DOLLY:\n this.viewer.emitEvent({\n type: \"zoomat\",\n data: this.orbit.dollyScale,\n x: this.orbit.dollyEnd.x,\n y: this.orbit.dollyEnd.y,\n });\n break;\n }\n\n this.changed = true;\n };\n\n stopContextMenu = (event: PointerEvent) => {\n if (this.changed) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Object3D, Plane, Vector3 } from \"three\";\nimport { TransformControls } from \"three/examples/jsm/controls/TransformControls.js\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { PlaneHelper } from \"../helpers/PlaneHelper\";\nimport { OrbitDragger } from \"./OrbitDragger\";\n\nexport class CuttingPlaneDragger extends OrbitDragger {\n protected plane: Plane;\n protected planeCenter: Object3D;\n protected planeHelper: PlaneHelper;\n protected transform: TransformControls;\n\n constructor(viewer: Viewer, normal: Vector3, color: number) {\n super(viewer);\n\n const size = viewer.extents.getSize(new Vector3()).length();\n const center = viewer.extents.getCenter(new Vector3());\n const constant = -center.dot(normal);\n\n this.plane = new Plane(normal, constant);\n\n if (!viewer.renderer.clippingPlanes) viewer.renderer.clippingPlanes = [];\n viewer.renderer.clippingPlanes.push(this.plane);\n\n this.planeHelper = new PlaneHelper(this.plane, size, color, center);\n this.viewer.helpers.add(this.planeHelper);\n\n this.planeCenter = new Object3D();\n this.planeCenter.position.copy(viewer.extents.getCenter(new Vector3()));\n this.viewer.helpers.add(this.planeCenter);\n\n this.transform = new TransformControls(viewer.camera, viewer.canvas);\n this.transform.showX = !!normal.x;\n this.transform.showY = !!normal.y;\n this.transform.showZ = !!normal.z;\n this.transform.attach(this.planeCenter);\n this.transform.addEventListener(\"change\", this.transformChange);\n this.transform.addEventListener(\"dragging-changed\", this.transformDrag);\n this.viewer.helpers.add(this.transform.getHelper());\n\n this.viewer.on(\"explode\", this.viewerExplode);\n this.viewer.canvas.addEventListener(\"dblclick\", this.onDoubleClick, true);\n this.viewer.update();\n }\n\n override dispose() {\n this.viewer.off(\"explode\", this.viewerExplode);\n this.viewer.canvas.removeEventListener(\"dblclick\", this.onDoubleClick, true);\n\n this.transform.removeEventListener(\"change\", this.transformChange);\n this.transform.removeEventListener(\"dragging-changed\", this.transformDrag);\n this.transform.getHelper().removeFromParent();\n this.transform.detach();\n this.transform.dispose();\n\n this.planeHelper.removeFromParent();\n this.planeHelper.dispose();\n\n this.planeCenter.removeFromParent();\n\n // this.viewer.renderer.clippingPlanes = this.viewer.renderer.clippingPlanes.filter((plane) => plane !== this.plane);\n // this.viewer.update();\n\n super.dispose();\n }\n\n transformChange = () => {\n this.plane.constant = -this.planeCenter.position.dot(this.plane.normal);\n this.viewer.update();\n };\n\n transformDrag = (event) => {\n this.orbit.enabled = !event.value;\n };\n\n viewerExplode = () => {\n this.planeHelper.size = this.viewer.extents.getSize(new Vector3()).length();\n this.viewer.update();\n };\n\n onDoubleClick = (event: PointerEvent) => {\n event.stopPropagation();\n\n this.plane.negate();\n this.viewer.update();\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { CuttingPlaneDragger } from \"./CuttingPlaneDragger\";\n\nexport class CuttingPlaneXAxisDragger extends CuttingPlaneDragger {\n constructor(viewer: Viewer) {\n super(viewer, new Vector3(1, 0, 0), 0xff0000);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { CuttingPlaneDragger } from \"./CuttingPlaneDragger\";\n\nexport class CuttingPlaneYAxisDragger extends CuttingPlaneDragger {\n constructor(viewer: Viewer) {\n super(viewer, new Vector3(0, 1, 0), 0x00ff00);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { CuttingPlaneDragger } from \"./CuttingPlaneDragger\";\n\nexport class CuttingPlaneZAxisDragger extends CuttingPlaneDragger {\n constructor(viewer: Viewer) {\n super(viewer, new Vector3(0, 0, 1), 0x0000ff);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Camera, Matrix4, Object3D, Scene, Raycaster, Vector2, Vector3, Vector4 } from \"three\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { OrbitDragger } from \"./OrbitDragger\";\n\nconst PRECISION = 0.01;\n\nexport class MeasureLineDragger extends OrbitDragger {\n private overlay: MeasureOverlay;\n private line: MeasureLine;\n private snapper: MeasureSnapper;\n\n constructor(viewer: Viewer) {\n super(viewer);\n\n this.overlay = new MeasureOverlay(viewer.camera, viewer.canvas);\n this.overlay.attach();\n\n this.line = new MeasureLine(this.overlay);\n this.overlay.addLine(this.line);\n\n this.snapper = new MeasureSnapper(viewer.camera, viewer.canvas);\n this.snapper.update(viewer.scene);\n\n this.viewer.canvas.addEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.canvas.addEventListener(\"pointermove\", this.onPointerMove);\n this.viewer.canvas.addEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.canvas.addEventListener(\"pointercancel\", this.onPointerCancel);\n this.viewer.canvas.addEventListener(\"pointerleave\", this.onPointerLeave);\n\n this.viewer.addEventListener(\"render\", this.renderOverlay);\n this.viewer.addEventListener(\"hide\", this.updateSnapper);\n this.viewer.addEventListener(\"isolate\", this.updateSnapper);\n this.viewer.addEventListener(\"showall\", this.updateSnapper);\n }\n\n override dispose() {\n this.viewer.canvas.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.canvas.removeEventListener(\"pointermove\", this.onPointerMove);\n this.viewer.canvas.removeEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.canvas.removeEventListener(\"pointercancel\", this.onPointerCancel);\n this.viewer.canvas.removeEventListener(\"pointerleave\", this.onPointerLeave);\n\n this.viewer.removeEventListener(\"render\", this.renderOverlay);\n this.viewer.removeEventListener(\"hide\", this.updateSnapper);\n this.viewer.removeEventListener(\"isolate\", this.updateSnapper);\n this.viewer.removeEventListener(\"showall\", this.updateSnapper);\n\n this.overlay.detach();\n this.overlay.dispose();\n\n super.dispose();\n }\n\n onPointerDown = (event: PointerEvent) => {\n if (event.button !== 0) return;\n\n this.line.startPoint = this.snapper.getSnapPoint(event);\n this.line.render();\n\n this.viewer.canvas.setPointerCapture(event.pointerId);\n this.orbit.enabled = !this.line.startPoint;\n };\n\n onPointerMove = (event: PointerEvent) => {\n if (this.orbit.enabled && this.orbit.state !== -1) return;\n\n this.line.endPoint = this.snapper.getSnapPoint(event);\n this.line.render();\n\n if (this.line.startPoint) this.changed = true; // <- to prevent context menu\n };\n\n onPointerUp = (event: PointerEvent) => {\n if (this.line.startPoint && this.line.endPoint && this.line.getDistance() >= PRECISION) {\n this.line = new MeasureLine(this.overlay);\n this.overlay.addLine(this.line);\n } else {\n this.line.startPoint = undefined;\n this.line.endPoint = undefined;\n this.line.render();\n }\n\n this.viewer.canvas.releasePointerCapture(event.pointerId);\n this.orbit.enabled = true;\n };\n\n onPointerCancel = (event: PointerEvent) => {\n this.viewer.canvas.dispatchEvent(new PointerEvent(\"pointerup\", event));\n };\n\n onPointerLeave = () => {\n this.line.endPoint = undefined;\n this.line.render();\n };\n\n renderOverlay = () => {\n this.overlay.render();\n };\n\n updateSnapper = () => {\n this.snapper.update(this.viewer.scene);\n };\n}\n\nclass MeasureSnapper {\n private camera: Camera;\n private canvas: HTMLCanvasElement;\n private objects: Object3D[] = [];\n private raycaster: Raycaster;\n\n constructor(camera: Camera, canvas: HTMLCanvasElement) {\n this.camera = camera;\n this.canvas = canvas;\n this.raycaster = new Raycaster();\n }\n\n getSnapPoint(event: PointerEvent): Vector3 | undefined {\n const mouse = new Vector2(event.clientX, event.clientY);\n\n const rect = this.canvas.getBoundingClientRect();\n const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;\n const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;\n\n const coords = new Vector2(x, y);\n this.raycaster.setFromCamera(coords, this.camera);\n\n this.raycaster.params = {\n Mesh: {},\n Line: { threshold: 0.25 },\n Line2: { threshold: 0.25 },\n LOD: {},\n Points: { threshold: 0.1 },\n Sprite: {},\n };\n\n const intersects = this.raycaster.intersectObjects(this.objects, false);\n if (intersects.length === 0) return undefined;\n\n return intersects[0].point;\n }\n\n update(scene: Scene) {\n this.objects = [];\n scene.traverseVisible((child) => this.objects.push(child));\n }\n}\n\nclass MeasureOverlay {\n public camera: Camera;\n public canvas: HTMLCanvasElement;\n public container: HTMLElement;\n public lines: MeasureLine[] = [];\n public projector: MeasureProjector;\n\n constructor(camera: Camera, canvas: HTMLCanvasElement) {\n this.camera = camera;\n this.canvas = canvas;\n this.projector = new MeasureProjector(camera, canvas);\n }\n\n attach() {\n this.container = document.createElement(\"div\");\n this.container.id = \"measure-container\";\n this.container.style.background = \"rgba(0,0,0,0)\";\n this.container.style.position = \"absolute\";\n this.container.style.top = \"0px\";\n this.container.style.left = \"0px\";\n this.container.style.width = \"100%\";\n this.container.style.height = \"100%\";\n this.container.style.outline = \"none\";\n this.container.style.pointerEvents = \"none\";\n this.container.style.overflow = \"hidden\";\n\n this.canvas.parentElement.appendChild(this.container);\n }\n\n dispose() {\n this.clear();\n }\n\n detach() {\n this.container.remove();\n this.container = undefined;\n }\n\n clear() {\n this.lines.forEach((line) => line.dispose());\n this.lines = [];\n }\n\n render() {\n this.projector.updateProjectionMatrix();\n this.lines.forEach((line) => line.render());\n }\n\n update() {\n this.lines.forEach((line) => line.update());\n }\n\n addLine(line: MeasureLine) {\n this.lines.push(line);\n }\n\n removeLine(line: MeasureLine) {\n this.lines = this.lines.filter((x) => x !== line);\n }\n}\n\nconst _middlePoint = new Vector3();\n\nclass MeasureLine {\n private overlay: MeasureOverlay;\n\n private elementStartPoint: HTMLElement;\n private elementEndPoint: HTMLElement;\n private elementLine: HTMLElement;\n private elementLabel: HTMLElement;\n\n public startPoint: Vector3;\n public endPoint: Vector3;\n\n public id = Date.now();\n public unit = \"\";\n public scale = 1.0;\n public size = 10.0;\n public lineWidth = 2;\n\n public style = {\n border: \"2px solid #FFFFFF\",\n background: \"#009bff\",\n boxShadow: \"0 0 10px rgba(0,0,0,0.5)\",\n color: \"white\",\n font: \"1rem system-ui\",\n };\n\n constructor(overlay: MeasureOverlay) {\n this.overlay = overlay;\n\n this.elementStartPoint = overlay.container.appendChild(document.createElement(\"div\"));\n this.elementEndPoint = overlay.container.appendChild(document.createElement(\"div\"));\n this.elementLine = overlay.container.appendChild(document.createElement(\"div\"));\n this.elementLabel = overlay.container.appendChild(document.createElement(\"div\"));\n\n this.update();\n }\n\n dispose() {\n this.elementStartPoint.remove();\n this.elementEndPoint.remove();\n this.elementLine.remove();\n this.elementLabel.remove();\n }\n\n render() {\n const projector = this.overlay.projector;\n\n if (this.startPoint) {\n const { point, visible } = projector.projectPoint(this.startPoint);\n\n this.elementStartPoint.style.display = visible ? \"block\" : \"none\";\n this.elementStartPoint.style.left = `${point.x}px`;\n this.elementStartPoint.style.top = `${point.y}px`;\n } else {\n this.elementStartPoint.style.display = \"none\";\n }\n\n if (this.endPoint) {\n const { point, visible } = projector.projectPoint(this.endPoint);\n\n this.elementEndPoint.style.display = visible ? \"block\" : \"none\";\n this.elementEndPoint.style.left = `${point.x}px`;\n this.elementEndPoint.style.top = `${point.y}px`;\n } else {\n this.elementEndPoint.style.display = \"none\";\n }\n\n if (this.startPoint && this.endPoint) {\n const { point1, point2, visible } = projector.projectLine(this.startPoint, this.endPoint);\n\n point2.sub(point1);\n const angle = point2.angle();\n const width = point2.length();\n\n this.elementLine.style.display = visible ? \"block\" : \"none\";\n this.elementLine.style.left = `${point1.x}px`;\n this.elementLine.style.top = `${point1.y}px`;\n this.elementLine.style.width = `${width}px`;\n this.elementLine.style.transform = `translate(0px, ${-this.lineWidth / 2}px) rotate(${angle}rad)`;\n } else {\n this.elementLine.style.display = \"none\";\n }\n\n if (this.startPoint && this.endPoint) {\n _middlePoint.lerpVectors(this.startPoint, this.endPoint, 0.5);\n const { point, visible } = projector.projectPoint(_middlePoint);\n\n const distance = this.getDistance();\n\n this.elementLabel.style.display = visible && distance >= PRECISION ? \"block\" : \"none\";\n this.elementLabel.style.left = `${point.x}px`;\n this.elementLabel.style.top = `${point.y}px`;\n this.elementLabel.innerHTML = `${distance.toFixed(2)} ${this.unit}`;\n } else {\n this.elementLabel.style.display = \"none\";\n }\n }\n\n update() {\n this.elementStartPoint.id = `markup-dot-start-${this.id}`;\n this.elementStartPoint.style.position = \"absolute\";\n this.elementStartPoint.style.zIndex = \"2\";\n this.elementStartPoint.style.width = `${this.size}px`;\n this.elementStartPoint.style.height = `${this.size}px`;\n this.elementStartPoint.style.border = this.style.border;\n this.elementStartPoint.style.borderRadius = `${this.size}px`;\n this.elementStartPoint.style.background = this.style.background;\n this.elementStartPoint.style.boxShadow = this.style.boxShadow;\n this.elementStartPoint.style.transform = \"translate(-50%, -50%)\";\n\n this.elementEndPoint.id = `markup-dot-end-${this.id}`;\n this.elementEndPoint.style.position = \"absolute\";\n this.elementEndPoint.style.zIndex = \"2\";\n this.elementEndPoint.style.width = `${this.size}px`;\n this.elementEndPoint.style.height = `${this.size}px`;\n this.elementEndPoint.style.border = this.style.border;\n this.elementEndPoint.style.borderRadius = `${this.size}px`;\n this.elementEndPoint.style.background = this.style.background;\n this.elementEndPoint.style.boxShadow = this.style.boxShadow;\n this.elementEndPoint.style.transform = \"translate(-50%, -50%)\";\n\n this.elementLine.id = `markup-line-${this.id}`;\n this.elementLine.style.position = \"absolute\";\n this.elementLine.style.zIndex = \"1\";\n this.elementLine.style.height = `${this.lineWidth}px`;\n this.elementLine.style.background = this.style.background;\n this.elementLine.style.boxShadow = this.style.boxShadow;\n this.elementLine.style.transformOrigin = `0px ${this.lineWidth / 2}px`;\n\n this.elementLabel.id = `markup-label-${this.id}`;\n this.elementLabel.style.position = \"absolute\";\n this.elementLabel.style.zIndex = \"3\";\n this.elementLabel.style.padding = \"2px\";\n this.elementLabel.style.paddingInline = \"5px\";\n this.elementLabel.style.borderRadius = \"5px\";\n this.elementLabel.style.background = this.style.background;\n this.elementLabel.style.boxShadow = this.style.boxShadow;\n this.elementLabel.style.color = this.style.color;\n this.elementLabel.style.font = this.style.font;\n this.elementLabel.style.transform = \"translate(-50%, -50%)\";\n }\n\n getDistance(): number {\n return this.startPoint.distanceTo(this.endPoint) / this.scale;\n }\n}\n\nlet _widthHalf: number;\nlet _heightHalf: number;\nconst _viewMatrix = new Matrix4();\nconst _viewProjectionMatrix = new Matrix4();\nconst _vector = new Vector3();\nconst _vector1 = new Vector4();\nconst _vector2 = new Vector4();\nconst point = new Vector2();\nconst point1 = new Vector2();\nconst point2 = new Vector2();\n\nclass MeasureProjector {\n private camera: Camera;\n private canvas: HTMLElement;\n\n constructor(camera: Camera, canvas: HTMLCanvasElement) {\n this.camera = camera;\n this.canvas = canvas;\n }\n\n updateProjectionMatrix() {\n const rect = this.canvas.getBoundingClientRect();\n _widthHalf = rect.width / 2;\n _heightHalf = rect.height / 2;\n\n _viewMatrix.copy(this.camera.matrixWorldInverse);\n _viewProjectionMatrix.multiplyMatrices(this.camera.projectionMatrix, _viewMatrix);\n }\n\n projectPoint(p: Vector3) {\n _vector.copy(p).applyMatrix4(_viewProjectionMatrix);\n const visible = _vector.z >= -1 && _vector.z <= 1;\n\n point.x = (_vector.x + 1) * _widthHalf;\n point.y = (-_vector.y + 1) * _heightHalf;\n\n return { point, visible };\n }\n\n projectLine(p1: Vector3, p2: Vector3) {\n let visible: boolean;\n\n _vector1.copy(p1 as any).applyMatrix4(_viewProjectionMatrix);\n _vector2.copy(p2 as any).applyMatrix4(_viewProjectionMatrix);\n\n // see three/examples/jsm/renderers/Projector.js/clipLine for more details\n\n const bc1near = _vector1.z + _vector1.w;\n const bc2near = _vector2.z + _vector2.w;\n const bc1far = -_vector1.z + _vector1.w;\n const bc2far = -_vector2.z + _vector2.w;\n\n if (bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0) visible = true;\n else if ((bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0)) visible = false;\n else {\n let alpha1 = 0;\n let alpha2 = 1;\n\n if (bc1near < 0) alpha1 = Math.max(alpha1, bc1near / (bc1near - bc2near));\n else if (bc2near < 0) alpha2 = Math.min(alpha2, bc1near / (bc1near - bc2near));\n\n if (bc1far < 0) alpha1 = Math.max(alpha1, bc1far / (bc1far - bc2far));\n else if (bc2far < 0) alpha2 = Math.min(alpha2, bc1far / (bc1far - bc2far));\n\n visible = alpha2 >= alpha1;\n\n if (visible) {\n _vector1.lerp(_vector2, alpha1);\n _vector2.lerp(_vector1, 1 - alpha2);\n }\n }\n\n _vector1.multiplyScalar(1 / _vector1.w);\n _vector2.multiplyScalar(1 / _vector2.w);\n\n point1.x = (_vector1.x + 1) * _widthHalf;\n point1.y = (-_vector1.y + 1) * _heightHalf;\n\n point2.x = (_vector2.x + 1) * _widthHalf;\n point2.y = (-_vector2.y + 1) * _heightHalf;\n\n return { point1, point2, visible };\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { MOUSE } from \"three\";\n\nimport { OrbitDragger } from \"./OrbitDragger\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class PanDragger extends OrbitDragger {\n constructor(viewer: Viewer) {\n super(viewer);\n this.orbit.mouseButtons = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN };\n // this.controls.touches = { ONE: TOUCH.PAN, TWO: TOUCH.DOLLY_ROTATE };\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Clock, Camera, Controls, Quaternion, Vector2, Vector3 } from \"three\";\n\ninterface WalkControlsEventMap {\n change: { type: \"change\" };\n walkspeedchange: { type: \"walkspeedchange\"; data: number };\n}\n\nexport class WalkControls extends Controls<WalkControlsEventMap> {\n public movementSpeed = 0.2;\n public lookSpeed = 5;\n public multiplier = 5;\n\n private moveKeys: Set<string>;\n private moveWheel = 0;\n private moveClock: Clock;\n\n private quaternion: Quaternion;\n private downPosition: Vector2;\n private mouseDragOn = false;\n public rotateDelta: Vector2;\n\n constructor(camera: Camera, canvas: HTMLElement) {\n super(camera, canvas);\n\n this.moveKeys = new Set();\n this.moveClock = new Clock();\n\n this.quaternion = camera.quaternion.clone();\n this.downPosition = new Vector2(0, 0);\n this.rotateDelta = new Vector2(0, 0);\n\n this.domElement.addEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.addEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.addEventListener(\"pointerup\", this.onPointerUp);\n this.domElement.addEventListener(\"pointercancel\", this.onPointerCancel);\n this.domElement.addEventListener(\"wheel\", this.onWheel);\n\n window.addEventListener(\"keydown\", this.onKeyDown);\n window.addEventListener(\"keyup\", this.onKeyUp);\n }\n\n override dispose() {\n this.domElement.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.removeEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.removeEventListener(\"pointerup\", this.onPointerUp);\n this.domElement.removeEventListener(\"pointercancel\", this.onPointerCancel);\n this.domElement.removeEventListener(\"wheel\", this.onWheel);\n\n window.removeEventListener(\"keydown\", this.onKeyDown);\n window.removeEventListener(\"keyup\", this.onKeyUp);\n\n super.dispose();\n }\n\n onPointerDown = (event: PointerEvent) => {\n if (event.button !== 0) return;\n\n this.domElement.setPointerCapture(event.pointerId);\n this.downPosition.set(event.clientX, event.clientY);\n this.quaternion.copy(this.object.quaternion);\n this.mouseDragOn = true;\n };\n\n onPointerMove = (event: PointerEvent) => {\n if (!this.mouseDragOn) return;\n\n const movePosition = new Vector2(event.clientX, event.clientY);\n if (this.downPosition.distanceTo(movePosition) === 0) return;\n\n this.rotateDelta.copy(this.downPosition).sub(movePosition);\n this.rotateCamera(this.rotateDelta);\n this.dispatchEvent({ type: \"change\" });\n };\n\n onPointerUp = (event: PointerEvent) => {\n this.domElement.releasePointerCapture(event.pointerId);\n this.mouseDragOn = false;\n };\n\n onPointerCancel = (event: PointerEvent) => {\n this.domElement.dispatchEvent(new PointerEvent(\"pointerup\", event));\n };\n\n onWheel = (event: WheelEvent) => {\n this.moveWheel = event.deltaY;\n this.update();\n };\n\n onKeyDown = (event: KeyboardEvent) => {\n switch (event.code) {\n case \"NumpadSubtract\":\n case \"Minus\":\n if (this.multiplier > 1) {\n this.multiplier = this.multiplier - 1;\n this.dispatchEvent({ type: \"walkspeedchange\", data: this.multiplier });\n }\n break;\n\n case \"NumpadAdd\":\n case \"Equal\":\n if (this.multiplier < 10) {\n this.multiplier = this.multiplier + 1;\n this.dispatchEvent({ type: \"walkspeedchange\", data: this.multiplier });\n }\n break;\n\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"KeyW\":\n case \"KeyS\":\n case \"KeyA\":\n case \"KeyD\":\n case \"KeyQ\":\n case \"KeyE\":\n this.moveKeys.add(event.code);\n this.update();\n break;\n }\n };\n\n onKeyUp = (event: KeyboardEvent) => {\n if (this.moveKeys.delete(event.code)) this.update();\n };\n\n override update() {\n if (this.moveKeys.size > 0) {\n const timeDelta = this.moveClock.getDelta();\n const moveDelta = timeDelta * this.movementSpeed * this.multiplier;\n\n if (this.moveKeys.has(\"KeyW\")) this.object.translateZ(-moveDelta);\n if (this.moveKeys.has(\"KeyS\")) this.object.translateZ(moveDelta);\n\n if (this.moveKeys.has(\"KeyA\")) this.object.translateX(-moveDelta);\n if (this.moveKeys.has(\"KeyD\")) this.object.translateX(moveDelta);\n\n if (this.moveKeys.has(\"KeyQ\")) this.object.translateY(moveDelta);\n if (this.moveKeys.has(\"KeyE\")) this.object.translateY(-moveDelta);\n\n const lookDelta = this.lookSpeed + (this.multiplier - 1);\n\n if (this.moveKeys.has(\"ArrowUp\")) this.rotateCamera(this.rotateDelta.add(new Vector2(0, -lookDelta / 2)));\n if (this.moveKeys.has(\"ArrowDown\")) this.rotateCamera(this.rotateDelta.add(new Vector2(0, lookDelta / 2)));\n\n if (this.moveKeys.has(\"ArrowLeft\")) this.rotateCamera(this.rotateDelta.add(new Vector2(lookDelta, 0)));\n if (this.moveKeys.has(\"ArrowRight\")) this.rotateCamera(this.rotateDelta.add(new Vector2(-lookDelta, 0)));\n\n this.moveWheel = 0;\n this.dispatchEvent({ type: \"change\" });\n }\n\n if (this.moveWheel !== 0) {\n const moveDelta = this.moveWheel * 0.0001 * this.movementSpeed * this.multiplier;\n\n this.object.translateZ(-moveDelta);\n this.moveWheel += -1 * Math.sign(this.moveWheel);\n this.dispatchEvent({ type: \"change\" });\n }\n\n if (this.moveKeys.size === 0 && this.moveWheel === 0) {\n this.moveClock.stop();\n this.moveClock.autoStart = true;\n }\n }\n\n rotateCamera(delta: Vector2) {\n const rotateX = (Math.PI * delta.x) / this.domElement.clientWidth;\n const rotateY = (Math.PI * delta.y) / this.domElement.clientHeight;\n\n const xRotation = new Quaternion();\n xRotation.setFromAxisAngle(this.object.up, rotateX);\n\n const yRotation = new Quaternion();\n yRotation.setFromAxisAngle(new Vector3(1, 0, 0), rotateY);\n\n const quaternion = this.quaternion.clone();\n quaternion.premultiply(xRotation).multiply(yRotation).normalize();\n\n this.object.setRotationFromQuaternion(quaternion);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Vector3 } from \"three\";\nimport { type IDragger } from \"@inweb/viewer-core\";\n\nimport type { Viewer } from \"../Viewer\";\nimport { WalkControls } from \"../controls/WalkControls\";\n\nexport class WalkDragger implements IDragger {\n protected viewer: Viewer;\n public controls: WalkControls;\n\n constructor(viewer: Viewer) {\n this.controls = new WalkControls(viewer.camera, viewer.canvas);\n this.controls.addEventListener(\"change\", this.controlsChange);\n this.controls.addEventListener(\"walkspeedchange\", this.walkspeedChange);\n this.viewer = viewer;\n this.viewer.on(\"render\", this.viewerRender);\n this.viewer.on(\"zoom\", this.viewerZoom);\n this.updateControls();\n }\n\n dispose() {\n this.viewer.off(\"render\", this.viewerRender);\n this.viewer.off(\"zoom\", this.viewerZoom);\n this.controls.removeEventListener(\"walkspeedchange\", this.walkspeedChange);\n this.controls.removeEventListener(\"change\", this.controlsChange);\n this.controls.dispose();\n }\n\n updateControls = () => {\n const size = this.viewer.extents.getSize(new Vector3());\n this.controls.movementSpeed = Math.min(size.x, size.y, size.z) / 2;\n };\n\n controlsChange = () => {\n this.viewer.update();\n };\n\n walkspeedChange = (event: any) => {\n this.viewer.emitEvent(event);\n };\n\n viewerRender = () => {\n this.controls.update();\n };\n\n viewerZoom = () => {\n this.controls.rotateDelta.set(0, 0);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { MOUSE } from \"three\";\n\nimport { OrbitDragger } from \"./OrbitDragger\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class ZoomDragger extends OrbitDragger {\n constructor(viewer: Viewer) {\n super(viewer);\n this.orbit.mouseButtons = { LEFT: MOUSE.DOLLY, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN };\n // this.controls.touches = { ONE: TOUCH.DOLLY_PAN, TWO: TOUCH.DOLLY_PAN };\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IDraggersRegistry, draggersRegistry } from \"@inweb/viewer-core\";\n\nimport { CuttingPlaneXAxisDragger } from \"./CuttingPlaneXAxis\";\nimport { CuttingPlaneYAxisDragger } from \"./CuttingPlaneYAxis\";\nimport { CuttingPlaneZAxisDragger } from \"./CuttingPlaneZAxis\";\nimport { MeasureLineDragger } from \"./MeasureLineDragger\";\nimport { OrbitDragger } from \"./OrbitDragger\";\nimport { PanDragger } from \"./PanDragger\";\nimport { WalkDragger } from \"./WalkDragger\";\nimport { ZoomDragger } from \"./ZoomDragger\";\n\n/**\n * Viewer draggers registry. Use this registry to register custom draggers.\n *\n * To implement custom dragger:\n *\n * 1. Define a dragger class implements {@link IDragger}.\n * 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.\n * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove` event and\n * zoom in/out when the left mouse button is pressed.\n * 4. Override {@link IDragger.dispose} and remove mouse event listeners from the viewer.\n * 5. Register dragger provider in the draggers registry by calling the {@link draggers.registerDragger}.\n *\n * @example Implementing a custom dragger.\n *\n * ```javascript\n * import { IDragger, draggers, Viewer } from \"@inweb/viewer-three\";\n *\n * class MyDragger implements IDragger {\n * protected viewer: Viewer;\n *\n * constructor(viewer: Viewer) {\n * this.viewer = viewer;\n * this.viewer.addEventListener(\"pointermove\", this.onPointerMove);\n * }\n *\n * override dispose() {\n * this.viewer.removeEventListener(\"pointermove\", this.onPointerMove);\n * }\n *\n * onPointerMove = (event: PointerEvent) => {\n * // place custom logic here\n * };\n * }\n *\n * draggers.registerDragger(\"MyDragger\", (viewer): IDragger => new MyDragger(viewer));\n * ```\n *\n * @example Activating a custom dragger.\n *\n * ```javascript\n * viewer.setActiveDragger(\"MyDragger\");\n * ```\n */\nexport const draggers: IDraggersRegistry = draggersRegistry(\"threejs\");\n\n// build-in draggers\n\ndraggers.registerDragger(\"Pan\", (viewer) => new PanDragger(viewer));\ndraggers.registerDragger(\"Orbit\", (viewer) => new OrbitDragger(viewer));\ndraggers.registerDragger(\"Zoom\", (viewer) => new ZoomDragger(viewer));\ndraggers.registerDragger(\"MeasureLine\", (viewer) => new MeasureLineDragger(viewer));\ndraggers.registerDragger(\"CuttingPlaneXAxis\", (viewer) => new CuttingPlaneXAxisDragger(viewer));\ndraggers.registerDragger(\"CuttingPlaneYAxis\", (viewer) => new CuttingPlaneYAxisDragger(viewer));\ndraggers.registerDragger(\"CuttingPlaneZAxis\", (viewer) => new CuttingPlaneZAxisDragger(viewer));\ndraggers.registerDragger(\"Walk\", (viewer) => new WalkDragger(viewer));\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Model, File, Assembly } from \"@inweb/client\";\nimport type { Viewer } from \"../Viewer\";\n\nexport function applyModelTransform(viewer: Viewer, model: Model | File | Assembly) {\n console.warn(\"applyModelTransform not implemented\");\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function clearMarkup(viewer: Viewer) {\n viewer.clearOverlay();\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Intersection, MeshBasicMaterial, Object3D, Raycaster, Vector2 } from \"three\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class SelectionComponent implements IComponent {\n protected viewer: Viewer;\n protected raycaster: Raycaster;\n protected downPosition: Vector2;\n protected facesMaterial: MeshBasicMaterial;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.raycaster = new Raycaster();\n this.downPosition = new Vector2();\n\n const { facesColor, facesTransparancy } = this.viewer.options;\n this.facesMaterial = new MeshBasicMaterial();\n this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);\n this.facesMaterial.opacity = (255 - facesTransparancy) / 255;\n this.facesMaterial.transparent = true;\n\n this.viewer.addEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.addEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.addEventListener(\"dblclick\", this.onDoubleClick);\n this.viewer.addEventListener(\"optionschange\", this.optionsChange);\n }\n\n dispose() {\n this.facesMaterial.dispose();\n\n this.viewer.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.viewer.removeEventListener(\"pointerup\", this.onPointerUp);\n this.viewer.removeEventListener(\"dblclick\", this.onDoubleClick);\n this.viewer.removeEventListener(\"optionschange\", this.optionsChange);\n }\n\n onPointerDown = (event: PointerEvent) => {\n if (!event.isPrimary || event.button !== 0) return;\n\n this.getMousePosition(event, this.downPosition);\n };\n\n onPointerUp = (event: PointerEvent) => {\n if (!event.isPrimary) return;\n\n const upPosition = this.getMousePosition(event, new Vector2());\n if (this.downPosition.distanceTo(upPosition) !== 0) return;\n\n const intersects = this.getPointerIntersects(upPosition);\n\n this.clearSelection();\n if (intersects.length > 0) this.select(intersects[0].object);\n\n this.viewer.update();\n this.viewer.emitEvent({ type: \"select\", data: undefined, handles: this.viewer.getSelected() });\n };\n\n onDoubleClick = (event: MouseEvent) => {\n if (event.button !== 0) return;\n\n this.viewer.executeCommand(\"zoomToSelected\");\n };\n\n getMousePosition(event: MouseEvent, target: Vector2): Vector2 {\n return target.set(event.clientX, event.clientY);\n }\n\n getPointerIntersects(mouse: Vector2): Array<Intersection<Object3D>> {\n const rect = this.viewer.canvas.getBoundingClientRect();\n const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;\n const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;\n\n const coords = new Vector2(x, y);\n this.raycaster.setFromCamera(coords, this.viewer.camera);\n\n const objects = [];\n this.viewer.scene.traverseVisible((child) => objects.push(child));\n\n this.raycaster.params = this.raycaster.params = {\n Mesh: {},\n Line: { threshold: 0.25 },\n Line2: { threshold: 0.25 },\n LOD: {},\n Points: { threshold: 0.1 },\n Sprite: {},\n };\n\n return this.raycaster.intersectObjects(objects, false);\n }\n\n select(object: any) {\n if (object.isSelected) return;\n\n object.isSelected = true;\n object.originalMaterial = object.material;\n object.material = this.facesMaterial;\n\n this.viewer.selected.push(object);\n }\n\n clearSelection() {\n this.viewer.selected.forEach((object: any) => {\n object.isSelected = false;\n object.material = object.originalMaterial;\n });\n this.viewer.selected.length = 0;\n }\n\n optionsChange = () => {\n const { facesColor, facesTransparancy } = this.viewer.options;\n this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);\n this.facesMaterial.opacity = (255 - facesTransparancy) / 255;\n\n this.viewer.update();\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { SelectionComponent } from \"../components/SelectionComponent\";\n\nexport function clearSelected(viewer: Viewer): void {\n const selection = new SelectionComponent(viewer);\n selection.clearSelection();\n selection.dispose();\n\n viewer.update();\n viewer.emitEvent({ type: \"select\", data: undefined, handles: [] });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function clearSlices(viewer: Viewer) {\n viewer.clearSlices();\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function createPreview(viewer: Viewer, type = \"image/jpeg\", encoderOptions = 0.25): string {\n viewer.update(true);\n return viewer.canvas.toDataURL(type, encoderOptions);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3, Vector3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\n\nfunction calcExplodeDepth(object, depth: number): number {\n let res = depth;\n object.children.forEach((x) => {\n const objectDepth = calcExplodeDepth(x, depth + 1);\n if (res < objectDepth) res = objectDepth;\n });\n\n object.originalPosition = object.position.clone();\n object.originalCenter = new Box3().setFromObject(object).getCenter(new Vector3());\n object.isExplodeLocked = depth > 2 && object.children.length === 0;\n\n return res;\n}\n\nfunction explodeScene(scene, scale = 0, coeff = 4) {\n scale /= 100;\n\n if (!scene.explodeDepth) scene.explodeDepth = calcExplodeDepth(scene, 1);\n const maxDepth = scene.explodeDepth;\n\n const scaledExplodeDepth = scale * maxDepth + 1;\n const explodeDepth = 0 | scaledExplodeDepth;\n const currentSegmentFraction = scaledExplodeDepth - explodeDepth;\n\n function explodeObject(object, depth: number) {\n object.position.copy(object.originalPosition);\n\n if (depth > 0 && depth <= explodeDepth && !object.isExplodeLocked) {\n let objectScale = scale * coeff;\n if (depth === explodeDepth) objectScale *= currentSegmentFraction;\n\n const parentCenter = object.parent.originalCenter;\n const objectCenter = object.originalCenter;\n const objectOffset = objectCenter.clone().sub(parentCenter).multiplyScalar(objectScale);\n\n object.position.add(objectOffset);\n }\n\n object.children.forEach((x) => explodeObject(x, depth + 1));\n }\n\n explodeObject(scene, 0);\n}\n\nexport function explode(viewer: Viewer, index = 0): void {\n viewer.models.forEach((model) => explodeScene(model.scene, index));\n viewer.scene.updateMatrixWorld();\n\n viewer.update();\n viewer.emitEvent({ type: \"explode\", data: index });\n}\n\nexport function collect(viewer: Viewer) {\n explode(viewer, 0);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3, MathUtils, Sphere, Vector2, Vector3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\n\nexport function zoomTo(viewer: Viewer, box: Box3): void {\n if (box.isEmpty()) return;\n\n const center = box.getCenter(new Vector3());\n const sphere = box.getBoundingSphere(new Sphere());\n\n const rendererSize = viewer.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n const camera = viewer.camera as any;\n\n if (camera.isPerspectiveCamera) {\n const offset = new Vector3(0, 0, 1);\n offset.applyQuaternion(camera.quaternion);\n offset.multiplyScalar(sphere.radius / Math.tan(MathUtils.DEG2RAD * camera.fov * 0.5));\n\n camera.position.copy(center).add(offset);\n camera.updateMatrixWorld();\n }\n if (camera.isOrthographicCamera) {\n camera.top = sphere.radius;\n camera.bottom = -sphere.radius;\n camera.left = camera.bottom * aspect;\n camera.right = camera.top * aspect;\n camera.zoom = 1;\n camera.updateProjectionMatrix();\n\n const offset = new Vector3(0, 0, 1);\n offset.applyQuaternion(camera.quaternion);\n offset.multiplyScalar(viewer.extents.getBoundingSphere(new Sphere()).radius * 3);\n\n camera.position.copy(center).add(offset);\n camera.updateMatrixWorld();\n }\n\n viewer.target.copy(center);\n\n viewer.update();\n viewer.emitEvent({ type: \"zoom\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Sphere, Vector3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport const defaultViewPositions = {\n top: new Vector3(0, 0, 1),\n bottom: new Vector3(0, 0, -1),\n left: new Vector3(-1, 0, 0),\n right: new Vector3(1, 0, 0),\n front: new Vector3(0, -1, 0),\n back: new Vector3(0, 1, 0),\n sw: new Vector3(-0.5, -0.5, 1.0).normalize(),\n se: new Vector3(0.5, -0.5, 1.0).normalize(),\n ne: new Vector3(0.5, 0.5, 1.0).normalize(),\n nw: new Vector3(-0.5, 0.5, 1.0).normalize(),\n};\n\nexport function setDefaultViewPosition(viewer: Viewer, position: string): void {\n const direction = defaultViewPositions[position] || defaultViewPositions[\"sw\"];\n\n const center = viewer.extents.getCenter(new Vector3());\n const sphere = viewer.extents.getBoundingSphere(new Sphere());\n const offset = direction.clone().multiplyScalar(sphere.radius);\n\n const camera = viewer.camera;\n camera.position.copy(center).add(offset);\n camera.lookAt(center);\n camera.updateMatrixWorld();\n\n viewer.target.copy(center);\n\n viewer.update();\n viewer.emit({ type: \"viewposition\", data: position });\n\n zoomTo(viewer, viewer.extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { defaultViewPositions } from \"./SetDefaultViewPosition\";\n\nexport function getDefaultViewPositions(): string[] {\n return Object.keys(defaultViewPositions);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function getModels(viewer: Viewer): string[] {\n return viewer.models.map((model) => model.userData?.handle || \"\").filter((handle) => handle);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function getSelected(viewer: Viewer): string[] {\n return viewer.selected.map((object) => object.userData?.handle).filter((handle) => handle);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { SelectionComponent } from \"../components/SelectionComponent\";\n\nexport function hideSelected(viewer: Viewer): void {\n viewer.selected.forEach((object) => (object.visible = false));\n\n const selection = new SelectionComponent(viewer);\n selection.clearSelection();\n selection.dispose();\n\n viewer.update();\n viewer.emitEvent({ type: \"hide\" });\n viewer.emitEvent({ type: \"select\", data: undefined, handles: [] });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function isolateSelected(viewer: Viewer): void {\n const visibleSet = new Set();\n viewer.selected.forEach((object) => {\n visibleSet.add(object);\n object.traverseAncestors((object2) => visibleSet.add(object2));\n });\n\n viewer.scene.traverse((object) => (object.visible = visibleSet.has(object)));\n\n viewer.update();\n viewer.emitEvent({ type: \"isolate\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function regenerateAll(viewer: Viewer): void {\n viewer.emit({ type: \"regenerateall\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function resetView(viewer: Viewer): void {\n viewer.executeCommand(\"setActiveDragger\");\n viewer.executeCommand(\"clearSlices\");\n viewer.executeCommand(\"clearOverlay\");\n viewer.executeCommand(\"setMarkupColor\");\n viewer.executeCommand(\"clearSelected\");\n viewer.executeCommand(\"showAll\");\n viewer.executeCommand(\"explode\", 0);\n viewer.executeCommand(\"zoomToExtents\", true);\n viewer.executeCommand(\"k3DViewSW\");\n\n viewer.emit({ type: \"resetview\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function selectModel(viewer: Viewer, handle: string): void {\n console.warn(\"selectModel not implemented\");\n viewer.emit({ type: \"select\", data: [] });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function setActiveDragger(viewer: Viewer, dragger = \"\") {\n viewer.setActiveDragger(dragger);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function setMarkupColor(viewer: Viewer, r = 255, g = 0, b = 0) {\n viewer.markup.setMarkupColor(r, g, b);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { SelectionComponent } from \"../components/SelectionComponent\";\n\nexport function setSelected(viewer: Viewer, handles: string[] = []): void {\n const handleSet = new Set(handles);\n const objects = [];\n viewer.scene.traverseVisible((child) => {\n if (handleSet.has(child.userData?.handle)) objects.push(child);\n });\n\n const selection = new SelectionComponent(viewer);\n selection.clearSelection();\n objects.forEach((object) => selection.select(object));\n selection.dispose();\n\n viewer.update();\n viewer.emitEvent({ type: \"select\", data: undefined, handles });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\n\nexport function showAll(viewer: Viewer): void {\n viewer.scene.traverse((object) => (object.visible = true));\n\n viewer.update();\n viewer.emitEvent({ type: \"showall\" });\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport function zoomToExtents(viewer: Viewer): void {\n zoomTo(viewer, viewer.extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport function zoomToObjects(viewer: Viewer, handles: string[] = []): void {\n const handleSet = new Set(handles);\n const objects = [];\n viewer.scene.traverseVisible((child) => {\n if (handleSet.has(child.userData?.handle)) objects.push(child);\n });\n\n const extents = objects.reduce((result: Box3, object) => result.expandByObject(object), new Box3());\n if (extents.isEmpty()) extents.copy(viewer.extents);\n\n zoomTo(viewer, extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3 } from \"three\";\nimport type { Viewer } from \"../Viewer\";\nimport { zoomTo } from \"./ZoomTo\";\n\nexport function zoomToSelected(viewer: Viewer): void {\n const extents = viewer.selected.reduce((result: Box3, object) => result.expandByObject(object), new Box3());\n if (extents.isEmpty()) extents.copy(viewer.extents);\n\n zoomTo(viewer, extents);\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { ICommandsRegistry, commandsRegistry } from \"@inweb/viewer-core\";\n\nimport { applyModelTransform } from \"./ApplyModelTransform\";\nimport { clearMarkup } from \"./ClearMarkup\";\nimport { clearSelected } from \"./ClearSelected\";\nimport { clearSlices } from \"./ClearSlices\";\nimport { createPreview } from \"./CreatePreview\";\nimport { explode, collect } from \"./Explode\";\nimport { getDefaultViewPositions } from \"./GetDefaultViewPositions\";\nimport { getModels } from \"./GetModels\";\nimport { getSelected } from \"./GetSelected\";\nimport { hideSelected } from \"./HideSelected\";\nimport { isolateSelected } from \"./IsolateSelected\";\nimport { regenerateAll } from \"./RegenerateAll\";\nimport { resetView } from \"./ResetView\";\nimport { selectModel } from \"./SelectModel\";\nimport { setActiveDragger } from \"./SetActiveDragger\";\nimport { setDefaultViewPosition } from \"./SetDefaultViewPosition\";\nimport { setMarkupColor } from \"./SetMarkupColor\";\nimport { setSelected } from \"./SetSelected\";\nimport { showAll } from \"./ShowAll\";\nimport { zoomToExtents } from \"./ZoomToExtents\";\nimport { zoomToObjects } from \"./ZoomToObjects\";\nimport { zoomToSelected } from \"./ZoomToSelected\";\n\n/**\n * A commands registry. Use this registry to register custom commands.\n *\n * To implement custom command:\n *\n * 1. Define a command handler with a first `viewer` parameter.\n * 2. Register command handler in the commands registry by calling the {@link commands.registerCommand}.\n *\n * @example Implementing a custom command.\n *\n * ```javascript\n * import { commands, Viewer } from \"@inweb/viewer-three\";\n *\n * function commandHandler(viewer: Viewer, name = \"world\"): void {\n * console.log(`Hello ${name}!!!`);\n * }\n *\n * commands.registerCommand(\"sayHello\", commandHandler);\n * ```\n *\n * @example Calling a custom command.\n *\n * ```javascript\n * viewer.executeCommand(\"sayHello\", \"user\");\n * ```\n */\nexport const commands: ICommandsRegistry = commandsRegistry(\"threejs\");\n\n// build-in commands\n\ncommands.registerCommand(\"applyModelTransform\", applyModelTransform);\ncommands.registerCommand(\"clearMarkup\", clearMarkup);\ncommands.registerCommand(\"clearSelected\", clearSelected);\ncommands.registerCommand(\"clearSlices\", clearSlices);\ncommands.registerCommand(\"createPreview\", createPreview);\ncommands.registerCommand(\"explode\", explode);\ncommands.registerCommand(\"collect\", collect);\ncommands.registerCommand(\"getDefaultViewPositions\", getDefaultViewPositions);\ncommands.registerCommand(\"getModels\", getModels);\ncommands.registerCommand(\"getSelected\", getSelected);\ncommands.registerCommand(\"hideSelected\", hideSelected);\ncommands.registerCommand(\"isolateSelected\", isolateSelected);\ncommands.registerCommand(\"regenerateAll\", regenerateAll);\ncommands.registerCommand(\"resetView\", resetView);\ncommands.registerCommand(\"selectModel\", selectModel);\ncommands.registerCommand(\"setActiveDragger\", setActiveDragger);\ncommands.registerCommand(\"setDefaultViewPosition\", setDefaultViewPosition);\ncommands.registerCommand(\"setMarkupColor\", setMarkupColor);\ncommands.registerCommand(\"setSelected\", setSelected);\ncommands.registerCommand(\"showAll\", showAll);\ncommands.registerCommand(\"zoomToExtents\", zoomToExtents);\ncommands.registerCommand(\"zoomToObjects\", zoomToObjects);\ncommands.registerCommand(\"zoomToSelected\", zoomToSelected);\n\ncommands.registerCommand(\"top\", (viewer) => setDefaultViewPosition(viewer, \"top\"));\ncommands.registerCommand(\"bottom\", (viewer) => setDefaultViewPosition(viewer, \"bottom\"));\ncommands.registerCommand(\"left\", (viewer) => setDefaultViewPosition(viewer, \"left\"));\ncommands.registerCommand(\"right\", (viewer) => setDefaultViewPosition(viewer, \"right\"));\ncommands.registerCommand(\"front\", (viewer) => setDefaultViewPosition(viewer, \"front\"));\ncommands.registerCommand(\"back\", (viewer) => setDefaultViewPosition(viewer, \"back\"));\ncommands.registerCommand(\"sw\", (viewer) => setDefaultViewPosition(viewer, \"sw\"));\ncommands.registerCommand(\"se\", (viewer) => setDefaultViewPosition(viewer, \"se\"));\ncommands.registerCommand(\"ne\", (viewer) => setDefaultViewPosition(viewer, \"ne\"));\ncommands.registerCommand(\"nw\", (viewer) => setDefaultViewPosition(viewer, \"nw\"));\n\ncommands.registerCommandAlias(\"clearMarkup\", \"clearOverlay\");\ncommands.registerCommandAlias(\"clearSelected\", \"unselect\");\ncommands.registerCommandAlias(\"zoomToExtents\", \"zoomExtents\");\n\ncommands.registerCommandAlias(\"top\", \"k3DViewTop\");\ncommands.registerCommandAlias(\"bottom\", \"k3DViewBottom\");\ncommands.registerCommandAlias(\"left\", \"k3DViewLeft\");\ncommands.registerCommandAlias(\"right\", \"k3DViewRight\");\ncommands.registerCommandAlias(\"front\", \"k3DViewFront\");\ncommands.registerCommandAlias(\"back\", \"k3DViewBack\");\ncommands.registerCommandAlias(\"se\", \"k3DViewSE\");\ncommands.registerCommandAlias(\"sw\", \"k3DViewSW\");\ncommands.registerCommandAlias(\"ne\", \"k3DViewNE\");\ncommands.registerCommandAlias(\"nw\", \"k3DViewNW\");\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Color, PMREMGenerator } from \"three\";\nimport { RoomEnvironment } from \"three/examples/jsm/environments/RoomEnvironment.js\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class BackgroundComponent implements IComponent {\n protected viewer: Viewer;\n protected backgroundColor: Color;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n\n this.backgroundColor = new Color(0xffffff);\n\n const environment = new RoomEnvironment();\n const pmremGenerator = new PMREMGenerator(this.viewer.renderer);\n\n this.viewer.renderer.setClearColor(this.backgroundColor);\n this.viewer.scene.background = this.backgroundColor;\n this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;\n this.viewer.addEventListener(\"optionschange\", this.syncOptions);\n\n environment.dispose();\n }\n\n dispose() {\n this.viewer.removeEventListener(\"optionschange\", this.syncOptions);\n this.viewer.scene.environment = undefined;\n this.viewer.scene.background = undefined;\n }\n\n syncOptions = () => {\n this.backgroundColor.setHex(0xffffff);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Sphere, Vector2 } from \"three\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class CameraComponent implements IComponent {\n protected viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.geometryEnd);\n }\n\n dispose() {\n this.viewer.removeEventListener(\"databasechunk\", this.geometryEnd);\n }\n\n geometryEnd = () => {\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const rendererSize = this.viewer.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n let sceneCamera: any;\n this.viewer.scene.traverse((object: any) => {\n if (object.isCamera)\n if (!sceneCamera) sceneCamera = object;\n else if (object.isPerspectiveCamera && sceneCamera.isOrthographicCamera) sceneCamera = object;\n });\n if (sceneCamera) {\n this.viewer.camera = sceneCamera.clone();\n this.viewer.camera.up.set(0, 0, 1);\n this.viewer.camera.scale.set(1, 1, 1); // <- visualize fix\n }\n\n const camera = this.viewer.camera as any;\n\n if (camera.isPerspectiveCamera) {\n camera.aspect = aspect;\n camera.near = extentsSize / 100;\n camera.far = extentsSize * 100;\n camera.updateProjectionMatrix();\n }\n if (camera.isOrthographicCamera) {\n camera.left = camera.bottom * aspect;\n camera.right = camera.top * aspect;\n camera.near = 0;\n camera.far = extentsSize * 100;\n camera.updateProjectionMatrix();\n }\n\n if (!sceneCamera) {\n this.viewer.executeCommand(\"setDefaultViewPosition\");\n }\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3, Vector3 } from \"three\";\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class ExtentsComponent implements IComponent {\n private viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.syncExtents);\n this.viewer.addEventListener(\"clear\", this.syncExtents);\n this.viewer.on(\"explode\", this.syncExtents);\n this.viewer.on(\"isolate\", this.syncExtents);\n this.viewer.on(\"hide\", this.syncExtents);\n this.viewer.on(\"showall\", this.syncExtents);\n }\n\n dispose() {\n this.viewer.removeEventListener(\"databasechunk\", this.syncExtents);\n this.viewer.removeEventListener(\"clear\", this.syncExtents);\n this.viewer.off(\"explode\", this.syncExtents);\n this.viewer.off(\"isolate\", this.syncExtents);\n this.viewer.off(\"hide\", this.syncExtents);\n this.viewer.off(\"showall\", this.syncExtents);\n }\n\n syncExtents = () => {\n const extents = new Box3();\n this.viewer.scene.traverseVisible((object) => !object.children.length && extents.expandByObject(object));\n\n this.viewer.extents.copy(extents);\n this.viewer.target.copy(extents.getCenter(new Vector3()));\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class RenderLoopComponent implements IComponent {\n protected viewer: Viewer;\n protected requestId: number;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.animate();\n }\n\n dispose() {\n cancelAnimationFrame(this.requestId);\n }\n\n animate = (time = 0) => {\n this.requestId = requestAnimationFrame(this.animate);\n this.viewer.render(time);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\n\nexport class ResizeCanvasComponent implements IComponent {\n protected viewer: Viewer;\n protected resizeObserver: ResizeObserver;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.resizeObserver = new ResizeObserver(this.resizeViewer);\n this.resizeObserver.observe(viewer.canvas.parentElement);\n }\n\n dispose() {\n this.resizeObserver.disconnect();\n }\n\n resizeViewer = (entries: ResizeObserverEntry[]) => {\n const { width, height } = entries[0].contentRect;\n\n if (!width || !height) return; // <- invisible viewer, or viewer with parent removed\n\n const camera = this.viewer.camera as any;\n const aspect = width / height;\n\n if (camera.isPerspectiveCamera) {\n camera.aspect = aspect;\n camera.updateProjectionMatrix();\n }\n if (camera.isOrthographicCamera) {\n camera.left = camera.bottom * aspect;\n camera.right = camera.top * aspect;\n camera.updateProjectionMatrix();\n }\n\n this.viewer.renderer.setSize(width, height, true);\n\n this.viewer.update(true);\n this.viewer.emitEvent({ type: \"resize\", width, height });\n };\n}\n","import {\n Camera,\n CylinderGeometry,\n CanvasTexture,\n Color,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n OrthographicCamera,\n Sprite,\n SpriteMaterial,\n SRGBColorSpace,\n Vector4,\n WebGLRenderer,\n} from \"three\";\n\nexport class WCSHelper extends Object3D {\n private camera: Camera;\n private orthoCamera: OrthographicCamera;\n public size: number;\n\n constructor(camera: Camera) {\n super();\n\n this.camera = camera;\n this.size = 160;\n\n this.orthoCamera = new OrthographicCamera(-2, 2, 2, -2, 0, 4);\n this.orthoCamera.position.set(0, 0, 2);\n\n const matRed = new MeshBasicMaterial({ toneMapped: false, color: \"#aa0000\" });\n const matGreen = new MeshBasicMaterial({ toneMapped: false, color: \"#00aa00\" });\n const matBlue = new MeshBasicMaterial({ toneMapped: false, color: \"#0000aa\" });\n\n const spriteRed = this.getSpriteMaterial(matRed.color, \"X\");\n const spriteGreen = this.getSpriteMaterial(matGreen.color, \"Y\");\n const spriteBlue = this.getSpriteMaterial(matBlue.color, \"Z\");\n\n const lineGeometry = new CylinderGeometry(0.01, 0.01, 1, 3);\n lineGeometry.translate(0, 0.5, 0);\n\n const arrowGeometry = new CylinderGeometry(0, 0.1, 0.25, 12);\n arrowGeometry.translate(0, 0.625, 0);\n\n const axesMap = {\n X: [\n [new Mesh(arrowGeometry, matRed), [0.5, 0, 0], [0, 0, -Math.PI / 2]],\n [new Mesh(lineGeometry, matRed), [0, 0, 0], [0, 0, -Math.PI / 2]],\n [new Sprite(spriteRed), [1.55, 0, 0]],\n ],\n Y: [\n [new Mesh(arrowGeometry, matGreen), [0, 0.5, 0], null],\n [new Mesh(lineGeometry, matGreen), null, null],\n [new Sprite(spriteGreen), [0, 1.55, 0]],\n ],\n Z: [\n [new Mesh(arrowGeometry, matBlue), [0, 0, 0.5], [Math.PI / 2, 0, 0]],\n [new Mesh(lineGeometry, matBlue), null, [Math.PI / 2, 0, 0]],\n [new Sprite(spriteBlue), [0, 0, 1.55]],\n ],\n };\n\n Object.keys(axesMap).forEach((key) => {\n axesMap[key].forEach((objects: any) => {\n const object = objects[0];\n const position = objects[1];\n const rotation = objects[2];\n\n object.name = key;\n if (position) object.position.set(position[0], position[1], position[2]);\n if (rotation) object.rotation.set(rotation[0], rotation[1], rotation[2]);\n object.updateMatrixWorld();\n\n this.add(object);\n });\n });\n }\n\n dispose() {\n this.traverse((object: any) => {\n if (object.geometry) object.geometry.dispose();\n if (object.material) object.material.dispose();\n });\n }\n\n getSpriteMaterial(color: Color, text: string) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = 64;\n canvas.height = 64;\n\n const context = canvas.getContext(\"2d\");\n context.clearRect(0, 0, 64, 64);\n context.font = \"24px Arial\";\n context.textAlign = \"center\";\n context.fillStyle = color.getStyle();\n context.fillText(text, 32, 41);\n\n const texture = new CanvasTexture(canvas);\n texture.colorSpace = SRGBColorSpace;\n\n return new SpriteMaterial({ map: texture, toneMapped: false });\n }\n\n render(renderer: WebGLRenderer) {\n this.quaternion.copy(this.camera.quaternion).invert();\n this.updateMatrixWorld();\n\n const clippingPlanes = renderer.clippingPlanes;\n const viewport = renderer.getViewport(new Vector4());\n\n renderer.setViewport(this.position.x, this.position.y, this.size, this.size);\n renderer.clippingPlanes = [];\n renderer.clearDepth();\n renderer.render(this, this.orthoCamera);\n\n renderer.setViewport(viewport);\n renderer.clippingPlanes = clippingPlanes;\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponent } from \"@inweb/viewer-core\";\nimport type { Viewer } from \"../Viewer\";\nimport { WCSHelper } from \"../helpers/WCSHelper\";\n\nexport class WCSHelperComponent implements IComponent {\n private wcsHelper: WCSHelper;\n private viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.wcsHelper = new WCSHelper(viewer.camera);\n this.viewer = viewer;\n this.viewer.addEventListener(\"databasechunk\", this.geometryEnd);\n this.viewer.addEventListener(\"drawviewpoint\", this.geometryEnd);\n this.viewer.addEventListener(\"render\", this.viewerRender);\n }\n\n dispose() {\n this.viewer.removeEventListener(\"databasechunk\", this.geometryEnd);\n this.viewer.removeEventListener(\"drawviewpoint\", this.geometryEnd);\n this.viewer.removeEventListener(\"render\", this.viewerRender);\n this.wcsHelper.dispose();\n }\n\n geometryEnd = () => {\n this.wcsHelper.dispose();\n this.wcsHelper = new WCSHelper(this.viewer.camera);\n };\n\n viewerRender = () => {\n if (!this.viewer.options.showWCS) return;\n\n this.wcsHelper.render(this.viewer.renderer);\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { IComponentsRegistry, componentsRegistry } from \"@inweb/viewer-core\";\n\n// import { AxesHelperComponent } from \"./AxesHelperComponent\";\nimport { BackgroundComponent } from \"./BackgroundComponent\";\nimport { CameraComponent } from \"./CameraComponent\";\nimport { ExtentsComponent } from \"./ExtentsComponent\";\n// import { ExtentsHelperComponent } from \"./ExtentsHelperComponent\";\n// import { LightComponent } from \"./LightComponent\";\n// import { LightHelperComponent } from \"./LightHelperComponent\";\nimport { RenderLoopComponent } from \"./RenderLoopComponent\";\nimport { ResizeCanvasComponent } from \"./ResizeCanvasComponent\";\nimport { SelectionComponent } from \"./SelectionComponent\";\nimport { WCSHelperComponent } from \"./WCSHelperComponent\";\n\n/**\n * Viewer components registry. Use this registry to register custom components.\n *\n * To implement custom component:\n *\n * 1. Define a component class implements {@link IComponent}.\n * 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.\n * 3. Define the component logic in the event listeners. For example, listen for the `mousedown` event and\n * select objects when the left mouse button is pressed.\n * 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.\n * 5. Register component provider in the components registry by calling the\n * {@link components.registerComponent}.\n *\n * @example Implementing a custom component.\n *\n * ```javascript\n * import { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n *\n * class MyComponent implements IComponent {\n * protected viewer: Viewer;\n *\n * constructor(viewer: Viewer) {\n * this.viewer = viewer;\n * this.viewer.addEventListener(\"mousedown\", this.onMouseDown);\n * }\n *\n * override dispose() {\n * this.viewer.removeEventListener(\"mousedown\", this.onMouseDown);\n * }\n *\n * onMouseDown = (event: PointerEvent) => {\n * // place custom logic here\n * };\n * }\n *\n * components.registerComponent(\"MyComponent\", (viewer): IComponent => new MyComponent(viewer));\n * ```\n */\nexport const components: IComponentsRegistry = componentsRegistry(\"threejs\");\n\n// build-in components\n\ncomponents.registerComponent(\"ExtentsComponent\", (viewer) => new ExtentsComponent(viewer));\ncomponents.registerComponent(\"CameraComponent\", (viewer) => new CameraComponent(viewer));\ncomponents.registerComponent(\"BackgroundComponent\", (viewer) => new BackgroundComponent(viewer));\n// components.registerComponent(\"LightComponent\", (viewer) => new LightComponent(viewer));\ncomponents.registerComponent(\"ResizeCanvasComponent\", (viewer) => new ResizeCanvasComponent(viewer));\ncomponents.registerComponent(\"RenderLoopComponent\", (viewer) => new RenderLoopComponent(viewer));\ncomponents.registerComponent(\"SelectionComponent\", (viewer) => new SelectionComponent(viewer));\n\ncomponents.registerComponent(\"WCSHelperComponent\", (viewer) => new WCSHelperComponent(viewer));\n// components.registerComponent(\"AxesHelperComponent\", (viewer) => new AxesHelperComponent(viewer));\n// components.registerComponent(\"ExtentsHelperComponent\", (viewer) => new ExtentsHelperComponent(viewer));\n// components.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { LoadingManager, LoaderUtils } from \"three\";\n\nexport class GLTFLoadingManager extends LoadingManager {\n public path = \"\";\n public resourcePath = \"\";\n public fileURL = \"\";\n public dataURLs = new Map();\n\n constructor(\n file: string | globalThis.File | ArrayBuffer | Blob,\n externalData: Map<string, string | File | ArrayBuffer | Blob> = new Map(),\n params: { path?: string } = {}\n ) {\n super();\n\n this.path = params.path || \"\";\n\n if (typeof file === \"string\") {\n this.fileURL = file;\n this.resourcePath = LoaderUtils.extractUrlBase(file);\n } else {\n externalData.forEach((value, key) => (this.fileURL = value === file ? key : this.fileURL));\n externalData.set(this.fileURL, file);\n }\n\n externalData.forEach((value, key) => {\n let dataURL: string;\n if (typeof value === \"string\") dataURL = value;\n else dataURL = URL.createObjectURL(new Blob([value]));\n this.dataURLs.set(key, dataURL);\n });\n\n this.setURLModifier((url: string) => {\n const key = decodeURI(url)\n .replace(this.path, \"\")\n .replace(this.resourcePath, \"\")\n .replace(/^(\\.?\\/)/, \"\");\n const dataURL = this.dataURLs.get(key);\n return dataURL ?? url;\n });\n }\n\n dispose() {\n this.dataURLs.forEach(URL.revokeObjectURL);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport {\n Box3,\n LinearToneMapping,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n Plane,\n Scene,\n Sphere,\n Vector2,\n Vector3,\n WebGLRenderer,\n} from \"three\";\nimport { GLTF, GLTFLoader } from \"three/examples/jsm/loaders/GLTFLoader.js\";\nimport { GLTFLoadingManager } from \"./loaders/GLTFLoadingManager\";\n\nimport { EventEmitter2 } from \"@inweb/eventemitter2\";\nimport { Assembly, Client, Model, File } from \"@inweb/client\";\nimport {\n CANVAS_EVENTS,\n CanvasEventMap,\n IClippingPlane,\n IComponent,\n IEntity,\n IDragger,\n IOptions,\n IOrthogonalCamera,\n IPerspectiveCamera,\n IPoint,\n IViewer,\n IViewpoint,\n Options,\n OptionsEventMap,\n ViewerEventMap,\n} from \"@inweb/viewer-core\";\nimport { IMarkup, IWorldTransform, Markup } from \"@inweb/markup\";\n\nimport { draggers } from \"./draggers\";\nimport { commands } from \"./commands\";\nimport { components } from \"./components\";\n\n/**\n * 3D viewer powered by {@link https://threejs.org/ | Three.js}.\n */\nexport class Viewer\n extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap>\n implements IViewer, IWorldTransform\n{\n public client: Client | undefined;\n protected _options: Options;\n\n private canvaseventlistener: (event: any) => void;\n\n public canvas: HTMLCanvasElement | undefined;\n public canvasEvents: string[];\n\n public scene: Scene | undefined;\n public helpers: Scene | undefined;\n public camera: PerspectiveCamera | OrthographicCamera | undefined;\n public renderer: WebGLRenderer | undefined;\n public models: Array<GLTF>;\n public selected: Array<Object3D>;\n public extents: Box3;\n public target: Vector3;\n\n private _activeDragger: IDragger | null;\n private _components: Array<IComponent>;\n\n private renderNeeded: boolean;\n private renderTime: DOMHighResTimeStamp;\n\n private _markup: IMarkup;\n\n /**\n * @param client - The `Client` instance that is used to load model reference files from the Open Cloud\n * Server. Do not specify `Client` if you need a standalone viewer instance to view `glTF` files from\n * the web or from local computer.\n */\n constructor(client?: Client) {\n super();\n this._options = new Options(this);\n\n this.client = client;\n\n this.canvasEvents = CANVAS_EVENTS;\n this.canvaseventlistener = (event: Event) => this.emit(event);\n\n this.models = [];\n this.selected = [];\n this.extents = new Box3();\n this.target = new Vector3();\n\n this._activeDragger = null;\n this._components = [];\n\n this.renderTime = 0;\n\n this.render = this.render.bind(this);\n this.update = this.update.bind(this);\n\n this._markup = new Markup();\n }\n\n get options(): IOptions {\n return this._options;\n }\n\n get draggers(): string[] {\n return [...draggers.getDraggers().keys()];\n }\n\n get components(): string[] {\n return [...components.getComponents().keys()];\n }\n\n /**\n * 2D markup core instance used to create markups.\n *\n * @readonly\n */\n get markup(): IMarkup {\n return this._markup;\n }\n\n initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent<EventTarget>) => void): Promise<this> {\n this.addEventListener(\"optionschange\", (event) => this.syncOptions(event.data));\n\n this.scene = new Scene();\n this.helpers = new Scene();\n\n const rect = canvas.parentElement.getBoundingClientRect();\n const width = rect.width || 1;\n const height = rect.height || 1;\n const aspect = width / height;\n this.camera = new PerspectiveCamera(45, aspect, 0.01, 1000);\n this.camera.up.set(0, 0, 1);\n\n this.renderer = new WebGLRenderer({ canvas, antialias: true, preserveDrawingBuffer: true });\n this.renderer.setPixelRatio(window.devicePixelRatio);\n this.renderer.setSize(width, height);\n this.renderer.toneMapping = LinearToneMapping;\n\n this.canvas = canvas;\n this.canvasEvents.forEach((x) => canvas.addEventListener(x, this.canvaseventlistener));\n\n this._markup.initialize(this.canvas, this.canvasEvents, this, this);\n\n for (const name of components.getComponents().keys()) {\n this._components.push(components.createComponent(name, this));\n }\n\n this.syncOptions();\n this.syncOverlay();\n\n this.renderTime = performance.now();\n this.render(this.renderTime);\n\n if (typeof onProgress === \"function\")\n onProgress(new ProgressEvent(\"progress\", { lengthComputable: true, loaded: 1, total: 1 }));\n\n this.emitEvent({ type: \"initializeprogress\", data: 1, loaded: 1, total: 1 });\n this.emitEvent({ type: \"initialize\" });\n\n return Promise.resolve(this);\n }\n\n dispose(): this {\n this.cancel();\n this.emitEvent({ type: \"dispose\" });\n\n this._components.forEach((component: IComponent) => component.dispose());\n this._components = [];\n\n this.setActiveDragger();\n this.removeAllListeners();\n\n this.clear();\n\n this._markup.dispose();\n\n if (this.canvas) {\n this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));\n this.canvas = undefined;\n }\n\n if (this.renderer) this.renderer.dispose();\n\n this.renderer = undefined;\n this.camera = undefined;\n this.scene = undefined;\n this.helpers = undefined;\n\n return this;\n }\n\n isInitialized(): boolean {\n return !!this.renderer;\n }\n\n public render(time: DOMHighResTimeStamp): void {\n if (!this.renderNeeded) return;\n if (!this.renderer) return;\n\n this.renderNeeded = false;\n\n this.renderer.setViewport(0, 0, this.canvas.offsetWidth, this.canvas.offsetHeight);\n this.renderer.autoClear = true;\n this.renderer.render(this.scene, this.camera);\n\n const clippingPlanes = this.renderer.clippingPlanes;\n this.renderer.clippingPlanes = [];\n this.renderer.autoClear = false;\n this.renderer.render(this.helpers, this.camera);\n this.renderer.clippingPlanes = clippingPlanes;\n\n this._activeDragger?.updatePreview?.();\n\n const deltaTime = (time - this.renderTime) / 1000;\n this.renderTime = time;\n this.emitEvent({ type: \"render\", time, deltaTime });\n }\n\n public update(force = false): void {\n this.renderNeeded = true;\n if (force) this.render(performance.now());\n this.emitEvent({ type: \"update\", data: force });\n }\n\n public syncOptions(options: IOptions = this.options): void {\n // this.update();\n }\n\n loadReferences(model: Model | File | Assembly): Promise<this> {\n // todo: load reference as text fonts\n return Promise.resolve(this);\n }\n\n /**\n * Loads a file from Open Cloud Server into the viewer.\n *\n * The file geometry data on the server must be converted to `glTF` format.\n *\n * This method requires a `Client` instance to be specified when creating the viewer to load model\n * reference files from the Open Cloud Server. For a standalone viewer instance use\n * {@link openGltfFile | openGltfFile()}.\n *\n * If there was an active dragger before opening the file, it will be deactivated. After opening the\n * file, you must manually activate the required dragger.\n *\n * Fires:\n *\n * - {@link OpenEvent | open}\n * - {@link GeometryStartEvent | geometrystart}\n * - {@link GeometryProgressEvent | geometryprogress}\n * - {@link DatabaseChunkEvent | databasechunk}\n * - {@link GeometryChunkEvent | geometrychunk}\n * - {@link GeometryEndEvent | geometryend}\n * - {@link GeometryErrorEvent | geometryerror}\n *\n * @param file - File, assembly or specific model to load. If a `File` instance with multiple models is\n * specified, the default model will be loaded. If there is no default model, first availiable model\n * will be loaded.\n */\n async open(file: Model | File | Assembly): Promise<this> {\n if (!this.renderer) return this;\n\n this.cancel();\n this.clear();\n\n this.emitEvent({ type: \"open\", file, model: file });\n\n let model: Model | undefined = undefined;\n if (file) {\n const models = (await file.getModels()) || [];\n model = models.find((model: Model) => model.default) || models[0];\n }\n if (!model) throw new Error(\"No default model found\");\n\n const geometryType = model.database.split(\".\").pop();\n if (geometryType !== \"gltf\") throw new Error(`Unknown geometry type: ${geometryType}`);\n\n const url = `${model.httpClient.serverUrl}${model.path}/${model.database}`;\n const params = { requestHeader: model.httpClient.headers };\n\n await this.loadReferences(model);\n await this.loadGltfFile(url, undefined, params);\n\n return this;\n }\n\n cancel(): this {\n this.emitEvent({ type: \"cancel\" });\n return this;\n }\n\n /**\n * Loads a `glTF` file into the viewer.\n *\n * If there was an active dragger before opening the file, it will be deactivated. After opening the\n * file, you must manually activate the required dragger.\n *\n * Fires:\n *\n * - {@link OpenEvent | open}\n * - {@link GeometryStartEvent | geometrystart}\n * - {@link GeometryProgressEvent | geometryprogress}\n * - {@link DatabaseChunkEvent | databasechunk}\n * - {@link GeometryEndEvent | geometryend}\n * - {@link GeometryErrorEvent | geometryerror}\n *\n * @param file - File URL or binary data buffer to load.\n * @param externalData - External resource map such as binary data buffers or images. Each resource\n * should be represented by a `uri` and a corresponding resource URL, or\n * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object, or\n * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}\n * or {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, or\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string,\n * @param params - Loader parameters.\n * @param params.path - The base path from which to find subsequent glTF resources such as textures and\n * .bin data files. If not defined, the base path of the file URL will be used.\n * @param params.requestHeader - The\n * {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP\n * request.\n * @param params.crossOrigin - The crossOrigin string to implement CORS for loading the url from a\n * different domain that allows CORS. Default is `anonymous`.\n * @param params.withCredentials - Whether the XMLHttpRequest uses credentials such as cookies,\n * authorization headers or TLS client certificates. See\n * {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}.\n */\n openGltfFile(\n file: string | globalThis.File | ArrayBuffer | Blob,\n externalData: Map<string, string | globalThis.File | ArrayBuffer | Blob> = new Map(),\n params: {\n path?: string;\n requestHeader?: HeadersInit;\n crossOrigin?: string;\n withCredentials?: boolean;\n } = {}\n ): Promise<this> {\n if (!this.renderer) return Promise.resolve(this);\n\n this.cancel();\n this.clear();\n\n this.emitEvent({ type: \"open\" });\n\n return this.loadGltfFile(file, externalData, params);\n }\n\n /**\n * Appends a `glTF` file to the existing opened file.\n *\n * Fires:\n *\n * - {@link OpenEvent | open}\n * - {@link GeometryStartEvent | geometrystart}\n * - {@link GeometryProgressEvent | geometryprogress}\n * - {@link DatabaseChunkEvent | databasechunk}\n * - {@link GeometryEndEvent | geometryend}\n * - {@link GeometryErrorEvent | geometryerror}\n *\n * @param file - File URL or binary data buffer to load.\n * @param externalData - External resource map such as binary data buffers or images. Each resource\n * should be represented by a `uri` and a corresponding resource URL, or\n * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object, or\n * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}\n * or {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, or\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string,\n * @param params - Loader parameters.\n * @param params.path - The base path from which to find subsequent glTF resources such as textures and\n * .bin data files.\n * @param params.requestHeader - The\n * {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP\n * request.\n * @param params.crossOrigin - The crossOrigin string to implement CORS for loading the url from a\n * different domain that allows CORS. Default is `anonymous`.\n * @param params.withCredentials - Whether the XMLHttpRequest uses credentials such as cookies,\n * authorization headers or TLS client certificates. See\n * {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}.\n */\n async loadGltfFile(\n file: string | globalThis.File | ArrayBuffer | Blob,\n externalData: Map<string, string | globalThis.File | ArrayBuffer | Blob> = new Map(),\n params: {\n path?: string;\n requestHeader?: HeadersInit;\n crossOrigin?: string;\n withCredentials?: boolean;\n } = {}\n ): Promise<this> {\n const manager = new GLTFLoadingManager(file, externalData, params);\n try {\n this.emitEvent({ type: \"geometrystart\" });\n\n const loader = new GLTFLoader(manager);\n loader.setPath(manager.path);\n loader.setRequestHeader(params.requestHeader as any);\n loader.setCrossOrigin(params.crossOrigin || loader.crossOrigin);\n loader.setWithCredentials(params.withCredentials || loader.withCredentials);\n\n const gltf = await loader.loadAsync(manager.fileURL, (event: ProgressEvent) => {\n const { lengthComputable, loaded, total } = event;\n const progress = lengthComputable ? loaded / total : 1;\n this.emitEvent({ type: \"geometryprogress\", data: progress });\n });\n\n if (!this.scene) return this;\n if (!gltf.scene) throw new Error(\"No glTF scene found\");\n\n this.models.push(gltf);\n this.scene.add(gltf.scene);\n\n this.syncOptions();\n this.syncOverlay();\n this.update();\n\n this.emitEvent({ type: \"databasechunk\" });\n this.emitEvent({ type: \"geometryend\", data: gltf.scene });\n } catch (error) {\n this.emitEvent({ type: \"geometryerror\", data: error });\n throw error;\n } finally {\n manager.dispose();\n }\n\n return this;\n }\n\n clear(): this {\n if (!this.renderer) return this;\n\n function disposeMaterial(material: any) {\n const materials = Array.isArray(material) ? material : [material];\n materials.forEach((material: any) => {\n // Object.keys(material).forEach((key) => material[key]?.dispose?.());\n material.dispose();\n });\n }\n\n function disposeObject(object: any) {\n if (object.geometry) object.geometry.dispose();\n if (object.material) disposeMaterial(object.material);\n }\n\n this.setActiveDragger();\n this.clearSlices();\n this.clearOverlay();\n this.clearSelected();\n\n this.helpers.traverse(disposeObject);\n this.helpers.clear();\n\n this.models.forEach((gltf) => gltf.scene.traverse(disposeObject));\n this.models.forEach((gltf) => gltf.scene.removeFromParent());\n this.models = [];\n\n this.scene.clear();\n\n this.syncOptions();\n this.syncOverlay();\n this.update(true);\n\n this.emitEvent({ type: \"clear\" });\n\n return this;\n }\n\n syncOverlay(): void {\n if (!this.renderer) return;\n\n this._markup.syncOverlay();\n this.update();\n }\n\n clearOverlay(): void {\n if (!this.renderer) return;\n\n this._markup.clearOverlay();\n this.update();\n }\n\n clearSlices(): void {\n if (!this.renderer) return;\n\n this.renderer.clippingPlanes = [];\n this.update();\n }\n\n getSelected(): string[] {\n return this.executeCommand(\"getSelected\");\n }\n\n setSelected(handles?: string[]): void {\n this.executeCommand(\"setSelected\", handles);\n }\n\n clearSelected(): void {\n this.executeCommand(\"clearSelected\");\n }\n\n hideSelected(): void {\n this.executeCommand(\"hideSelected\");\n }\n\n isolateSelected(): void {\n this.executeCommand(\"isolateSelected\");\n }\n\n showAll(): void {\n this.executeCommand(\"showAll\");\n }\n\n explode(index = 0): void {\n this.executeCommand(\"explode\", index);\n }\n\n collect(): void {\n this.executeCommand(\"collect\");\n }\n\n activeDragger(): IDragger | null {\n return this._activeDragger;\n }\n\n setActiveDragger(name = \"\"): IDragger | null {\n if (!this._activeDragger || this._activeDragger.name !== name) {\n const oldDragger = this._activeDragger;\n let newDragger = null;\n\n if (this._activeDragger) {\n this._activeDragger.dispose();\n this._activeDragger = null;\n }\n if (this.isInitialized()) {\n newDragger = draggers.createDragger(name, this);\n if (newDragger) {\n this._activeDragger = newDragger;\n this._activeDragger.initialize?.();\n }\n }\n\n const canvas = this.canvas;\n if (canvas) {\n if (oldDragger) canvas.classList.remove(`oda-cursor-${oldDragger.name.toLowerCase()}`);\n if (newDragger) canvas.classList.add(`oda-cursor-${newDragger.name.toLowerCase()}`);\n }\n\n this.emitEvent({ type: \"changeactivedragger\", data: name });\n this.update();\n }\n return this._activeDragger;\n }\n\n resetActiveDragger(): void {\n const dragger = this._activeDragger;\n if (dragger) {\n this.setActiveDragger();\n this.setActiveDragger(dragger.name);\n }\n }\n\n is3D(): boolean {\n return true;\n }\n\n screenToWorld(position: { x: number; y: number }): { x: number; y: number; z: number } {\n if (!this.renderer) return { x: position.x, y: position.y, z: 0 };\n\n const rect = this.canvas.getBoundingClientRect();\n const x = position.x / (rect.width / 2) - 1;\n const y = -position.y / (rect.height / 2) + 1;\n\n const point = new Vector3(x, y, -1);\n point.unproject(this.camera);\n\n return { x: point.x, y: point.y, z: point.z };\n }\n\n worldToScreen(position: { x: number; y: number; z: number }): { x: number; y: number } {\n if (!this.renderer) return { x: position.x, y: position.y };\n\n const point = new Vector3(position.x, position.y, position.z);\n point.project(this.camera);\n\n const rect = this.canvas.getBoundingClientRect();\n const x = (point.x + 1) * (rect.width / 2);\n const y = (-point.y + 1) * (rect.height / 2);\n\n return { x, y };\n }\n\n getScale(): { x: number; y: number; z: number } {\n return { x: 1, y: 1, z: 1 };\n }\n\n executeCommand(id: string, ...args: any[]): any {\n return commands.executeCommand(id, this, ...args);\n }\n\n getComponent(name: string): IComponent {\n return this._components.find((component) => component.name === name);\n }\n\n drawViewpoint(viewpoint: IViewpoint): void {\n if (!this.renderer) return;\n\n const getVector3FromPoint3d = ({ x, y, z }): Vector3 => new Vector3(x, y, z);\n\n const setOrthogonalCamera = (orthogonal_camera: IOrthogonalCamera) => {\n if (orthogonal_camera) {\n const extentsSize = this.extents.getBoundingSphere(new Sphere()).radius * 2;\n const rendererSize = this.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n this.camera = new OrthographicCamera();\n this.camera.top = orthogonal_camera.field_height / 2;\n this.camera.bottom = -orthogonal_camera.field_height / 2;\n this.camera.left = this.camera.bottom * aspect;\n this.camera.right = this.camera.top * aspect;\n this.camera.near = 0;\n this.camera.far = extentsSize * 100;\n this.camera.zoom = orthogonal_camera.view_to_world_scale;\n this.camera.updateProjectionMatrix();\n\n this.camera.up.copy(getVector3FromPoint3d(orthogonal_camera.up_vector));\n this.camera.position.copy(getVector3FromPoint3d(orthogonal_camera.view_point));\n this.camera.lookAt(getVector3FromPoint3d(orthogonal_camera.direction).add(this.camera.position));\n this.camera.updateMatrixWorld();\n }\n };\n\n const setPerspectiveCamera = (perspective_camera: IPerspectiveCamera) => {\n if (perspective_camera) {\n const extentsSize = this.extents.getBoundingSphere(new Sphere()).radius * 2;\n const rendererSize = this.renderer.getSize(new Vector2());\n const aspect = rendererSize.x / rendererSize.y;\n\n this.camera = new PerspectiveCamera();\n this.camera.fov = perspective_camera.field_of_view;\n this.camera.aspect = aspect;\n this.camera.near = extentsSize / 100;\n this.camera.far = extentsSize * 100;\n this.camera.updateProjectionMatrix();\n\n this.camera.up.copy(getVector3FromPoint3d(perspective_camera.up_vector));\n this.camera.position.copy(getVector3FromPoint3d(perspective_camera.view_point));\n this.camera.lookAt(getVector3FromPoint3d(perspective_camera.direction).add(this.camera.position));\n this.camera.updateMatrixWorld();\n }\n };\n\n const setClippingPlanes = (clipping_planes: IClippingPlane[]) => {\n clipping_planes?.forEach((clipping_plane) => {\n const plane = new Plane();\n plane.setFromNormalAndCoplanarPoint(\n getVector3FromPoint3d(clipping_plane.direction),\n getVector3FromPoint3d(clipping_plane.location)\n );\n\n this.renderer.clippingPlanes.push(plane);\n });\n };\n\n const setSelection = (selection: IEntity[]) => {\n if (selection) this.setSelected(selection.map((component) => component.handle));\n };\n\n const draggerName = this._activeDragger?.name;\n\n this.setActiveDragger();\n this.clearSlices();\n this.clearOverlay();\n\n this.clearSelected();\n this.showAll();\n this.explode();\n\n setOrthogonalCamera(viewpoint.orthogonal_camera);\n setPerspectiveCamera(viewpoint.perspective_camera);\n setClippingPlanes(viewpoint.clipping_planes);\n setSelection(viewpoint.selection);\n this._markup.setViewpoint(viewpoint);\n\n this.target = getVector3FromPoint3d(viewpoint.custom_fields?.camera_target ?? this.target);\n\n this.setActiveDragger(draggerName);\n this.emitEvent({ type: \"drawviewpoint\", data: viewpoint });\n this.update();\n }\n\n createViewpoint(): IViewpoint {\n if (!this.renderer) return {};\n\n const getPoint3dFromVector3 = ({ x, y, z }): IPoint => ({ x, y, z });\n\n const getOrthogonalCamera = (): IOrthogonalCamera => {\n if (this.camera[\"isOrthographicCamera\"])\n return {\n view_point: getPoint3dFromVector3(this.camera.position),\n direction: getPoint3dFromVector3(this.camera.getWorldDirection(new Vector3())),\n up_vector: getPoint3dFromVector3(this.camera.up),\n field_width: this.camera[\"right\"] - this.camera[\"left\"],\n field_height: this.camera[\"top\"] - this.camera[\"bottom\"],\n view_to_world_scale: this.camera.zoom,\n };\n else return undefined;\n };\n\n const getPerspectiveCamera = (): IPerspectiveCamera => {\n if (this.camera[\"isPerspectiveCamera\"])\n return {\n view_point: getPoint3dFromVector3(this.camera.position),\n direction: getPoint3dFromVector3(this.camera.getWorldDirection(new Vector3())),\n up_vector: getPoint3dFromVector3(this.camera.up),\n field_of_view: this.camera[\"fov\"],\n };\n else return undefined;\n };\n\n const getClippingPlanes = (): IClippingPlane[] => {\n const clipping_planes = [];\n this.renderer.clippingPlanes.forEach((plane: Plane) => {\n const clipping_plane = {\n location: getPoint3dFromVector3(plane.coplanarPoint(new Vector3())),\n direction: getPoint3dFromVector3(plane.normal),\n };\n clipping_planes.push(clipping_plane);\n });\n return clipping_planes;\n };\n\n const getSelection = (): IEntity[] => {\n return this.getSelected().map((handle) => ({ handle }));\n };\n\n const viewpoint: IViewpoint = { custom_fields: {} };\n\n viewpoint.orthogonal_camera = getOrthogonalCamera();\n viewpoint.perspective_camera = getPerspectiveCamera();\n viewpoint.clipping_planes = getClippingPlanes();\n viewpoint.selection = getSelection();\n viewpoint.description = new Date().toDateString();\n this._markup.getViewpoint(viewpoint);\n\n viewpoint.custom_fields.camera_target = getPoint3dFromVector3(this.target);\n\n this.emitEvent({ type: \"createviewpoint\", data: viewpoint });\n\n return viewpoint;\n }\n}\n"],"names":["PlaneHelper","Line","constructor","plane","size","color","offset","Vector3","positions","geometry","BufferGeometry","setAttribute","Float32BufferAttribute","computeBoundingSphere","super","LineBasicMaterial","toneMapped","this","type","positions2","geometry2","helper","Mesh","MeshBasicMaterial","opacity","transparent","depthWrite","side","DoubleSide","add","dispose","material","children","updateMatrixWorld","force","position","set","lookAt","normal","copy","translateZ","dot","constant","scale","_changeEvent","_startEvent","_endEvent","STATE","NONE","ROTATE","DOLLY","PAN","TOUCH_ROTATE","TOUCH_PAN","TOUCH_DOLLY_PAN","TOUCH_DOLLY_ROTATE","OrbitControls","EventDispatcher","object","domElement","style","touchAction","enabled","target","minDistance","maxDistance","Infinity","minZoom","maxZoom","minPolarAngle","maxPolarAngle","Math","PI","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","enableZoom","zoomSpeed","enableRotate","rotateSpeed","enablePan","panSpeed","screenSpacePanning","keyPanSpeed","autoRotate","autoRotateSpeed","keys","LEFT","UP","RIGHT","BOTTOM","mouseButtons","MOUSE","MIDDLE","touches","ONE","TOUCH","TWO","DOLLY_PAN","target0","clone","position0","zoom0","zoom","_domElementKeyEvents","getPolarAngle","spherical","phi","getAzimuthalAngle","theta","getDistance","distanceTo","listenToKeyEvents","addEventListener","onKeyDown","stopListenToKeyEvents","removeEventListener","saveState","scope","reset","updateProjectionMatrix","dispatchEvent","update","state","quat","Quaternion","setFromUnitVectors","up","quatInverse","invert","lastPosition","lastQuaternion","lastTargetPosition","twoPI","sub","applyQuaternion","setFromVector3","rotateLeft","getAutoRotationAngle","sphericalDelta","min","max","isFinite","makeSafe","radius","addScaledVector","panOffset","setFromSpherical","multiplyScalar","zoomChanged","distanceToSquared","EPS","quaternion","onContextMenu","onPointerDown","onPointerUp","onMouseWheel","onPointerMove","Spherical","rotateStart","Vector2","rotateEnd","rotateDelta","panStart","panEnd","panDelta","dollyStart","dollyEnd","dollyDelta","dollyScale","pointers","pointerPositions","getZoomScale","pow","angle","rotateUp","panLeft","v","distance","objectMatrix","setFromMatrixColumn","panUp","crossVectors","pan","deltaX","deltaY","element","isPerspectiveCamera","targetDistance","length","tan","fov","clientHeight","matrix","isOrthographicCamera","right","left","clientWidth","top","bottom","console","warn","dollyOut","dollyIn","handleMouseDownRotate","event","clientX","clientY","handleMouseDownDolly","handleMouseDownPan","handleMouseMoveRotate","subVectors","x","y","handleMouseMoveDolly","handleMouseMovePan","handleMouseWheel","handleKeyDown","needsUpdate","code","ctrlKey","metaKey","shiftKey","preventDefault","handleTouchStartRotate","pageX","pageY","handleTouchStartPan","handleTouchStartDolly","dx","dy","sqrt","handleTouchStartDollyPan","handleTouchStartDollyRotate","handleTouchMoveRotate","getSecondPointerPosition","handleTouchMovePan","handleTouchMoveDolly","handleTouchMoveDollyPan","handleTouchMoveDollyRotate","setPointerCapture","pointerId","addPointer","pointerType","onTouchStart","onMouseDown","onTouchMove","onMouseMove","removePointer","releasePointerCapture","mouseAction","button","trackPointer","DOLLY_ROTATE","push","i","splice","undefined","pointer","passive","OrbitDragger","viewer","updateControls","orbit","camera","far","near","controlsStart","changed","controlsChange","emitEvent","dX","dY","data","stopContextMenu","stopPropagation","canvas","on","initialize","off","CuttingPlaneDragger","transformChange","planeCenter","transformDrag","value","viewerExplode","planeHelper","extents","getSize","onDoubleClick","negate","center","getCenter","Plane","renderer","clippingPlanes","helpers","Object3D","transform","TransformControls","showX","showY","showZ","z","attach","getHelper","removeFromParent","detach","CuttingPlaneXAxisDragger","CuttingPlaneYAxisDragger","CuttingPlaneZAxisDragger","PRECISION","MeasureLineDragger","line","startPoint","snapper","getSnapPoint","render","endPoint","MeasureLine","overlay","addLine","onPointerCancel","PointerEvent","onPointerLeave","renderOverlay","updateSnapper","scene","MeasureOverlay","MeasureSnapper","objects","raycaster","Raycaster","mouse","rect","getBoundingClientRect","width","height","coords","setFromCamera","params","threshold","Line2","LOD","Points","Sprite","intersects","intersectObjects","point","traverseVisible","child","lines","projector","MeasureProjector","container","document","createElement","id","background","outline","pointerEvents","overflow","parentElement","appendChild","clear","remove","forEach","removeLine","filter","_middlePoint","Date","now","unit","lineWidth","border","boxShadow","font","elementStartPoint","elementEndPoint","elementLine","elementLabel","visible","projectPoint","display","point1","point2","projectLine","lerpVectors","innerHTML","toFixed","zIndex","borderRadius","transformOrigin","padding","paddingInline","_widthHalf","_heightHalf","_viewMatrix","Matrix4","_viewProjectionMatrix","_vector","_vector1","Vector4","_vector2","matrixWorldInverse","multiplyMatrices","projectionMatrix","p","applyMatrix4","p1","p2","bc1near","w","bc2near","bc1far","bc2far","alpha1","alpha2","lerp","PanDragger","WalkControls","Controls","movementSpeed","lookSpeed","multiplier","moveWheel","mouseDragOn","downPosition","movePosition","rotateCamera","onWheel","moveKeys","onKeyUp","delete","Set","moveClock","Clock","window","timeDelta","getDelta","moveDelta","has","translateX","translateY","lookDelta","sign","stop","autoStart","delta","rotateX","rotateY","xRotation","setFromAxisAngle","yRotation","premultiply","multiply","normalize","setRotationFromQuaternion","WalkDragger","controls","walkspeedChange","viewerRender","viewerZoom","ZoomDragger","draggers","draggersRegistry","registerDragger","applyModelTransform","model","clearMarkup","clearOverlay","SelectionComponent","isPrimary","getMousePosition","upPosition","getPointerIntersects","clearSelection","select","handles","getSelected","executeCommand","optionsChange","facesColor","facesTransparancy","options","facesMaterial","setRGB","r","g","b","isSelected","originalMaterial","selected","clearSelected","selection","clearSlices","createPreview","encoderOptions","toDataURL","calcExplodeDepth","depth","res","objectDepth","originalPosition","originalCenter","Box3","setFromObject","isExplodeLocked","explodeScene","coeff","explodeDepth","maxDepth","scaledExplodeDepth","currentSegmentFraction","explodeObject","objectScale","parentCenter","parent","objectCenter","objectOffset","explode","index","models","collect","zoomTo","box","isEmpty","sphere","getBoundingSphere","Sphere","rendererSize","aspect","MathUtils","DEG2RAD","defaultViewPositions","front","back","sw","se","ne","nw","setDefaultViewPosition","direction","emit","getDefaultViewPositions","Object","getModels","map","_a","userData","handle","hideSelected","isolateSelected","visibleSet","traverseAncestors","object2","traverse","regenerateAll","resetView","selectModel","setActiveDragger","dragger","setMarkupColor","markup","setSelected","handleSet","showAll","zoomToExtents","zoomToObjects","reduce","result","expandByObject","zoomToSelected","commands","commandsRegistry","registerCommand","registerCommandAlias","BackgroundComponent","syncOptions","backgroundColor","setHex","Color","environment","RoomEnvironment","pmremGenerator","PMREMGenerator","setClearColor","fromScene","texture","CameraComponent","geometryEnd","extentsSize","sceneCamera","isCamera","ExtentsComponent","syncExtents","RenderLoopComponent","animate","time","requestId","requestAnimationFrame","cancelAnimationFrame","ResizeCanvasComponent","resizeViewer","entries","contentRect","setSize","resizeObserver","ResizeObserver","observe","disconnect","WCSHelper","orthoCamera","OrthographicCamera","matRed","matGreen","matBlue","spriteRed","getSpriteMaterial","spriteGreen","spriteBlue","lineGeometry","CylinderGeometry","translate","arrowGeometry","axesMap","X","Y","Z","key","rotation","name","text","context","getContext","clearRect","textAlign","fillStyle","getStyle","fillText","CanvasTexture","colorSpace","SRGBColorSpace","SpriteMaterial","viewport","getViewport","setViewport","clearDepth","WCSHelperComponent","wcsHelper","showWCS","components","componentsRegistry","registerComponent","GLTFLoadingManager","LoadingManager","file","externalData","Map","path","resourcePath","fileURL","dataURLs","LoaderUtils","extractUrlBase","dataURL","URL","createObjectURL","Blob","setURLModifier","url","decodeURI","replace","get","revokeObjectURL","Viewer","EventEmitter2","client","_options","Options","canvasEvents","CANVAS_EVENTS","canvaseventlistener","_activeDragger","_components","renderTime","bind","_markup","Markup","getDraggers","getComponents","onProgress","Scene","PerspectiveCamera","WebGLRenderer","antialias","preserveDrawingBuffer","setPixelRatio","devicePixelRatio","toneMapping","LinearToneMapping","createComponent","syncOverlay","performance","ProgressEvent","lengthComputable","loaded","total","Promise","resolve","cancel","component","removeAllListeners","isInitialized","renderNeeded","offsetWidth","offsetHeight","autoClear","_b","updatePreview","deltaTime","loadReferences","open","find","default","Error","geometryType","database","split","pop","httpClient","serverUrl","requestHeader","headers","loadGltfFile","openGltfFile","manager","loader","GLTFLoader","setPath","setRequestHeader","setCrossOrigin","crossOrigin","setWithCredentials","withCredentials","gltf","loadAsync","progress","error","disposeMaterial","materials","Array","isArray","disposeObject","activeDragger","oldDragger","newDragger","createDragger","classList","toLowerCase","resetActiveDragger","is3D","screenToWorld","unproject","worldToScreen","project","getScale","args","getComponent","drawViewpoint","viewpoint","getVector3FromPoint3d","setOrthogonalCamera","orthogonal_camera","field_height","view_to_world_scale","up_vector","view_point","setPerspectiveCamera","perspective_camera","field_of_view","setClippingPlanes","clipping_planes","clipping_plane","setFromNormalAndCoplanarPoint","location","setSelection","draggerName","setViewpoint","custom_fields","camera_target","_c","createViewpoint","getPoint3dFromVector3","getOrthogonalCamera","getWorldDirection","field_width","getPerspectiveCamera","getClippingPlanes","coplanarPoint","getSelection","description","toDateString","getViewpoint"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,MAAMA,oBAAoBC;IAMxB,WAAAC,CAAYC,OAAcC,OAAO,GAAGC,QAAQ,UAAUC,SAAkB,IAAIC;QAE1E,MAAMC,YAAY,EAAC,GAAG,GAAG,IAAG,GAAI,GAAG,IAAK,IAAI,GAAE,GAAG,IAAG,GAAI,GAAG,GAAG,GAAG;QAEjE,MAAMC,WAAW,IAAIC;QACrBD,SAASE,aAAa,YAAY,IAAIC,uBAAuBJ,WAAW;QACxEC,SAASI;QAETC,MAAML,UAAU,IAAIM,kBAAkB;YAAEV;YAAOW,YAAY;;QAE1DC,KAAaC,OAAO;QAErBD,KAAKd,QAAQA;QACbc,KAAKb,OAAOA;QACZa,KAAKX,SAASA;QAEd,MAAMa,aAAa,EAAC,GAAG,GAAG,OAAO,GAAG,QAAO,GAAI,GAAG,GAAG,GAAG,IAAK,IAAI,GAAE,GAAG,IAAK,GAAE;QAE7E,MAAMC,YAAY,IAAIV;QACtBU,UAAUT,aAAa,YAAY,IAAIC,uBAAuBO,YAAY;QAC1EC,UAAUP;QAEV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