@aibee/owlly 1.0.25 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/external/lines/line-geometry.d.ts +9 -0
- package/lib/external/lines/line-geometry.js +51 -0
- package/lib/external/lines/line-material.d.ts +10 -0
- package/lib/external/lines/line-material.js +376 -0
- package/lib/external/lines/line-segments-2.d.ts +7 -0
- package/lib/external/lines/line-segments-2.js +143 -0
- package/lib/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/external/lines/line-segments-geometry.js +140 -0
- package/lib/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/external/loaders/gltf-loader.js +2318 -0
- package/lib/external/orbit-controls.d.ts +44 -0
- package/lib/external/orbit-controls.js +745 -0
- package/lib/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/external/renderers/css-2d-renderer.js +121 -0
- package/lib/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/external/renderers/css-3d-renderer.js +138 -0
- package/lib/external/transform-controls.d.ts +106 -0
- package/lib/external/transform-controls.js +1112 -0
- package/lib/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/owlly/controller/aerial-element-controller.js +235 -0
- package/lib/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/owlly/controller/basic-controller.js +1238 -0
- package/lib/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/owlly/controller/camera-controller.js +137 -0
- package/lib/owlly/controller/controller.d.ts +61 -0
- package/lib/owlly/controller/controller.js +23 -0
- package/lib/owlly/controller/index.d.ts +2 -0
- package/lib/owlly/controller/index.js +13 -0
- package/lib/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/owlly/controller/mouse-indicator-controller.js +118 -0
- package/lib/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/owlly/controller/orbit-control.js +264 -0
- package/lib/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/owlly/controller/panorama-adjust-controller.js +157 -0
- package/lib/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/owlly/controller/panorama-controller.js +1943 -0
- package/lib/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/owlly/controller/panorama-transform-controller.js +136 -0
- package/lib/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/owlly/controller/plane-controller.js +173 -0
- package/lib/owlly/controller/texture-controller.d.ts +181 -0
- package/lib/owlly/controller/texture-controller.js +875 -0
- package/lib/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/owlly/controller/tile-panorama-controller.js +1353 -0
- package/lib/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/owlly/controller/transform-controller.js +545 -0
- package/lib/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/owlly/element/bottom-nav-element.js +257 -0
- package/lib/owlly/element/camera.d.ts +82 -0
- package/lib/owlly/element/camera.js +283 -0
- package/lib/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/owlly/element/dom-2d-element.js +48 -0
- package/lib/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/owlly/element/dom-3d-element.js +33 -0
- package/lib/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/owlly/element/dom-label-2d.js +382 -0
- package/lib/owlly/element/element.d.ts +53 -0
- package/lib/owlly/element/element.js +75 -0
- package/lib/owlly/element/floor-model.d.ts +83 -0
- package/lib/owlly/element/floor-model.js +227 -0
- package/lib/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/owlly/element/gif-kit/Gif.js +432 -0
- package/lib/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/owlly/element/gif-kit/GifColor.js +37 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +50 -0
- package/lib/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/owlly/element/gif-kit/GifFrame.js +96 -0
- package/lib/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/owlly/element/gif-kit/GifImage.js +7 -0
- package/lib/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/owlly/element/gif-kit/GifParser.js +196 -0
- package/lib/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifPresenter.js +43 -0
- package/lib/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/owlly/element/gif-kit/GifVersion.js +12 -0
- package/lib/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/owlly/element/gltf-mesh-element.js +136 -0
- package/lib/owlly/element/index.d.ts +20 -0
- package/lib/owlly/element/index.js +24 -0
- package/lib/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/owlly/element/map-kit/shape.js +189 -0
- package/lib/owlly/element/mesh-element.d.ts +22 -0
- package/lib/owlly/element/mesh-element.js +63 -0
- package/lib/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/owlly/element/mesh-line-2d.js +887 -0
- package/lib/owlly/element/meshline-o.d.ts +64 -0
- package/lib/owlly/element/meshline-o.js +678 -0
- package/lib/owlly/element/panorama-group.d.ts +241 -0
- package/lib/owlly/element/panorama-group.js +966 -0
- package/lib/owlly/element/panorama.d.ts +132 -0
- package/lib/owlly/element/panorama.js +812 -0
- package/lib/owlly/element/path-group.d.ts +69 -0
- package/lib/owlly/element/path-group.js +171 -0
- package/lib/owlly/element/path.d.ts +99 -0
- package/lib/owlly/element/path.js +531 -0
- package/lib/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/owlly/element/placeable-2d.js +470 -0
- package/lib/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/owlly/element/polygon-mesh.js +307 -0
- package/lib/owlly/element/ring-element.d.ts +79 -0
- package/lib/owlly/element/ring-element.js +383 -0
- package/lib/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/owlly/element/sphere-mesh.js +69 -0
- package/lib/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/owlly/element/svg-floor-model.js +184 -0
- package/lib/owlly/element/svg-floors.d.ts +27 -0
- package/lib/owlly/element/svg-floors.js +109 -0
- package/lib/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/owlly/element/tile-panorama-group.js +1006 -0
- package/lib/owlly/element/tile-panorama.d.ts +161 -0
- package/lib/owlly/element/tile-panorama.js +509 -0
- package/lib/owlly/element/tile-plane.d.ts +105 -0
- package/lib/owlly/element/tile-plane.js +360 -0
- package/lib/owlly/element/video-element.d.ts +33 -0
- package/lib/owlly/element/video-element.js +159 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.js +210 -0
- package/lib/owlly/index.d.ts +13 -0
- package/lib/owlly/index.js +16 -0
- package/lib/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/owlly/overlay/canvas-overlay.js +510 -0
- package/lib/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/owlly/overlay/css-2d-overlay.js +35 -0
- package/lib/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/owlly/overlay/css-3d-overlay.js +36 -0
- package/lib/owlly/overlay/index.d.ts +6 -0
- package/lib/owlly/overlay/index.js +11 -0
- package/lib/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/owlly/overlay/label-overlay.js +328 -0
- package/lib/owlly/overlay/overlay.d.ts +14 -0
- package/lib/owlly/overlay/overlay.js +4 -0
- package/lib/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/owlly/overlay/path-overlay.js +124 -0
- package/lib/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/owlly/overlay/path-overlay2.js +118 -0
- package/lib/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/owlly/overlay/poi-overlay-3d.js +1432 -0
- package/lib/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/owlly/overlay/poi-overlay.js +1411 -0
- package/lib/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/owlly/owlly-2d/index.js +92 -0
- package/lib/owlly/screen/index.d.ts +1 -0
- package/lib/owlly/screen/index.js +1 -0
- package/lib/owlly/screen/screen.d.ts +73 -0
- package/lib/owlly/screen/screen.js +236 -0
- package/lib/owlly/stage/externals.d.ts +19 -0
- package/lib/owlly/stage/externals.js +24 -0
- package/lib/owlly/stage/index.d.ts +4 -0
- package/lib/owlly/stage/index.js +6 -0
- package/lib/owlly/stage/owlly.d.ts +38 -0
- package/lib/owlly/stage/owlly.js +168 -0
- package/lib/owlly/stage/stage.d.ts +108 -0
- package/lib/owlly/stage/stage.js +234 -0
- package/lib/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/owlly/utils/alignment-utils.js +63 -0
- package/lib/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/owlly/utils/basic-calc.js +129 -0
- package/lib/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/owlly/utils/basic-tools.js +235 -0
- package/lib/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/owlly/utils/bvh-tree.js +539 -0
- package/lib/owlly/utils/camera.d.ts +37 -0
- package/lib/owlly/utils/camera.js +50 -0
- package/lib/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/owlly/utils/cube-texture-cache.js +143 -0
- package/lib/owlly/utils/device-utils.d.ts +18 -0
- package/lib/owlly/utils/device-utils.js +41 -0
- package/lib/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/owlly/utils/environment-utils.js +73 -0
- package/lib/owlly/utils/event-hub.d.ts +50 -0
- package/lib/owlly/utils/event-hub.js +106 -0
- package/lib/owlly/utils/events.d.ts +219 -0
- package/lib/owlly/utils/events.js +219 -0
- package/lib/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/owlly/utils/geometry-utils.js +622 -0
- package/lib/owlly/utils/helper.d.ts +6 -0
- package/lib/owlly/utils/helper.js +24 -0
- package/lib/owlly/utils/index.d.ts +14 -0
- package/lib/owlly/utils/index.js +17 -0
- package/lib/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/owlly/utils/lru-cache.js +109 -0
- package/lib/owlly/utils/map-utils.d.ts +7 -0
- package/lib/owlly/utils/map-utils.js +52 -0
- package/lib/owlly/utils/number-utils.d.ts +8 -0
- package/lib/owlly/utils/number-utils.js +72 -0
- package/lib/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/owlly/utils/panorama-model-util.js +245 -0
- package/lib/owlly/utils/path-utils.d.ts +80 -0
- package/lib/owlly/utils/path-utils.js +728 -0
- package/lib/owlly/utils/svgutils.d.ts +138 -0
- package/lib/owlly/utils/svgutils.js +561 -0
- package/lib/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/owlly/utils/texture-cache.js +115 -0
- package/lib/owlly/utils/tile-util.d.ts +187 -0
- package/lib/owlly/utils/tile-util.js +456 -0
- package/lib/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/owlly/utils/time-profiler.js +48 -0
- package/lib/owlly/view/camera-view.d.ts +35 -0
- package/lib/owlly/view/camera-view.js +101 -0
- package/lib/owlly/view/index.d.ts +3 -0
- package/lib/owlly/view/index.js +5 -0
- package/lib/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/owlly/view/orthographic-view.js +94 -0
- package/lib/owlly/view/perspective-view.d.ts +40 -0
- package/lib/owlly/view/perspective-view.js +95 -0
- package/lib/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/owlly/view/svg-map-view.js +144 -0
- package/lib/owlly/view/view.d.ts +146 -0
- package/lib/owlly/view/view.js +317 -0
- package/lib/prod/owlly.esm.js +93462 -0
- package/lib/prod/owlly.esm.js.map +1 -0
- package/lib/prod/owlly.esm.min.js +54 -0
- package/lib/prod/owlly.iife.js +93560 -0
- package/lib/prod/owlly.iife.js.map +1 -0
- package/lib/prod/owlly.iife.min.js +69 -0
- package/lib/prod/owlly.miniapp.js +73845 -0
- package/lib/prod/owlly.miniapp.js.map +1 -0
- package/lib/prod/owlly.miniapp.min.js +63 -0
- package/lib/prod/src/external/lines/line-geometry.d.ts +9 -0
- package/lib/prod/src/external/lines/line-material.d.ts +10 -0
- package/lib/prod/src/external/lines/line-segments-2.d.ts +7 -0
- package/lib/prod/src/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/prod/src/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/prod/src/external/orbit-controls.d.ts +44 -0
- package/lib/prod/src/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/prod/src/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/prod/src/external/transform-controls.d.ts +106 -0
- package/lib/prod/src/external/util/buffer-geometry-utils.d.ts +45 -0
- package/lib/prod/src/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/prod/src/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/prod/src/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/prod/src/owlly/controller/controller.d.ts +61 -0
- package/lib/prod/src/owlly/controller/index.d.ts +2 -0
- package/lib/prod/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/prod/src/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/prod/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/prod/src/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/prod/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/prod/src/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/prod/src/owlly/controller/texture-controller.d.ts +183 -0
- package/lib/prod/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/prod/src/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/prod/src/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/prod/src/owlly/element/camera.d.ts +82 -0
- package/lib/prod/src/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/prod/src/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/prod/src/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/prod/src/owlly/element/element.d.ts +53 -0
- package/lib/prod/src/owlly/element/floor-model.d.ts +83 -0
- package/lib/prod/src/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/prod/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/prod/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/prod/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/prod/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/prod/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/prod/src/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/prod/src/owlly/element/index.d.ts +6 -0
- package/lib/prod/src/owlly/element/map-kit/area.d.ts +24 -0
- package/lib/prod/src/owlly/element/map-kit/block-set.d.ts +39 -0
- package/lib/prod/src/owlly/element/map-kit/block.d.ts +77 -0
- package/lib/prod/src/owlly/element/map-kit/index.d.ts +3 -0
- package/lib/prod/src/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/prod/src/owlly/element/mesh-element.d.ts +22 -0
- package/lib/prod/src/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/prod/src/owlly/element/meshline-o.d.ts +64 -0
- package/lib/prod/src/owlly/element/panorama-group.d.ts +241 -0
- package/lib/prod/src/owlly/element/panorama.d.ts +132 -0
- package/lib/prod/src/owlly/element/path-group.d.ts +69 -0
- package/lib/prod/src/owlly/element/path.d.ts +99 -0
- package/lib/prod/src/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/prod/src/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/prod/src/owlly/element/ring-element.d.ts +79 -0
- package/lib/prod/src/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/prod/src/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/prod/src/owlly/element/svg-floors.d.ts +27 -0
- package/lib/prod/src/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/prod/src/owlly/element/tile-panorama.d.ts +162 -0
- package/lib/prod/src/owlly/element/tile-plane.d.ts +114 -0
- package/lib/prod/src/owlly/element/video-element.d.ts +33 -0
- package/lib/prod/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/prod/src/owlly/index.d.ts +13 -0
- package/lib/prod/src/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/prod/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/prod/src/owlly/overlay/index.d.ts +5 -0
- package/lib/prod/src/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/prod/src/owlly/overlay/overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/prod/src/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/prod/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/prod/src/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/prod/src/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/prod/src/owlly/screen/index.d.ts +1 -0
- package/lib/prod/src/owlly/screen/screen.d.ts +73 -0
- package/lib/prod/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
- package/lib/prod/src/owlly/stage/externals.d.ts +19 -0
- package/lib/prod/src/owlly/stage/index.d.ts +3 -0
- package/lib/prod/src/owlly/stage/owlly.d.ts +38 -0
- package/lib/prod/src/owlly/stage/stage.d.ts +108 -0
- package/lib/prod/src/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/prod/src/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/prod/src/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/prod/src/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/prod/src/owlly/utils/camera.d.ts +37 -0
- package/lib/prod/src/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/prod/src/owlly/utils/device-utils.d.ts +18 -0
- package/lib/prod/src/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/prod/src/owlly/utils/event-hub.d.ts +50 -0
- package/lib/prod/src/owlly/utils/events.d.ts +219 -0
- package/lib/prod/src/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/prod/src/owlly/utils/helper.d.ts +6 -0
- package/lib/prod/src/owlly/utils/index.d.ts +13 -0
- package/lib/prod/src/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/prod/src/owlly/utils/map-utils.d.ts +7 -0
- package/lib/prod/src/owlly/utils/number-utils.d.ts +8 -0
- package/lib/prod/src/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/prod/src/owlly/utils/path-utils.d.ts +80 -0
- package/lib/prod/src/owlly/utils/svgutils.d.ts +138 -0
- package/lib/prod/src/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/prod/src/owlly/utils/tile-util.d.ts +187 -0
- package/lib/prod/src/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/prod/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
- package/lib/prod/src/owlly/view/camera-view.d.ts +35 -0
- package/lib/prod/src/owlly/view/index.d.ts +3 -0
- package/lib/prod/src/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/perspective-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/prod/src/owlly/view/view.d.ts +146 -0
- package/lib/src/owlly/controller/texture-controller.d.ts +3 -1
- package/lib/src/owlly/controller/texture-controller.js +16 -1
- package/lib/src/owlly/controller/texture-controller.js.map +1 -1
- package/lib/src/owlly/controller/tile-panorama-controller.js +4 -0
- package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -1
- package/lib/src/owlly/element/tile-panorama.d.ts +1 -0
- package/lib/src/owlly/element/tile-panorama.js +16 -3
- package/lib/src/owlly/element/tile-panorama.js.map +1 -1
- package/lib/src/owlly/element/tile-plane.d.ts +9 -0
- package/lib/src/owlly/element/tile-plane.js +27 -0
- package/lib/src/owlly/element/tile-plane.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay.js.map +1 -1
- package/lib/src/owlly/stage/owlly.js +7 -1
- package/lib/src/owlly/stage/owlly.js.map +1 -1
- package/lib/src/owlly/stage/stage.js +2 -0
- package/lib/src/owlly/stage/stage.js.map +1 -1
- package/lib/src/web/main.rpeng.mes.plane.js.map +1 -1
- package/package.json +16 -7
- package/src/owlly/controller/texture-controller.ts +18 -1
- package/src/owlly/controller/tile-panorama-controller.ts +3 -1
- package/src/owlly/element/tile-panorama.ts +14 -0
- package/src/owlly/element/tile-plane.ts +26 -0
- package/src/owlly/overlay/poi-overlay-3d.ts +0 -4
- package/src/owlly/overlay/poi-overlay.ts +0 -4
- package/src/owlly/stage/owlly.ts +6 -1
- package/src/owlly/stage/stage.ts +2 -0
- package/src/web/main.rpeng.mes.plane.ts +0 -6
|
@@ -0,0 +1,1112 @@
|
|
|
1
|
+
/* eslint-disable max-len, no-continue, @typescript-eslint/no-explicit-any, no-underscore-dangle, func-names, @typescript-eslint/no-this-alias, no-console */
|
|
2
|
+
import { Externals, NS_THREE } from '../owlly/stage/externals';
|
|
3
|
+
class TransformControlsGizmo extends NS_THREE.Object3D {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.isTransformControlsGizmo = true;
|
|
7
|
+
this.type = 'TransformControlsGizmo';
|
|
8
|
+
const { THREE } = Externals.getInstance();
|
|
9
|
+
// shared materials
|
|
10
|
+
const gizmoMaterial = new THREE.MeshBasicMaterial({
|
|
11
|
+
depthTest: false,
|
|
12
|
+
depthWrite: false,
|
|
13
|
+
transparent: true,
|
|
14
|
+
side: THREE.DoubleSide,
|
|
15
|
+
fog: false,
|
|
16
|
+
toneMapped: false,
|
|
17
|
+
});
|
|
18
|
+
const gizmoLineMaterial = new THREE.LineBasicMaterial({
|
|
19
|
+
depthTest: false,
|
|
20
|
+
depthWrite: false,
|
|
21
|
+
transparent: true,
|
|
22
|
+
linewidth: 1,
|
|
23
|
+
fog: false,
|
|
24
|
+
toneMapped: false,
|
|
25
|
+
});
|
|
26
|
+
// Make unique material for each axis/color
|
|
27
|
+
const matInvisible = gizmoMaterial.clone();
|
|
28
|
+
matInvisible.opacity = 0.15;
|
|
29
|
+
const matHelper = gizmoMaterial.clone();
|
|
30
|
+
matHelper.opacity = 0.33;
|
|
31
|
+
const matRed = gizmoMaterial.clone();
|
|
32
|
+
matRed.color.set(0xff0000);
|
|
33
|
+
const matGreen = gizmoMaterial.clone();
|
|
34
|
+
matGreen.color.set(0x00ff00);
|
|
35
|
+
const matBlue = gizmoMaterial.clone();
|
|
36
|
+
matBlue.color.set(0x0000ff);
|
|
37
|
+
const matWhiteTransparent = gizmoMaterial.clone();
|
|
38
|
+
matWhiteTransparent.opacity = 0.25;
|
|
39
|
+
const matYellowTransparent = matWhiteTransparent.clone();
|
|
40
|
+
matYellowTransparent.color.set(0xffff00);
|
|
41
|
+
const matCyanTransparent = matWhiteTransparent.clone();
|
|
42
|
+
matCyanTransparent.color.set(0x00ffff);
|
|
43
|
+
const matMagentaTransparent = matWhiteTransparent.clone();
|
|
44
|
+
matMagentaTransparent.color.set(0xff00ff);
|
|
45
|
+
const matYellow = gizmoMaterial.clone();
|
|
46
|
+
matYellow.color.set(0xffff00);
|
|
47
|
+
const matLineRed = gizmoLineMaterial.clone();
|
|
48
|
+
matLineRed.color.set(0xff0000);
|
|
49
|
+
const matLineGreen = gizmoLineMaterial.clone();
|
|
50
|
+
matLineGreen.color.set(0x00ff00);
|
|
51
|
+
const matLineBlue = gizmoLineMaterial.clone();
|
|
52
|
+
matLineBlue.color.set(0x0000ff);
|
|
53
|
+
const matLineCyan = gizmoLineMaterial.clone();
|
|
54
|
+
matLineCyan.color.set(0x00ffff);
|
|
55
|
+
const matLineMagenta = gizmoLineMaterial.clone();
|
|
56
|
+
matLineMagenta.color.set(0xff00ff);
|
|
57
|
+
const matLineYellow = gizmoLineMaterial.clone();
|
|
58
|
+
matLineYellow.color.set(0xffff00);
|
|
59
|
+
const matLineGray = gizmoLineMaterial.clone();
|
|
60
|
+
matLineGray.color.set(0x787878);
|
|
61
|
+
const matLineYellowTransparent = matLineYellow.clone();
|
|
62
|
+
matLineYellowTransparent.opacity = 0.25;
|
|
63
|
+
// reusable geometry
|
|
64
|
+
const arrowGeometry = new THREE.CylinderGeometry(0, 0.05, 0.2, 12, 1, false);
|
|
65
|
+
const scaleHandleGeometry = new THREE.BoxGeometry(0.125, 0.125, 0.125);
|
|
66
|
+
const lineGeometry = new THREE.BufferGeometry();
|
|
67
|
+
lineGeometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
|
|
68
|
+
const CircleGeometry = function (radius, arc) {
|
|
69
|
+
const geometry = new THREE.BufferGeometry();
|
|
70
|
+
const vertices = [];
|
|
71
|
+
for (let i = 0; i <= 64 * arc; ++i) {
|
|
72
|
+
vertices.push(0, Math.cos(i / 32 * Math.PI) * radius, Math.sin(i / 32 * Math.PI) * radius);
|
|
73
|
+
}
|
|
74
|
+
geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
|
|
75
|
+
return geometry;
|
|
76
|
+
};
|
|
77
|
+
// Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
|
|
78
|
+
const TranslateHelperGeometry = function () {
|
|
79
|
+
const geometry = new THREE.BufferGeometry();
|
|
80
|
+
geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
|
|
81
|
+
return geometry;
|
|
82
|
+
};
|
|
83
|
+
// Gizmo definitions - custom hierarchy definitions for setupGizmo() function
|
|
84
|
+
const gizmoTranslate = {
|
|
85
|
+
X: [
|
|
86
|
+
[new THREE.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, -Math.PI / 2], null, 'fwd'],
|
|
87
|
+
[new THREE.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, Math.PI / 2], null, 'bwd'],
|
|
88
|
+
[new THREE.Line(lineGeometry, matLineRed)],
|
|
89
|
+
],
|
|
90
|
+
Y: [
|
|
91
|
+
[new THREE.Mesh(arrowGeometry, matGreen), [0, 1, 0], null, null, 'fwd'],
|
|
92
|
+
[new THREE.Mesh(arrowGeometry, matGreen), [0, 1, 0], [Math.PI, 0, 0], null, 'bwd'],
|
|
93
|
+
[new THREE.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2]],
|
|
94
|
+
],
|
|
95
|
+
Z: [
|
|
96
|
+
[new THREE.Mesh(arrowGeometry, matBlue), [0, 0, 1], [Math.PI / 2, 0, 0], null, 'fwd'],
|
|
97
|
+
[new THREE.Mesh(arrowGeometry, matBlue), [0, 0, 1], [-Math.PI / 2, 0, 0], null, 'bwd'],
|
|
98
|
+
[new THREE.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0]],
|
|
99
|
+
],
|
|
100
|
+
XYZ: [
|
|
101
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.1, 0), matWhiteTransparent.clone()), [0, 0, 0], [0, 0, 0]],
|
|
102
|
+
],
|
|
103
|
+
XY: [
|
|
104
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matYellowTransparent.clone()), [0.15, 0.15, 0]],
|
|
105
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.18, 0.3, 0], null, [0.125, 1, 1]],
|
|
106
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
107
|
+
],
|
|
108
|
+
YZ: [
|
|
109
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matCyanTransparent.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]],
|
|
110
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
111
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
112
|
+
],
|
|
113
|
+
XZ: [
|
|
114
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matMagentaTransparent.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]],
|
|
115
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.18, 0, 0.3], null, [0.125, 1, 1]],
|
|
116
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
const pickerTranslate = {
|
|
120
|
+
X: [
|
|
121
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0.6, 0, 0], [0, 0, -Math.PI / 2]],
|
|
122
|
+
],
|
|
123
|
+
Y: [
|
|
124
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0.6, 0]],
|
|
125
|
+
],
|
|
126
|
+
Z: [
|
|
127
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0, 0.6], [Math.PI / 2, 0, 0]],
|
|
128
|
+
],
|
|
129
|
+
XYZ: [
|
|
130
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.2, 0), matInvisible)],
|
|
131
|
+
],
|
|
132
|
+
XY: [
|
|
133
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0.2, 0]],
|
|
134
|
+
],
|
|
135
|
+
YZ: [
|
|
136
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0, 0.2, 0.2], [0, Math.PI / 2, 0]],
|
|
137
|
+
],
|
|
138
|
+
XZ: [
|
|
139
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]],
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
const helperTranslate = {
|
|
143
|
+
START: [
|
|
144
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.01, 2), matHelper), null, null, null, 'helper'],
|
|
145
|
+
],
|
|
146
|
+
END: [
|
|
147
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.01, 2), matHelper), null, null, null, 'helper'],
|
|
148
|
+
],
|
|
149
|
+
DELTA: [
|
|
150
|
+
[new THREE.Line(TranslateHelperGeometry(), matHelper), null, null, null, 'helper'],
|
|
151
|
+
],
|
|
152
|
+
X: [
|
|
153
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
|
|
154
|
+
],
|
|
155
|
+
Y: [
|
|
156
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], 'helper'],
|
|
157
|
+
],
|
|
158
|
+
Z: [
|
|
159
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], 'helper'],
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
const gizmoRotate = {
|
|
163
|
+
X: [
|
|
164
|
+
[new THREE.Line(CircleGeometry(1, 0.5), matLineRed)],
|
|
165
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matRed), [0, 0, 0.99], null, [1, 3, 1]],
|
|
166
|
+
],
|
|
167
|
+
Y: [
|
|
168
|
+
[new THREE.Line(CircleGeometry(1, 0.5), matLineGreen), null, [0, 0, -Math.PI / 2]],
|
|
169
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matGreen), [0, 0, 0.99], null, [3, 1, 1]],
|
|
170
|
+
],
|
|
171
|
+
Z: [
|
|
172
|
+
[new THREE.Line(CircleGeometry(1, 0.5), matLineBlue), null, [0, Math.PI / 2, 0]],
|
|
173
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matBlue), [0.99, 0, 0], null, [1, 3, 1]],
|
|
174
|
+
],
|
|
175
|
+
E: [
|
|
176
|
+
[new THREE.Line(CircleGeometry(1.25, 1), matLineYellowTransparent), null, [0, Math.PI / 2, 0]],
|
|
177
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 0.001]],
|
|
178
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 0.001]],
|
|
179
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 0.001]],
|
|
180
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [0, 1.17, 0], [0, 0, 0], [1, 1, 0.001]],
|
|
181
|
+
],
|
|
182
|
+
XYZE: [
|
|
183
|
+
[new THREE.Line(CircleGeometry(1, 1), matLineGray), null, [0, Math.PI / 2, 0]],
|
|
184
|
+
],
|
|
185
|
+
};
|
|
186
|
+
const helperRotate = {
|
|
187
|
+
AXIS: [
|
|
188
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
|
|
189
|
+
],
|
|
190
|
+
};
|
|
191
|
+
const pickerRotate = {
|
|
192
|
+
X: [
|
|
193
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]],
|
|
194
|
+
],
|
|
195
|
+
Y: [
|
|
196
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
197
|
+
],
|
|
198
|
+
Z: [
|
|
199
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
200
|
+
],
|
|
201
|
+
E: [
|
|
202
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1.25, 0.1, 2, 24), matInvisible)],
|
|
203
|
+
],
|
|
204
|
+
XYZE: [
|
|
205
|
+
[new THREE.Mesh(new THREE.SphereGeometry(0.7, 10, 8), matInvisible)],
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
const gizmoScale = {
|
|
209
|
+
X: [
|
|
210
|
+
[new THREE.Mesh(scaleHandleGeometry, matRed), [0.8, 0, 0], [0, 0, -Math.PI / 2]],
|
|
211
|
+
[new THREE.Line(lineGeometry, matLineRed), null, null, [0.8, 1, 1]],
|
|
212
|
+
],
|
|
213
|
+
Y: [
|
|
214
|
+
[new THREE.Mesh(scaleHandleGeometry, matGreen), [0, 0.8, 0]],
|
|
215
|
+
[new THREE.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2], [0.8, 1, 1]],
|
|
216
|
+
],
|
|
217
|
+
Z: [
|
|
218
|
+
[new THREE.Mesh(scaleHandleGeometry, matBlue), [0, 0, 0.8], [Math.PI / 2, 0, 0]],
|
|
219
|
+
[new THREE.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]],
|
|
220
|
+
],
|
|
221
|
+
XY: [
|
|
222
|
+
[new THREE.Mesh(scaleHandleGeometry, matYellowTransparent), [0.85, 0.85, 0], null, [2, 2, 0.2]],
|
|
223
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.855, 0.98, 0], null, [0.125, 1, 1]],
|
|
224
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
225
|
+
],
|
|
226
|
+
YZ: [
|
|
227
|
+
[new THREE.Mesh(scaleHandleGeometry, matCyanTransparent), [0, 0.85, 0.85], null, [0.2, 2, 2]],
|
|
228
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
229
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
230
|
+
],
|
|
231
|
+
XZ: [
|
|
232
|
+
[new THREE.Mesh(scaleHandleGeometry, matMagentaTransparent), [0.85, 0, 0.85], null, [2, 0.2, 2]],
|
|
233
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.855, 0, 0.98], null, [0.125, 1, 1]],
|
|
234
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
235
|
+
],
|
|
236
|
+
XYZX: [
|
|
237
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [1.1, 0, 0]],
|
|
238
|
+
],
|
|
239
|
+
XYZY: [
|
|
240
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 1.1, 0]],
|
|
241
|
+
],
|
|
242
|
+
XYZZ: [
|
|
243
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 0, 1.1]],
|
|
244
|
+
],
|
|
245
|
+
};
|
|
246
|
+
const pickerScale = {
|
|
247
|
+
X: [
|
|
248
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
249
|
+
],
|
|
250
|
+
Y: [
|
|
251
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0.5, 0]],
|
|
252
|
+
],
|
|
253
|
+
Z: [
|
|
254
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
255
|
+
],
|
|
256
|
+
XY: [
|
|
257
|
+
[new THREE.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0.85, 0], null, [3, 3, 0.2]],
|
|
258
|
+
],
|
|
259
|
+
YZ: [
|
|
260
|
+
[new THREE.Mesh(scaleHandleGeometry, matInvisible), [0, 0.85, 0.85], null, [0.2, 3, 3]],
|
|
261
|
+
],
|
|
262
|
+
XZ: [
|
|
263
|
+
[new THREE.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0, 0.85], null, [3, 0.2, 3]],
|
|
264
|
+
],
|
|
265
|
+
XYZX: [
|
|
266
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [1.1, 0, 0]],
|
|
267
|
+
],
|
|
268
|
+
XYZY: [
|
|
269
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 1.1, 0]],
|
|
270
|
+
],
|
|
271
|
+
XYZZ: [
|
|
272
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0, 1.1]],
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
const helperScale = {
|
|
276
|
+
X: [
|
|
277
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
|
|
278
|
+
],
|
|
279
|
+
Y: [
|
|
280
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], 'helper'],
|
|
281
|
+
],
|
|
282
|
+
Z: [
|
|
283
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], 'helper'],
|
|
284
|
+
],
|
|
285
|
+
};
|
|
286
|
+
// Creates an Object3D with gizmos described in custom hierarchy definition.
|
|
287
|
+
const setupGizmo = function (gizmoMap) {
|
|
288
|
+
const gizmo = new THREE.Object3D();
|
|
289
|
+
/* eslint-disable guard-for-in, no-restricted-syntax */
|
|
290
|
+
for (const name in gizmoMap) {
|
|
291
|
+
for (let i = gizmoMap[name].length; i--;) {
|
|
292
|
+
const object = gizmoMap[name][i][0].clone();
|
|
293
|
+
const position = gizmoMap[name][i][1];
|
|
294
|
+
const rotation = gizmoMap[name][i][2];
|
|
295
|
+
const scale = gizmoMap[name][i][3];
|
|
296
|
+
const tag = gizmoMap[name][i][4];
|
|
297
|
+
// name and tag properties are essential for picking and updating logic.
|
|
298
|
+
object.name = name;
|
|
299
|
+
object.tag = tag;
|
|
300
|
+
if (position) {
|
|
301
|
+
object.position.set(position[0], position[1], position[2]);
|
|
302
|
+
}
|
|
303
|
+
if (rotation) {
|
|
304
|
+
object.rotation.set(rotation[0], rotation[1], rotation[2]);
|
|
305
|
+
}
|
|
306
|
+
if (scale) {
|
|
307
|
+
object.scale.set(scale[0], scale[1], scale[2]);
|
|
308
|
+
}
|
|
309
|
+
object.updateMatrix();
|
|
310
|
+
const tempGeometry = object.geometry.clone();
|
|
311
|
+
tempGeometry.applyMatrix4(object.matrix);
|
|
312
|
+
object.geometry = tempGeometry;
|
|
313
|
+
object.renderOrder = Infinity;
|
|
314
|
+
object.position.set(0, 0, 0);
|
|
315
|
+
object.rotation.set(0, 0, 0);
|
|
316
|
+
object.scale.set(1, 1, 1);
|
|
317
|
+
gizmo.add(object);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return gizmo;
|
|
321
|
+
};
|
|
322
|
+
// Reusable utility variables
|
|
323
|
+
const tempVector = new THREE.Vector3(0, 0, 0);
|
|
324
|
+
const tempEuler = new THREE.Euler();
|
|
325
|
+
const alignVector = new THREE.Vector3(0, 1, 0);
|
|
326
|
+
const zeroVector = new THREE.Vector3(0, 0, 0);
|
|
327
|
+
const lookAtMatrix = new THREE.Matrix4();
|
|
328
|
+
const tempQuaternion = new THREE.Quaternion();
|
|
329
|
+
const tempQuaternion2 = new THREE.Quaternion();
|
|
330
|
+
const identityQuaternion = new THREE.Quaternion();
|
|
331
|
+
const unitX = new THREE.Vector3(1, 0, 0);
|
|
332
|
+
const unitY = new THREE.Vector3(0, 1, 0);
|
|
333
|
+
const unitZ = new THREE.Vector3(0, 0, 1);
|
|
334
|
+
// Gizmo creation
|
|
335
|
+
this.gizmo = {};
|
|
336
|
+
this.picker = {};
|
|
337
|
+
this.helper = {};
|
|
338
|
+
this.add(this.gizmo.translate = setupGizmo(gizmoTranslate));
|
|
339
|
+
this.add(this.gizmo.rotate = setupGizmo(gizmoRotate));
|
|
340
|
+
this.add(this.gizmo.scale = setupGizmo(gizmoScale));
|
|
341
|
+
this.add(this.picker.translate = setupGizmo(pickerTranslate));
|
|
342
|
+
this.add(this.picker.rotate = setupGizmo(pickerRotate));
|
|
343
|
+
this.add(this.picker.scale = setupGizmo(pickerScale));
|
|
344
|
+
this.add(this.helper.translate = setupGizmo(helperTranslate));
|
|
345
|
+
this.add(this.helper.rotate = setupGizmo(helperRotate));
|
|
346
|
+
this.add(this.helper.scale = setupGizmo(helperScale));
|
|
347
|
+
// Pickers should be hidden always
|
|
348
|
+
this.picker.translate.visible = false;
|
|
349
|
+
this.picker.rotate.visible = false;
|
|
350
|
+
this.picker.scale.visible = false;
|
|
351
|
+
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
352
|
+
this.updateMatrixWorld = function () {
|
|
353
|
+
let { space } = this;
|
|
354
|
+
if (this.mode === 'scale')
|
|
355
|
+
space = 'local'; // scale always oriented to local rotation
|
|
356
|
+
const quaternion = space === 'local' ? this.worldQuaternion : identityQuaternion;
|
|
357
|
+
// Show only gizmos for current transform mode
|
|
358
|
+
this.gizmo.translate.visible = this.mode === 'translate';
|
|
359
|
+
this.gizmo.rotate.visible = this.mode === 'rotate';
|
|
360
|
+
this.gizmo.scale.visible = this.mode === 'scale';
|
|
361
|
+
this.helper.translate.visible = this.mode === 'translate';
|
|
362
|
+
this.helper.rotate.visible = this.mode === 'rotate';
|
|
363
|
+
this.helper.scale.visible = this.mode === 'scale';
|
|
364
|
+
let handles = [];
|
|
365
|
+
handles = handles.concat(this.picker[this.mode].children);
|
|
366
|
+
handles = handles.concat(this.gizmo[this.mode].children);
|
|
367
|
+
handles = handles.concat(this.helper[this.mode].children);
|
|
368
|
+
for (let i = 0; i < handles.length; i++) {
|
|
369
|
+
const handle = handles[i];
|
|
370
|
+
// hide aligned to camera
|
|
371
|
+
handle.visible = true;
|
|
372
|
+
handle.rotation.set(0, 0, 0);
|
|
373
|
+
handle.position.copy(this.worldPosition);
|
|
374
|
+
let factor;
|
|
375
|
+
if (this.camera.isOrthographicCamera) {
|
|
376
|
+
const camera = this.camera;
|
|
377
|
+
factor = (camera.top - camera.bottom) / camera.zoom;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
const camera = this.camera;
|
|
381
|
+
factor = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * camera.fov / 360) / camera.zoom, 7);
|
|
382
|
+
}
|
|
383
|
+
handle.scale.set(1, 1, 1).multiplyScalar(factor * this.size / 7);
|
|
384
|
+
// TODO: simplify helpers and consider decoupling from gizmo
|
|
385
|
+
if (handle.tag === 'helper') {
|
|
386
|
+
handle.visible = false;
|
|
387
|
+
if (handle.name === 'AXIS') {
|
|
388
|
+
handle.position.copy(this.worldPositionStart);
|
|
389
|
+
handle.visible = !!this.axis;
|
|
390
|
+
if (this.axis === 'X') {
|
|
391
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, 0, 0));
|
|
392
|
+
handle.quaternion.copy(quaternion).multiply(tempQuaternion);
|
|
393
|
+
if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
|
394
|
+
handle.visible = false;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (this.axis === 'Y') {
|
|
398
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, 0, Math.PI / 2));
|
|
399
|
+
handle.quaternion.copy(quaternion).multiply(tempQuaternion);
|
|
400
|
+
if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
|
401
|
+
handle.visible = false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (this.axis === 'Z') {
|
|
405
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, Math.PI / 2, 0));
|
|
406
|
+
handle.quaternion.copy(quaternion).multiply(tempQuaternion);
|
|
407
|
+
if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
|
408
|
+
handle.visible = false;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (this.axis === 'XYZE') {
|
|
412
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, Math.PI / 2, 0));
|
|
413
|
+
alignVector.copy(this.rotationAxis);
|
|
414
|
+
handle.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(zeroVector, alignVector, unitY));
|
|
415
|
+
handle.quaternion.multiply(tempQuaternion);
|
|
416
|
+
handle.visible = this.dragging;
|
|
417
|
+
}
|
|
418
|
+
if (this.axis === 'E') {
|
|
419
|
+
handle.visible = false;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
else if (handle.name === 'START') {
|
|
423
|
+
handle.position.copy(this.worldPositionStart);
|
|
424
|
+
handle.visible = this.dragging;
|
|
425
|
+
}
|
|
426
|
+
else if (handle.name === 'END') {
|
|
427
|
+
handle.position.copy(this.worldPosition);
|
|
428
|
+
handle.visible = this.dragging;
|
|
429
|
+
}
|
|
430
|
+
else if (handle.name === 'DELTA') {
|
|
431
|
+
handle.position.copy(this.worldPositionStart);
|
|
432
|
+
handle.quaternion.copy(this.worldQuaternionStart);
|
|
433
|
+
tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1);
|
|
434
|
+
tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert());
|
|
435
|
+
handle.scale.copy(tempVector);
|
|
436
|
+
handle.visible = this.dragging;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
handle.quaternion.copy(quaternion);
|
|
440
|
+
if (this.dragging) {
|
|
441
|
+
handle.position.copy(this.worldPositionStart);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
handle.position.copy(this.worldPosition);
|
|
445
|
+
}
|
|
446
|
+
if (this.axis) {
|
|
447
|
+
handle.visible = this.axis.search(handle.name) !== -1;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// If updating helper, skip rest of the loop
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
// Align handles to current local or world rotation
|
|
454
|
+
handle.quaternion.copy(quaternion);
|
|
455
|
+
if (this.mode === 'translate' || this.mode === 'scale') {
|
|
456
|
+
// Hide translate and scale axis facing the camera
|
|
457
|
+
const AXIS_HIDE_TRESHOLD = 0.99;
|
|
458
|
+
const PLANE_HIDE_TRESHOLD = 0.2;
|
|
459
|
+
const AXIS_FLIP_TRESHOLD = 0.0;
|
|
460
|
+
if (handle.name === 'X' || handle.name === 'XYZX') {
|
|
461
|
+
if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
|
462
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
463
|
+
handle.visible = false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (handle.name === 'Y' || handle.name === 'XYZY') {
|
|
467
|
+
if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
|
468
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
469
|
+
handle.visible = false;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if (handle.name === 'Z' || handle.name === 'XYZZ') {
|
|
473
|
+
if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
|
474
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
475
|
+
handle.visible = false;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (handle.name === 'XY') {
|
|
479
|
+
if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
|
480
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
481
|
+
handle.visible = false;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (handle.name === 'YZ') {
|
|
485
|
+
if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
|
486
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
487
|
+
handle.visible = false;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (handle.name === 'XZ') {
|
|
491
|
+
if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
|
492
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
493
|
+
handle.visible = false;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// Flip translate and scale axis ocluded behind another axis
|
|
497
|
+
if (handle.name.search('X') !== -1) {
|
|
498
|
+
if (alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
|
499
|
+
if (handle.tag === 'fwd') {
|
|
500
|
+
handle.visible = false;
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
handle.scale.x *= -1;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
else if (handle.tag === 'bwd') {
|
|
507
|
+
handle.visible = false;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if (handle.name.search('Y') !== -1) {
|
|
511
|
+
if (alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
|
512
|
+
if (handle.tag === 'fwd') {
|
|
513
|
+
handle.visible = false;
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
handle.scale.y *= -1;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
else if (handle.tag === 'bwd') {
|
|
520
|
+
handle.visible = false;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (handle.name.search('Z') !== -1) {
|
|
524
|
+
if (alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
|
525
|
+
if (handle.tag === 'fwd') {
|
|
526
|
+
handle.visible = false;
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
handle.scale.z *= -1;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else if (handle.tag === 'bwd') {
|
|
533
|
+
handle.visible = false;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
else if (this.mode === 'rotate') {
|
|
538
|
+
// Align handles to current local or world rotation
|
|
539
|
+
tempQuaternion2.copy(quaternion);
|
|
540
|
+
alignVector.copy(this.eye).applyQuaternion(tempQuaternion.copy(quaternion).invert());
|
|
541
|
+
if (handle.name.search('E') !== -1) {
|
|
542
|
+
handle.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(this.eye, zeroVector, unitY));
|
|
543
|
+
}
|
|
544
|
+
if (handle.name === 'X') {
|
|
545
|
+
tempQuaternion.setFromAxisAngle(unitX, Math.atan2(-alignVector.y, alignVector.z));
|
|
546
|
+
tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
|
|
547
|
+
handle.quaternion.copy(tempQuaternion);
|
|
548
|
+
}
|
|
549
|
+
if (handle.name === 'Y') {
|
|
550
|
+
tempQuaternion.setFromAxisAngle(unitY, Math.atan2(alignVector.x, alignVector.z));
|
|
551
|
+
tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
|
|
552
|
+
handle.quaternion.copy(tempQuaternion);
|
|
553
|
+
}
|
|
554
|
+
if (handle.name === 'Z') {
|
|
555
|
+
tempQuaternion.setFromAxisAngle(unitZ, Math.atan2(alignVector.y, alignVector.x));
|
|
556
|
+
tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
|
|
557
|
+
handle.quaternion.copy(tempQuaternion);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
// Hide disabled axes
|
|
561
|
+
handle.visible = handle.visible && (handle.name.indexOf('X') === -1 || this.showX);
|
|
562
|
+
handle.visible = handle.visible && (handle.name.indexOf('Y') === -1 || this.showY);
|
|
563
|
+
handle.visible = handle.visible && (handle.name.indexOf('Z') === -1 || this.showZ);
|
|
564
|
+
handle.visible = handle.visible && (handle.name.indexOf('E') === -1 || (this.showX && this.showY && this.showZ));
|
|
565
|
+
// highlight selected axis
|
|
566
|
+
handle.material._opacity = handle.material._opacity || handle.material.opacity;
|
|
567
|
+
handle.material._color = handle.material._color || handle.material.color.clone();
|
|
568
|
+
handle.material.color.copy(handle.material._color);
|
|
569
|
+
handle.material.opacity = handle.material._opacity;
|
|
570
|
+
if (!this.enabled) {
|
|
571
|
+
handle.material.opacity *= 0.5;
|
|
572
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
573
|
+
}
|
|
574
|
+
else if (this.axis) {
|
|
575
|
+
if (handle.name === this.axis) {
|
|
576
|
+
handle.material.opacity = 1.0;
|
|
577
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
578
|
+
}
|
|
579
|
+
else if (this.axis.split('').some((a) => handle.name === a)) {
|
|
580
|
+
handle.material.opacity = 1.0;
|
|
581
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
handle.material.opacity *= 0.25;
|
|
585
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
THREE.Object3D.prototype.updateMatrixWorld.call(this);
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
class TransformControlsPlane extends NS_THREE.Mesh {
|
|
594
|
+
constructor() {
|
|
595
|
+
super(new (Externals.getInstance().THREE).PlaneGeometry(100000, 100000, 2, 2), new (Externals.getInstance().THREE).MeshBasicMaterial({
|
|
596
|
+
visible: false, wireframe: true, side: (Externals.getInstance().THREE).DoubleSide, transparent: true, opacity: 0.1, toneMapped: false,
|
|
597
|
+
}));
|
|
598
|
+
this.isTransformControlsPlane = true;
|
|
599
|
+
const { THREE } = Externals.getInstance();
|
|
600
|
+
const unitX = new THREE.Vector3(1, 0, 0);
|
|
601
|
+
const unitY = new THREE.Vector3(0, 1, 0);
|
|
602
|
+
const unitZ = new THREE.Vector3(0, 0, 1);
|
|
603
|
+
const tempVector = new THREE.Vector3();
|
|
604
|
+
const dirVector = new THREE.Vector3();
|
|
605
|
+
const alignVector = new THREE.Vector3();
|
|
606
|
+
const tempMatrix = new THREE.Matrix4();
|
|
607
|
+
const identityQuaternion = new THREE.Quaternion();
|
|
608
|
+
this.updateMatrixWorld = function () {
|
|
609
|
+
let { space } = this;
|
|
610
|
+
this.position.copy(this.worldPosition);
|
|
611
|
+
if (this.mode === 'scale')
|
|
612
|
+
space = 'local'; // scale always oriented to local rotation
|
|
613
|
+
unitX.set(1, 0, 0).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
|
|
614
|
+
unitY.set(0, 1, 0).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
|
|
615
|
+
unitZ.set(0, 0, 1).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
|
|
616
|
+
// Align the plane for current transform mode, axis and space.
|
|
617
|
+
alignVector.copy(unitY);
|
|
618
|
+
switch (this.mode) {
|
|
619
|
+
case 'translate':
|
|
620
|
+
case 'scale':
|
|
621
|
+
switch (this.axis) {
|
|
622
|
+
case 'X':
|
|
623
|
+
alignVector.copy(this.eye).cross(unitX);
|
|
624
|
+
dirVector.copy(unitX).cross(alignVector);
|
|
625
|
+
break;
|
|
626
|
+
case 'Y':
|
|
627
|
+
alignVector.copy(this.eye).cross(unitY);
|
|
628
|
+
dirVector.copy(unitY).cross(alignVector);
|
|
629
|
+
break;
|
|
630
|
+
case 'Z':
|
|
631
|
+
alignVector.copy(this.eye).cross(unitZ);
|
|
632
|
+
dirVector.copy(unitZ).cross(alignVector);
|
|
633
|
+
break;
|
|
634
|
+
case 'XY':
|
|
635
|
+
dirVector.copy(unitZ);
|
|
636
|
+
break;
|
|
637
|
+
case 'YZ':
|
|
638
|
+
dirVector.copy(unitX);
|
|
639
|
+
break;
|
|
640
|
+
case 'XZ':
|
|
641
|
+
alignVector.copy(unitZ);
|
|
642
|
+
dirVector.copy(unitY);
|
|
643
|
+
break;
|
|
644
|
+
case 'XYZ':
|
|
645
|
+
case 'E':
|
|
646
|
+
dirVector.set(0, 0, 0);
|
|
647
|
+
break;
|
|
648
|
+
default:
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
break;
|
|
652
|
+
case 'rotate':
|
|
653
|
+
default:
|
|
654
|
+
// special case for rotate
|
|
655
|
+
dirVector.set(0, 0, 0);
|
|
656
|
+
}
|
|
657
|
+
if (dirVector.length() === 0) {
|
|
658
|
+
// If in rotate mode, make the plane parallel to camera
|
|
659
|
+
this.quaternion.copy(this.cameraQuaternion);
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
tempMatrix.lookAt(tempVector.set(0, 0, 0), dirVector, alignVector);
|
|
663
|
+
this.quaternion.setFromRotationMatrix(tempMatrix);
|
|
664
|
+
}
|
|
665
|
+
THREE.Object3D.prototype.updateMatrixWorld.call(this);
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
class TransformControls extends NS_THREE.Object3D {
|
|
670
|
+
constructor(camera, domElement) {
|
|
671
|
+
super();
|
|
672
|
+
if (domElement === undefined) {
|
|
673
|
+
console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.');
|
|
674
|
+
domElement = document; // eslint-disable-line no-param-reassign
|
|
675
|
+
}
|
|
676
|
+
this.visible = false;
|
|
677
|
+
this.domElement = domElement;
|
|
678
|
+
const _gizmo = new TransformControlsGizmo();
|
|
679
|
+
this.add(_gizmo);
|
|
680
|
+
const _plane = new TransformControlsPlane();
|
|
681
|
+
this.add(_plane);
|
|
682
|
+
const scope = this;
|
|
683
|
+
const changeEvent = { type: 'change' };
|
|
684
|
+
const mouseDownEvent = { type: 'mouseDown' };
|
|
685
|
+
const mouseUpEvent = { type: 'mouseUp', mode: scope.mode };
|
|
686
|
+
const objectChangeEvent = { type: 'objectChange' };
|
|
687
|
+
// Defined getter, setter and store for a property
|
|
688
|
+
function defineProperty(propName, defaultValue) {
|
|
689
|
+
let propValue = defaultValue;
|
|
690
|
+
Object.defineProperty(scope, propName, {
|
|
691
|
+
get() {
|
|
692
|
+
return propValue !== undefined ? propValue : defaultValue;
|
|
693
|
+
},
|
|
694
|
+
set(value) {
|
|
695
|
+
if (propValue !== value) {
|
|
696
|
+
propValue = value;
|
|
697
|
+
_plane[propName] = value;
|
|
698
|
+
_gizmo[propName] = value;
|
|
699
|
+
scope.dispatchEvent({ type: `${propName}-changed`, value });
|
|
700
|
+
scope.dispatchEvent(changeEvent);
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
});
|
|
704
|
+
scope[propName] = defaultValue;
|
|
705
|
+
_plane[propName] = defaultValue;
|
|
706
|
+
_gizmo[propName] = defaultValue;
|
|
707
|
+
}
|
|
708
|
+
const { THREE } = Externals.getInstance();
|
|
709
|
+
// Define properties with getters/setter
|
|
710
|
+
// Setting the defined property will automatically trigger change event
|
|
711
|
+
// Defined properties are passed down to gizmo and plane
|
|
712
|
+
defineProperty('camera', camera);
|
|
713
|
+
defineProperty('object', undefined);
|
|
714
|
+
defineProperty('enabled', true);
|
|
715
|
+
defineProperty('axis', null);
|
|
716
|
+
defineProperty('mode', 'translate');
|
|
717
|
+
defineProperty('translationSnap', null);
|
|
718
|
+
defineProperty('rotationSnap', null);
|
|
719
|
+
defineProperty('scaleSnap', null);
|
|
720
|
+
defineProperty('space', 'world');
|
|
721
|
+
defineProperty('size', 1);
|
|
722
|
+
defineProperty('dragging', false);
|
|
723
|
+
defineProperty('showX', true);
|
|
724
|
+
defineProperty('showY', true);
|
|
725
|
+
defineProperty('showZ', true);
|
|
726
|
+
// Reusable utility variables
|
|
727
|
+
function intersectObjectWithRay(object, raycaster, includeInvisible) {
|
|
728
|
+
const allIntersections = raycaster.intersectObject(object, true);
|
|
729
|
+
for (let i = 0; i < allIntersections.length; i++) {
|
|
730
|
+
if (allIntersections[i].object.visible || includeInvisible) {
|
|
731
|
+
return allIntersections[i];
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
const raycaster = new THREE.Raycaster();
|
|
737
|
+
const _tempVector = new THREE.Vector3();
|
|
738
|
+
const _tempVector2 = new THREE.Vector3();
|
|
739
|
+
const _tempQuaternion = new THREE.Quaternion();
|
|
740
|
+
const _unit = {
|
|
741
|
+
X: new THREE.Vector3(1, 0, 0),
|
|
742
|
+
Y: new THREE.Vector3(0, 1, 0),
|
|
743
|
+
Z: new THREE.Vector3(0, 0, 1),
|
|
744
|
+
};
|
|
745
|
+
const pointStart = new THREE.Vector3();
|
|
746
|
+
const pointEnd = new THREE.Vector3();
|
|
747
|
+
const offset = new THREE.Vector3();
|
|
748
|
+
const rotationAxis = new THREE.Vector3();
|
|
749
|
+
const startNorm = new THREE.Vector3();
|
|
750
|
+
const endNorm = new THREE.Vector3();
|
|
751
|
+
let rotationAngle = 0;
|
|
752
|
+
const cameraPosition = new THREE.Vector3();
|
|
753
|
+
const cameraQuaternion = new THREE.Quaternion();
|
|
754
|
+
const cameraScale = new THREE.Vector3();
|
|
755
|
+
const parentPosition = new THREE.Vector3();
|
|
756
|
+
const parentQuaternion = new THREE.Quaternion();
|
|
757
|
+
const parentQuaternionInv = new THREE.Quaternion();
|
|
758
|
+
const parentScale = new THREE.Vector3();
|
|
759
|
+
const worldPositionStart = new THREE.Vector3();
|
|
760
|
+
const worldQuaternionStart = new THREE.Quaternion();
|
|
761
|
+
const worldScaleStart = new THREE.Vector3();
|
|
762
|
+
const worldPosition = new THREE.Vector3();
|
|
763
|
+
const worldQuaternion = new THREE.Quaternion();
|
|
764
|
+
const worldQuaternionInv = new THREE.Quaternion();
|
|
765
|
+
const worldScale = new THREE.Vector3();
|
|
766
|
+
const eye = new THREE.Vector3();
|
|
767
|
+
const positionStart = new THREE.Vector3();
|
|
768
|
+
const quaternionStart = new THREE.Quaternion();
|
|
769
|
+
const scaleStart = new THREE.Vector3();
|
|
770
|
+
// TODO: remove properties unused in plane and gizmo
|
|
771
|
+
defineProperty('worldPosition', worldPosition);
|
|
772
|
+
defineProperty('worldPositionStart', worldPositionStart);
|
|
773
|
+
defineProperty('worldQuaternion', worldQuaternion);
|
|
774
|
+
defineProperty('worldQuaternionStart', worldQuaternionStart);
|
|
775
|
+
defineProperty('cameraPosition', cameraPosition);
|
|
776
|
+
defineProperty('cameraQuaternion', cameraQuaternion);
|
|
777
|
+
defineProperty('pointStart', pointStart);
|
|
778
|
+
defineProperty('pointEnd', pointEnd);
|
|
779
|
+
defineProperty('rotationAxis', rotationAxis);
|
|
780
|
+
defineProperty('rotationAngle', rotationAngle);
|
|
781
|
+
defineProperty('eye', eye);
|
|
782
|
+
// normalize mouse / touch pointer and remap {x,y} to view space.
|
|
783
|
+
function getPointer(event) {
|
|
784
|
+
if (scope.domElement.ownerDocument.pointerLockElement) {
|
|
785
|
+
return {
|
|
786
|
+
x: 0,
|
|
787
|
+
y: 0,
|
|
788
|
+
button: event.button,
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
const pointer = event.changedTouches ? event.changedTouches[0] : event;
|
|
792
|
+
const rect = domElement.getBoundingClientRect();
|
|
793
|
+
return {
|
|
794
|
+
x: (pointer.clientX - rect.left) / rect.width * 2 - 1,
|
|
795
|
+
y: -(pointer.clientY - rect.top) / rect.height * 2 + 1,
|
|
796
|
+
button: event.button,
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
// mouse / touch event handlers
|
|
800
|
+
function onPointerHover(event) {
|
|
801
|
+
if (!scope.enabled)
|
|
802
|
+
return;
|
|
803
|
+
switch (event.pointerType) {
|
|
804
|
+
case 'mouse':
|
|
805
|
+
case 'pen':
|
|
806
|
+
scope.pointerHover(getPointer(event));
|
|
807
|
+
break;
|
|
808
|
+
default: break;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function onPointerMove(event) {
|
|
812
|
+
if (!scope.enabled)
|
|
813
|
+
return;
|
|
814
|
+
scope.pointerMove(getPointer(event));
|
|
815
|
+
}
|
|
816
|
+
function onPointerDown(event) {
|
|
817
|
+
if (!scope.enabled)
|
|
818
|
+
return;
|
|
819
|
+
scope.domElement.style.touchAction = 'none'; // disable touch scroll
|
|
820
|
+
scope.domElement.ownerDocument.addEventListener('pointermove', onPointerMove);
|
|
821
|
+
scope.pointerHover(getPointer(event));
|
|
822
|
+
scope.pointerDown(getPointer(event));
|
|
823
|
+
}
|
|
824
|
+
function onPointerUp(event) {
|
|
825
|
+
if (!scope.enabled)
|
|
826
|
+
return;
|
|
827
|
+
scope.domElement.style.touchAction = '';
|
|
828
|
+
scope.domElement.ownerDocument.removeEventListener('pointermove', onPointerMove);
|
|
829
|
+
scope.pointerUp(getPointer(event));
|
|
830
|
+
}
|
|
831
|
+
domElement.addEventListener('pointerdown', onPointerDown);
|
|
832
|
+
domElement.addEventListener('pointermove', onPointerHover);
|
|
833
|
+
scope.domElement.ownerDocument.addEventListener('pointerup', onPointerUp);
|
|
834
|
+
this.dispose = function () {
|
|
835
|
+
domElement.removeEventListener('pointerdown', onPointerDown);
|
|
836
|
+
domElement.removeEventListener('pointermove', onPointerHover);
|
|
837
|
+
scope.domElement.ownerDocument.removeEventListener('pointermove', onPointerMove);
|
|
838
|
+
scope.domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
|
|
839
|
+
this.traverse((child) => {
|
|
840
|
+
if (child.geometry)
|
|
841
|
+
child.geometry.dispose();
|
|
842
|
+
if (child.material)
|
|
843
|
+
child.material.dispose();
|
|
844
|
+
});
|
|
845
|
+
scope.domElement = null;
|
|
846
|
+
};
|
|
847
|
+
// Set current object
|
|
848
|
+
this.attach = function (object) {
|
|
849
|
+
this.object = object;
|
|
850
|
+
this.visible = true;
|
|
851
|
+
return this;
|
|
852
|
+
};
|
|
853
|
+
// Detatch from object
|
|
854
|
+
this.detach = function () {
|
|
855
|
+
this.object = undefined;
|
|
856
|
+
this.visible = false;
|
|
857
|
+
this.axis = null;
|
|
858
|
+
return this;
|
|
859
|
+
};
|
|
860
|
+
// updateMatrixWorld updates key transformation variables
|
|
861
|
+
this.updateMatrixWorld = function () {
|
|
862
|
+
if (this.object !== undefined) {
|
|
863
|
+
this.object.updateMatrixWorld();
|
|
864
|
+
if (this.object.parent === null) {
|
|
865
|
+
console.error('TransformControls: The attached 3D object must be a part of the scene graph.');
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
this.object.parent.matrixWorld.decompose(parentPosition, parentQuaternion, parentScale);
|
|
869
|
+
}
|
|
870
|
+
this.object.matrixWorld.decompose(worldPosition, worldQuaternion, worldScale);
|
|
871
|
+
parentQuaternionInv.copy(parentQuaternion).invert();
|
|
872
|
+
worldQuaternionInv.copy(worldQuaternion).invert();
|
|
873
|
+
}
|
|
874
|
+
this.camera.updateMatrixWorld();
|
|
875
|
+
this.camera.matrixWorld.decompose(cameraPosition, cameraQuaternion, cameraScale);
|
|
876
|
+
eye.copy(cameraPosition).sub(worldPosition).normalize();
|
|
877
|
+
THREE.Object3D.prototype.updateMatrixWorld.call(this);
|
|
878
|
+
};
|
|
879
|
+
this.pointerHover = function (pointer) {
|
|
880
|
+
if (this.object === undefined || this.dragging === true)
|
|
881
|
+
return;
|
|
882
|
+
raycaster.setFromCamera(pointer, this.camera);
|
|
883
|
+
const intersect = intersectObjectWithRay(_gizmo.picker[this.mode], raycaster);
|
|
884
|
+
if (intersect) {
|
|
885
|
+
this.axis = intersect.object.name;
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
this.axis = null;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
this.pointerDown = function (pointer) {
|
|
892
|
+
if (this.object === undefined || this.dragging === true || pointer.button !== 0)
|
|
893
|
+
return;
|
|
894
|
+
if (this.axis !== null) {
|
|
895
|
+
raycaster.setFromCamera(pointer, this.camera);
|
|
896
|
+
const planeIntersect = intersectObjectWithRay(_plane, raycaster, true);
|
|
897
|
+
if (planeIntersect) {
|
|
898
|
+
let { space } = this;
|
|
899
|
+
if (this.mode === 'scale') {
|
|
900
|
+
space = 'local';
|
|
901
|
+
}
|
|
902
|
+
else if (this.axis === 'E' || this.axis === 'XYZE' || this.axis === 'XYZ') {
|
|
903
|
+
space = 'world';
|
|
904
|
+
}
|
|
905
|
+
if (space === 'local' && this.mode === 'rotate') {
|
|
906
|
+
const snap = this.rotationSnap;
|
|
907
|
+
if (this.axis === 'X' && snap)
|
|
908
|
+
this.object.rotation.x = Math.round(this.object.rotation.x / snap) * snap;
|
|
909
|
+
if (this.axis === 'Y' && snap)
|
|
910
|
+
this.object.rotation.y = Math.round(this.object.rotation.y / snap) * snap;
|
|
911
|
+
if (this.axis === 'Z' && snap)
|
|
912
|
+
this.object.rotation.z = Math.round(this.object.rotation.z / snap) * snap;
|
|
913
|
+
}
|
|
914
|
+
this.object.updateMatrixWorld();
|
|
915
|
+
this.object.parent.updateMatrixWorld();
|
|
916
|
+
positionStart.copy(this.object.position);
|
|
917
|
+
quaternionStart.copy(this.object.quaternion);
|
|
918
|
+
scaleStart.copy(this.object.scale);
|
|
919
|
+
this.object.matrixWorld.decompose(worldPositionStart, worldQuaternionStart, worldScaleStart);
|
|
920
|
+
pointStart.copy(planeIntersect.point).sub(worldPositionStart);
|
|
921
|
+
}
|
|
922
|
+
this.dragging = true;
|
|
923
|
+
mouseDownEvent.mode = this.mode;
|
|
924
|
+
this.dispatchEvent(mouseDownEvent);
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
this.pointerMove = function (pointer) {
|
|
928
|
+
const { axis } = this;
|
|
929
|
+
const { mode } = this;
|
|
930
|
+
const { object } = this;
|
|
931
|
+
let { space } = this;
|
|
932
|
+
if (mode === 'scale') {
|
|
933
|
+
space = 'local';
|
|
934
|
+
}
|
|
935
|
+
else if (axis === 'E' || axis === 'XYZE' || axis === 'XYZ') {
|
|
936
|
+
space = 'world';
|
|
937
|
+
}
|
|
938
|
+
if (object === undefined || axis === null || this.dragging === false || pointer.button !== -1)
|
|
939
|
+
return;
|
|
940
|
+
raycaster.setFromCamera(pointer, this.camera);
|
|
941
|
+
const planeIntersect = intersectObjectWithRay(_plane, raycaster, true);
|
|
942
|
+
if (!planeIntersect)
|
|
943
|
+
return;
|
|
944
|
+
pointEnd.copy(planeIntersect.point).sub(worldPositionStart);
|
|
945
|
+
if (mode === 'translate') {
|
|
946
|
+
// Apply translate
|
|
947
|
+
offset.copy(pointEnd).sub(pointStart);
|
|
948
|
+
if (space === 'local' && axis !== 'XYZ') {
|
|
949
|
+
offset.applyQuaternion(worldQuaternionInv);
|
|
950
|
+
}
|
|
951
|
+
if (axis.indexOf('X') === -1)
|
|
952
|
+
offset.x = 0;
|
|
953
|
+
if (axis.indexOf('Y') === -1)
|
|
954
|
+
offset.y = 0;
|
|
955
|
+
if (axis.indexOf('Z') === -1)
|
|
956
|
+
offset.z = 0;
|
|
957
|
+
if (space === 'local' && axis !== 'XYZ') {
|
|
958
|
+
offset.applyQuaternion(quaternionStart).divide(parentScale);
|
|
959
|
+
}
|
|
960
|
+
else {
|
|
961
|
+
offset.applyQuaternion(parentQuaternionInv).divide(parentScale);
|
|
962
|
+
}
|
|
963
|
+
object.position.copy(offset).add(positionStart);
|
|
964
|
+
// Apply translation snap
|
|
965
|
+
if (this.translationSnap) {
|
|
966
|
+
if (space === 'local') {
|
|
967
|
+
object.position.applyQuaternion(_tempQuaternion.copy(quaternionStart).invert());
|
|
968
|
+
if (axis.search('X') !== -1) {
|
|
969
|
+
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
|
970
|
+
}
|
|
971
|
+
if (axis.search('Y') !== -1) {
|
|
972
|
+
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
|
973
|
+
}
|
|
974
|
+
if (axis.search('Z') !== -1) {
|
|
975
|
+
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
|
976
|
+
}
|
|
977
|
+
object.position.applyQuaternion(quaternionStart);
|
|
978
|
+
}
|
|
979
|
+
if (space === 'world') {
|
|
980
|
+
if (object.parent) {
|
|
981
|
+
object.position.add(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
|
|
982
|
+
}
|
|
983
|
+
if (axis.search('X') !== -1) {
|
|
984
|
+
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
|
985
|
+
}
|
|
986
|
+
if (axis.search('Y') !== -1) {
|
|
987
|
+
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
|
988
|
+
}
|
|
989
|
+
if (axis.search('Z') !== -1) {
|
|
990
|
+
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
|
991
|
+
}
|
|
992
|
+
if (object.parent) {
|
|
993
|
+
object.position.sub(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
else if (mode === 'scale') {
|
|
999
|
+
if (axis.search('XYZ') !== -1) {
|
|
1000
|
+
let d = pointEnd.length() / pointStart.length();
|
|
1001
|
+
if (pointEnd.dot(pointStart) < 0)
|
|
1002
|
+
d *= -1;
|
|
1003
|
+
_tempVector2.set(d, d, d);
|
|
1004
|
+
}
|
|
1005
|
+
else {
|
|
1006
|
+
_tempVector.copy(pointStart);
|
|
1007
|
+
_tempVector2.copy(pointEnd);
|
|
1008
|
+
_tempVector.applyQuaternion(worldQuaternionInv);
|
|
1009
|
+
_tempVector2.applyQuaternion(worldQuaternionInv);
|
|
1010
|
+
_tempVector2.divide(_tempVector);
|
|
1011
|
+
if (axis.search('X') === -1) {
|
|
1012
|
+
_tempVector2.x = 1;
|
|
1013
|
+
}
|
|
1014
|
+
if (axis.search('Y') === -1) {
|
|
1015
|
+
_tempVector2.y = 1;
|
|
1016
|
+
}
|
|
1017
|
+
if (axis.search('Z') === -1) {
|
|
1018
|
+
_tempVector2.z = 1;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
// Apply scale
|
|
1022
|
+
object.scale.copy(scaleStart).multiply(_tempVector2);
|
|
1023
|
+
if (this.scaleSnap) {
|
|
1024
|
+
if (axis.search('X') !== -1) {
|
|
1025
|
+
object.scale.x = Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
1026
|
+
}
|
|
1027
|
+
if (axis.search('Y') !== -1) {
|
|
1028
|
+
object.scale.y = Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
1029
|
+
}
|
|
1030
|
+
if (axis.search('Z') !== -1) {
|
|
1031
|
+
object.scale.z = Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
else if (mode === 'rotate') {
|
|
1036
|
+
offset.copy(pointEnd).sub(pointStart);
|
|
1037
|
+
const ROTATION_SPEED = 20 / worldPosition.distanceTo(_tempVector.setFromMatrixPosition(this.camera.matrixWorld));
|
|
1038
|
+
if (axis === 'E') {
|
|
1039
|
+
rotationAxis.copy(eye);
|
|
1040
|
+
rotationAngle = pointEnd.angleTo(pointStart);
|
|
1041
|
+
startNorm.copy(pointStart).normalize();
|
|
1042
|
+
endNorm.copy(pointEnd).normalize();
|
|
1043
|
+
rotationAngle *= (endNorm.cross(startNorm).dot(eye) < 0 ? 1 : -1);
|
|
1044
|
+
}
|
|
1045
|
+
else if (axis === 'XYZE') {
|
|
1046
|
+
rotationAxis.copy(offset).cross(eye).normalize();
|
|
1047
|
+
rotationAngle = offset.dot(_tempVector.copy(rotationAxis).cross(this.eye)) * ROTATION_SPEED;
|
|
1048
|
+
}
|
|
1049
|
+
else if (axis === 'X' || axis === 'Y' || axis === 'Z') {
|
|
1050
|
+
rotationAxis.copy(_unit[axis]);
|
|
1051
|
+
_tempVector.copy(_unit[axis]);
|
|
1052
|
+
if (space === 'local') {
|
|
1053
|
+
_tempVector.applyQuaternion(worldQuaternion);
|
|
1054
|
+
}
|
|
1055
|
+
rotationAngle = offset.dot(_tempVector.cross(eye).normalize()) * ROTATION_SPEED;
|
|
1056
|
+
}
|
|
1057
|
+
// Apply rotation snap
|
|
1058
|
+
if (this.rotationSnap)
|
|
1059
|
+
rotationAngle = Math.round(rotationAngle / this.rotationSnap) * this.rotationSnap;
|
|
1060
|
+
this.rotationAngle = rotationAngle;
|
|
1061
|
+
// Apply rotate
|
|
1062
|
+
if (space === 'local' && axis !== 'E' && axis !== 'XYZE') {
|
|
1063
|
+
object.quaternion.copy(quaternionStart);
|
|
1064
|
+
object.quaternion.multiply(_tempQuaternion.setFromAxisAngle(rotationAxis, rotationAngle)).normalize();
|
|
1065
|
+
}
|
|
1066
|
+
else {
|
|
1067
|
+
rotationAxis.applyQuaternion(parentQuaternionInv);
|
|
1068
|
+
object.quaternion.copy(_tempQuaternion.setFromAxisAngle(rotationAxis, rotationAngle));
|
|
1069
|
+
object.quaternion.multiply(quaternionStart).normalize();
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
this.dispatchEvent(changeEvent);
|
|
1073
|
+
this.dispatchEvent(objectChangeEvent);
|
|
1074
|
+
};
|
|
1075
|
+
this.pointerUp = function (pointer) {
|
|
1076
|
+
if (pointer.button !== 0)
|
|
1077
|
+
return;
|
|
1078
|
+
if (this.dragging && (this.axis !== null)) {
|
|
1079
|
+
mouseUpEvent.mode = this.mode;
|
|
1080
|
+
this.dispatchEvent(mouseUpEvent);
|
|
1081
|
+
}
|
|
1082
|
+
this.dragging = false;
|
|
1083
|
+
this.axis = null;
|
|
1084
|
+
};
|
|
1085
|
+
// TODO: deprecate
|
|
1086
|
+
this.getMode = function () {
|
|
1087
|
+
return scope.mode;
|
|
1088
|
+
};
|
|
1089
|
+
this.setMode = function (mode) {
|
|
1090
|
+
scope.mode = mode;
|
|
1091
|
+
};
|
|
1092
|
+
this.setTranslationSnap = function (translationSnap) {
|
|
1093
|
+
scope.translationSnap = translationSnap;
|
|
1094
|
+
};
|
|
1095
|
+
this.setScaleSnap = function (scaleSnap) {
|
|
1096
|
+
scope.scaleSnap = scaleSnap;
|
|
1097
|
+
};
|
|
1098
|
+
this.setRotationSnap = function (rotationSnap) {
|
|
1099
|
+
scope.rotationSnap = rotationSnap;
|
|
1100
|
+
};
|
|
1101
|
+
this.setSize = function (size) {
|
|
1102
|
+
scope.size = size;
|
|
1103
|
+
};
|
|
1104
|
+
this.setSpace = function (space) {
|
|
1105
|
+
scope.space = space;
|
|
1106
|
+
};
|
|
1107
|
+
this.update = function () {
|
|
1108
|
+
console.warn('THREE.TransformControls: update function has no more functionality and therefore has been deprecated.');
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
export { TransformControls, TransformControlsGizmo, TransformControlsPlane };
|