@realsee/five-webgpu 1.0.0-alpha.5 → 1.0.0-alpha.6
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/ai_guides/api.md +9 -8
- package/ai_guides/features/camera-animation.md +1 -1
- package/ai_guides/features/event.md +0 -1
- package/ai_guides/features/five.md +8 -8
- package/ai_guides/features/gesture.md +1 -1
- package/ai_guides/features/load-external-model.md +6 -6
- package/ai_guides/features/load-progress.md +2 -2
- package/ai_guides/features/mode.md +3 -23
- package/ai_guides/features/model.md +1 -1
- package/ai_guides/features/state.md +2 -2
- package/ai_guides/features/ultra-hdr.md +41 -32
- package/ai_guides/quick-start.md +2 -2
- package/ai_guides/release_notes/6.8.md +2 -2
- package/ai_guides/support.md +0 -4
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/index.BoundingMesh.html +1 -1
- package/docs/classes/index.EffectComposer.html +1 -1
- package/docs/classes/index.EyeDomeLightingPass.html +1 -1
- package/docs/classes/index.Five.html +68 -67
- package/docs/classes/index.FivePass.html +1 -1
- package/docs/classes/index.FlowingFireworks3DPass.html +1 -1
- package/docs/classes/index.FlowingLight2DPass.html +1 -1
- package/docs/classes/index.FlowingLight3DPass.html +1 -1
- package/docs/classes/index.GaussianBlurPass.html +1 -1
- package/docs/classes/index.InternalWebGPURenderer.html +4 -4
- package/docs/classes/index.Model.html +1 -1
- package/docs/classes/index.ModelScene.html +1 -1
- package/docs/classes/index.NetworkSubscribe.html +1 -1
- package/docs/classes/index.PBMCustomNode.html +8 -8
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +8 -6
- package/docs/classes/index.PBMGaussianSplattingObject.html +10 -4
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +26 -15
- package/docs/classes/index.PBMGroup.html +1 -1
- package/docs/classes/index.PBMMesh.html +1 -1
- package/docs/classes/index.PBMMeshBasicMaterial.html +11 -7
- package/docs/classes/index.PBMMeshBasicNodeMaterial.html +11 -7
- package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +11 -7
- package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +11 -7
- package/docs/classes/index.PBMMeshPhongMaterial.html +11 -7
- package/docs/classes/index.PBMMeshPhongNodeMaterial.html +11 -7
- package/docs/classes/index.PBMMeshPhysicalMaterial.html +11 -7
- package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +11 -7
- package/docs/classes/index.PBMPanoFilter.html +8 -8
- package/docs/classes/index.PBMPointCloud.html +1 -1
- package/docs/classes/index.PBMSkinnedMesh.html +1 -1
- package/docs/classes/index.PBMUpdateable.html +1 -1
- package/docs/classes/index.PanoCircleMesh.html +1 -1
- package/docs/classes/index.PanoCircleMeshCustom.html +5 -5
- package/docs/classes/index.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/index.Parameter.html +1 -1
- package/docs/classes/index.Subscribe.html +1 -1
- package/docs/classes/index.TextureLoader.html +4 -1
- package/docs/classes/index.Tile3D.html +23 -21
- package/docs/classes/index.TileNode.html +1 -1
- package/docs/classes/index.Tileset.html +4 -4
- package/docs/classes/index.TrajectoryNode.html +3 -3
- package/docs/classes/index.Work.html +20 -18
- package/docs/classes/index.WorkResolvedObserver.html +22 -22
- package/docs/documents/api.html +11 -10
- package/docs/documents/features_camera-animation.html +1 -1
- package/docs/documents/features_event.html +0 -1
- package/docs/documents/features_five.html +7 -7
- package/docs/documents/features_gesture.html +1 -1
- package/docs/documents/features_load-external-model.html +6 -6
- package/docs/documents/features_load-progress.html +1 -1
- package/docs/documents/features_mode.html +5 -15
- package/docs/documents/features_model.html +1 -1
- package/docs/documents/features_state.html +1 -1
- package/docs/documents/features_ultra-hdr.html +50 -44
- package/docs/documents/quick-start.html +1 -1
- package/docs/documents/release_notes_6.8.html +2 -2
- package/docs/documents/support.html +1 -3
- package/docs/functions/index.customNodesCacheKey.html +1 -1
- package/docs/functions/index.parseWork.html +1 -1
- package/docs/functions/index.workToJson.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/index.AddableObject.html +1 -1
- package/docs/interfaces/index.AjaxOptions.html +1 -1
- package/docs/interfaces/index.BaseEvent.html +2 -2
- package/docs/interfaces/index.Clock.html +24 -0
- package/docs/interfaces/index.EventCallback.html +49 -47
- package/docs/interfaces/index.FiveInitArgs.html +49 -40
- package/docs/interfaces/index.GainmapCfgData.html +15 -0
- package/docs/interfaces/index.GestureEvent.html +2 -2
- package/docs/interfaces/index.IPBMMaterial.html +10 -6
- package/docs/interfaces/index.ImageOptions.html +1 -1
- package/docs/interfaces/index.IntersectEvent.html +2 -2
- package/docs/interfaces/index.IntersectMesh.html +1 -1
- package/docs/interfaces/index.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/index.Intersection.html +1 -1
- package/docs/interfaces/index.LoosePanoWork.html +2 -2
- package/docs/interfaces/index.LooseWork.html +2 -2
- package/docs/interfaces/index.LooseWorkInitial.html +2 -2
- package/docs/interfaces/index.LooseWorkModel.html +2 -2
- package/docs/interfaces/index.LooseWorkObserver.html +2 -2
- package/docs/interfaces/index.LooseWorkPanorama.html +4 -3
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +15 -9
- package/docs/interfaces/index.ModeChangeEvent.html +2 -2
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ModelEvent.html +2 -2
- package/docs/interfaces/index.ModelSceneEvent.html +2 -2
- package/docs/interfaces/index.ModelTileEvent.html +2 -2
- package/docs/interfaces/index.MovePanoOptions.html +1 -1
- package/docs/interfaces/index.NetworkAbortError.html +1 -1
- package/docs/interfaces/index.NetworkFirbiddenError.html +1 -1
- package/docs/interfaces/index.NetworkOptions.html +1 -1
- package/docs/interfaces/index.NetworkProxyError.html +1 -1
- package/docs/interfaces/index.NetworkResourceEvent.html +2 -2
- package/docs/interfaces/index.NetworkResponseError.html +1 -1
- package/docs/interfaces/index.NetworkTimeoutError.html +1 -1
- package/docs/interfaces/index.ObjectEvent.html +2 -2
- package/docs/interfaces/index.PBMClipperParameter.html +2 -2
- package/docs/interfaces/index.PBMCustomNodeContext.html +60 -12
- package/docs/interfaces/index.PBMCustomNodeOptions.html +4 -4
- package/docs/interfaces/index.PBMCustomNodePanoContext.html +12 -5
- package/docs/interfaces/index.PBMCustomNodeSlots.html +6 -6
- package/docs/interfaces/index.PBMPanoDepth.html +5 -5
- package/docs/interfaces/index.PBMPanoFilterValue.html +2 -2
- package/docs/interfaces/index.PBMPanoGainmap.html +6 -0
- package/docs/interfaces/index.PBMPanoPicture.html +9 -8
- package/docs/interfaces/index.PBMRefinedScreen.html +2 -2
- package/docs/interfaces/index.PanoCircleMeshCustomOptions.html +2 -2
- package/docs/interfaces/index.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/index.PanoEvent.html +2 -2
- package/docs/interfaces/index.PanoTextureEvent.html +2 -2
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/index.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/index.ParameterValue.html +1 -1
- package/docs/interfaces/index.Pose.html +1 -1
- package/docs/interfaces/index.RenderEvent.html +2 -2
- package/docs/interfaces/index.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/index.State.html +1 -1
- package/docs/interfaces/index.StateEvent.html +2 -2
- package/docs/interfaces/index.TextureOptions.html +1 -1
- package/docs/interfaces/index.TilesetOptions.html +7 -2
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.VRPanoramaControllerCustomInitArgs.html +37 -0
- package/docs/interfaces/index.ViewLayer.html +23 -21
- package/docs/interfaces/index.WorkCubeHdrGainmapImage.html +10 -0
- package/docs/interfaces/index.WorkCubeImage.html +5 -9
- package/docs/interfaces/index.WorkImage.html +8 -12
- package/docs/interfaces/index.WorkInitial.html +8 -8
- package/docs/interfaces/index.WorkModel.html +8 -8
- package/docs/interfaces/index.WorkModelLayer.html +6 -6
- package/docs/interfaces/index.WorkObserver.html +23 -23
- package/docs/interfaces/index.WorkPanoramaJson.html +3 -2
- package/docs/interfaces/index.WorkTile.html +8 -12
- package/docs/interfaces/index.WorksEvent.html +2 -2
- package/docs/interfaces/index.XRControllerEvent.html +2 -2
- package/docs/interfaces/index.XRGestureEvent.html +2 -2
- package/docs/interfaces/index.XRSessionEvent.html +2 -2
- package/docs/modules/index.html +1 -1
- package/docs/types/index.ControllerCustomInitTypes.html +3 -2
- package/docs/types/index.ControllerEventTypes.html +25 -23
- package/docs/types/index.EventTypes.html +26 -26
- package/docs/types/index.Mode.html +2 -1
- package/docs/types/index.ParseOptions.html +14 -8
- package/docs/variables/index.GSPLAT_PIPELINE_AUTO.html +2 -0
- package/docs/variables/index.GSPLAT_PIPELINE_RASTER_CPU_SORT.html +2 -0
- package/docs/variables/index.GSPLAT_PIPELINE_RASTER_GPU_SORT.html +2 -0
- package/docs/variables/index.PROXY_CONTROLLER_EVENT_NAMES.html +1 -1
- package/docs/variables/index.controllersDefaultInitArgs.html +1 -1
- package/five/application/controllers.d.ts +4 -0
- package/five/application/events.d.ts +1 -1
- package/five/application/five.d.ts +4 -1
- package/five/application/fiveInitArgs.d.ts +13 -0
- package/five/application/mode.d.ts +2 -0
- package/five/cardboard/helper.d.ts +2 -0
- package/five/cardboard/index.d.ts +13 -0
- package/five/cardboard/sensor.d.ts +158 -0
- package/five/controllers/base.d.ts +3 -0
- package/five/controllers/events.d.ts +5 -3
- package/five/controllers/panorama.d.ts +2 -2
- package/five/controllers/vrPanorama.d.ts +56 -0
- package/five/core/panoVideo.d.ts +4 -1
- package/five/core/tiling.d.ts +25 -11
- package/five/gaussian-splatting/gpu-sort/prefixSumKernel.d.ts +65 -0
- package/five/gaussian-splatting/gpu-sort/radixSortModule.d.ts +128 -0
- package/five/gaussian-splatting/gpu-sort/shaders/prefixSum.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/shaders/radixHistogram.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/shaders/radixReorder.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/shaders/sortKeygen.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/sortAdapter.d.ts +234 -0
- package/five/gaussian-splatting/pipelines/cpuSortPipeline.d.ts +159 -0
- package/five/gaussian-splatting/pipelines/gpuSortPipeline.d.ts +98 -0
- package/five/gaussian-splatting/pipelines/gsplatPipeline.d.ts +104 -0
- package/five/gaussian-splatting/pipelines/pipelineMode.d.ts +42 -0
- package/five/gaussian-splatting/pipelines/sortThrottle.d.ts +45 -0
- package/five/index.d.ts +4 -1
- package/five/index.js +272 -269
- package/five/index.mjs +6979 -4610
- package/five/meshes/panoCircleMeshCustom.d.ts +1 -0
- package/five/model/index.d.ts +1 -1
- package/five/model/materials/pbmGaussianSplattingNodeMaterial.d.ts +4 -0
- package/five/model/materials/pbmMaterial.d.ts +113 -18
- package/five/model/materials/tsl/defines.d.ts +6 -1
- package/five/model/materials/tsl/outputBuilder.d.ts +1 -12
- package/five/model/materials/tsl/panoColor.d.ts +8 -2
- package/five/model/materials/tsl/utils.d.ts +13 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +9 -0
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +67 -101
- package/five/model/tile3d/index.d.ts +2 -0
- package/five/model/tile3d/tileset.d.ts +5 -0
- package/five/model/tile3d/trajectory-content.d.ts +53 -0
- package/five/texture/loader.d.ts +6 -0
- package/five/types/cube.d.ts +0 -1
- package/five/utils/detector.d.ts +11 -1
- package/five/utils/error.d.ts +1 -0
- package/five/utils/event.d.ts +17 -1
- package/five/utils/gainmap-data.d.ts +23 -0
- package/five/work/index.d.ts +1 -1
- package/five/work/looseWorkType.d.ts +2 -1
- package/five/work/work.d.ts +30 -7
- package/five/work/workJsonType.d.ts +2 -1
- package/gltf-loader/gltf-object.d.ts +17 -0
- package/gltf-loader/index.d.ts +45 -0
- package/gltf-loader/index.js +255 -0
- package/gltf-loader/index.mjs +302 -0
- package/package.json +6 -1
- package/plugins/BackgroundPlugin/Controller.d.ts +20 -0
- package/plugins/BackgroundPlugin/index.d.ts +5 -0
- package/plugins/BackgroundPlugin/typings.d.ts +44 -0
- package/plugins/CSS2DPlugin/Controller.d.ts +59 -0
- package/plugins/CSS2DPlugin/index.d.ts +5 -0
- package/plugins/CSS2DPlugin/typing.d.ts +31 -0
- package/plugins/CSS3DPlugin/Controller.d.ts +64 -0
- package/plugins/CSS3DPlugin/index.d.ts +5 -0
- package/plugins/CSS3DPlugin/typing.d.ts +33 -0
- package/plugins/FloorplanPlugin/Controller.d.ts +100 -0
- package/plugins/FloorplanPlugin/index.d.ts +5 -0
- package/plugins/FloorplanPlugin/render/assets.d.ts +9 -0
- package/plugins/FloorplanPlugin/render/index.d.ts +35 -0
- package/plugins/FloorplanPlugin/render/isPointInPolygon.d.ts +5 -0
- package/plugins/FloorplanPlugin/render/renderFloor.d.ts +22 -0
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.d.ts +10 -0
- package/plugins/FloorplanPlugin/typing.d.ts +156 -0
- package/plugins/FloorplanPlugin/typings/floorplanData.d.ts +112 -0
- package/plugins/FloorplanPlugin/typings/floorplanServerData.d.ts +78 -0
- package/plugins/FloorplanPlugin/typings/index.d.ts +2 -0
- package/plugins/FloorplanPlugin/utils/changeMode.d.ts +5 -0
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/correctFiveState.d.ts +11 -0
- package/plugins/FloorplanPlugin/utils/equal.d.ts +9 -0
- package/plugins/FloorplanPlugin/utils/filter.d.ts +8 -0
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/formatData.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/formatPosition.d.ts +33 -0
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/getPxmm.d.ts +19 -0
- package/plugins/FloorplanPlugin/utils/isTruelyObject.d.ts +4 -0
- package/plugins/FloorplanPlugin/utils/nearlyEqual.d.ts +8 -0
- package/plugins/FloorplanPlugin/utils/to.d.ts +5 -0
- package/plugins/Object3DHelperPlugin/Controller.d.ts +99 -0
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.d.ts +142 -0
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.d.ts +16 -0
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.d.ts +66 -0
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.d.ts +61 -0
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.d.ts +17 -0
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.d.ts +97 -0
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.d.ts +16 -0
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.d.ts +37 -0
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.d.ts +93 -0
- package/plugins/Object3DHelperPlugin/constant.d.ts +27 -0
- package/plugins/Object3DHelperPlugin/index.d.ts +6 -0
- package/plugins/Object3DHelperPlugin/typing.d.ts +143 -0
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.d.ts +22 -0
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.d.ts +23 -0
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.d.ts +19 -0
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.d.ts +5 -0
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.d.ts +3 -0
- package/plugins/Object3DHelperPlugin/utils/direction.d.ts +14 -0
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.d.ts +5 -0
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.d.ts +8 -0
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.d.ts +8 -0
- package/plugins/Object3DHelperPlugin/utils/solidGuide.d.ts +27 -0
- package/plugins/Object3DHelperPlugin/utils/tipsDom.d.ts +8 -0
- package/plugins/PanoAnimePlugin/Controller.d.ts +49 -0
- package/plugins/PanoAnimePlugin/index.d.ts +5 -0
- package/plugins/PanoAnimePlugin/typing.d.ts +37 -0
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +393 -3
- package/plugins/index.mjs +3421 -92
- package/plugins/thirdParty/CSS2DRenderer.d.ts +37 -0
- package/plugins/thirdParty/CSS3DRenderer.d.ts +45 -0
- package/plugins/thirdParty/OrbitControls.d.ts +78 -0
- package/plugins/thirdParty/domevents.d.ts +36 -0
- package/plugins/utils/clamp.d.ts +2 -0
- package/plugins/utils/uuid.d.ts +2 -0
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/umd/five-gltf-loader.js +255 -0
- package/umd/five-plugins.js +461 -3
- package/umd/five-react.js +2 -2
- package/umd/five.js +350 -347
- package/docs/interfaces/index.PBMHDRConfig.html +0 -12
- package/five/gaussian-splatting/worker/dataWorker.d.ts +0 -1
- package/five/three-version-check.d.ts +0 -1
- package/five/utils/hdr-data.d.ts +0 -13
- package/five/utils/shaderContentFix.d.ts +0 -7
package/plugins/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five-webgpu
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 1.0.0-alpha.
|
|
4
|
+
* Generated: 2026/9/24
|
|
5
|
+
* Version: 1.0.0-alpha.6
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,64 +252,3393 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/import { AnimationFrameLoop as e, Camera as t,
|
|
256
|
-
import * as
|
|
255
|
+
*/import { AnimationFrameLoop as e, Camera as t, PanoCircleMesh as n, Subscribe as r, loadPly as i } from "@realsee/five-webgpu";
|
|
256
|
+
import * as a from "three/webgpu";
|
|
257
|
+
import { Matrix4 as o, Object3D as s, Quaternion as c, Vector2 as l, Vector3 as u } from "three/webgpu";
|
|
258
|
+
import { Discard as d, Fn as f, positionGeometry as p, select as m, texture as h, uniform as g, uv as _, varying as v, vec3 as y, vec4 as b } from "three/tsl";
|
|
257
259
|
//#region node_modules/tslib/tslib.es6.mjs
|
|
258
|
-
function
|
|
260
|
+
function x(e, t) {
|
|
261
|
+
var n = {};
|
|
262
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
263
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++) t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
|
|
264
|
+
return n;
|
|
265
|
+
}
|
|
266
|
+
function S(e, t, n, r) {
|
|
259
267
|
function i(e) {
|
|
260
268
|
return e instanceof n ? e : new n(function(t) {
|
|
261
269
|
t(e);
|
|
262
270
|
});
|
|
263
271
|
}
|
|
264
|
-
return new (n || (n = Promise))(function(n, a) {
|
|
265
|
-
function o(e) {
|
|
266
|
-
try {
|
|
267
|
-
c(r.next(e));
|
|
268
|
-
} catch (e) {
|
|
269
|
-
a(e);
|
|
272
|
+
return new (n || (n = Promise))(function(n, a) {
|
|
273
|
+
function o(e) {
|
|
274
|
+
try {
|
|
275
|
+
c(r.next(e));
|
|
276
|
+
} catch (e) {
|
|
277
|
+
a(e);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function s(e) {
|
|
281
|
+
try {
|
|
282
|
+
c(r.throw(e));
|
|
283
|
+
} catch (e) {
|
|
284
|
+
a(e);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function c(e) {
|
|
288
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
289
|
+
}
|
|
290
|
+
c((r = r.apply(e, t || [])).next());
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region build/plugins/utils/absoluteUrl.js
|
|
295
|
+
function C(e) {
|
|
296
|
+
return /^https?:\/\/|^\/\//.test(e) || /^data:/.test(e);
|
|
297
|
+
}
|
|
298
|
+
function ee(e, t) {
|
|
299
|
+
return C(t) ? t : `${e}${t}`;
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region build/plugins/BasePlugin/index.js
|
|
303
|
+
var w;
|
|
304
|
+
(function(e) {
|
|
305
|
+
class t {
|
|
306
|
+
constructor(e, t) {
|
|
307
|
+
this.hooks = new r(), this.staticPrefix = "//vr-image-4.realsee-cdn.cn", this.five = e, t != null && t.staticPrefix && (this.staticPrefix = t.staticPrefix);
|
|
308
|
+
}
|
|
309
|
+
getCurrentState() {
|
|
310
|
+
return this.state;
|
|
311
|
+
}
|
|
312
|
+
absoluteUrl(e) {
|
|
313
|
+
return ee(this.staticPrefix, e);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
e.Controller = t;
|
|
317
|
+
})(w || (w = {}));
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region build/plugins/BackgroundPlugin/Controller.js
|
|
320
|
+
var T = class extends w.Controller {
|
|
321
|
+
constructor(e, t) {
|
|
322
|
+
super(e), this.data = {}, this.pluginName = "BackgroundPlugin", this._onFiveCameraUpdate = (e) => {
|
|
323
|
+
let t = (Math.PI / 2 - Math.max(e.latitude, 0)) / (Math.PI / 2), n = Math.max(.2 - t, 0) * 10;
|
|
324
|
+
this.gradientBg && (this.gradientBg.style.transform = `translateY(-${(1 - t) * 50}%)`), this.groundBg && (this.groundBg.style.backgroundImage = `radial-gradient(circle, #2E303350 ${n * 100}%, transparent ${n * 120}%)`);
|
|
325
|
+
}, this._addEventListener = () => {
|
|
326
|
+
this.five.on("cameraUpdate", this._onFiveCameraUpdate);
|
|
327
|
+
}, this._removeEventListener = () => {
|
|
328
|
+
this.five.off("cameraUpdate", this._onFiveCameraUpdate);
|
|
329
|
+
}, this.load = () => S(this, void 0, void 0, function* () {}), this.setState = (e, t = {}) => {}, this.enable = () => {
|
|
330
|
+
var e;
|
|
331
|
+
let t = (e = this.five.getElement()) == null ? void 0 : e.parentNode;
|
|
332
|
+
if (!t) {
|
|
333
|
+
this.five.ready().then(() => this.enable());
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
this.state.enabled || (this._onFiveCameraUpdate(this.five.getPose(), !1), this.gradientBg && t.appendChild(this.gradientBg), this.groundBg && t.appendChild(this.groundBg), this.style && document.head.appendChild(this.style), this._addEventListener(), this.hooks.emit("enable", { userAction: !0 }), this.state.enabled = !0);
|
|
337
|
+
}, this.disable = (e = {}) => {
|
|
338
|
+
var t, n, r, i;
|
|
339
|
+
this.state.enabled && ((n = (t = this.gradientBg) == null ? void 0 : t.parentNode) == null || n.removeChild(this.gradientBg), (i = (r = this.groundBg) == null ? void 0 : r.parentNode) == null || i.removeChild(this.groundBg), this.style && document.head.removeChild(this.style), this._removeEventListener(), this.hooks.emit("disable", { userAction: !0 }), this.state.enabled = !1);
|
|
340
|
+
}, this.dispose = () => {
|
|
341
|
+
this._removeEventListener(), this.hooks.emit("disable", { userAction: !0 }), this.state.enabled = !1;
|
|
342
|
+
}, this.state = { enabled: !1 }, !(typeof document > "u") && (this.gradientBg = document.createElement("div"), this.groundBg = document.createElement("div"), this.style = document.createElement("style"), this.gradientBg.className = "BackgroundPluginBg", this.groundBg.className = "BackgroundPluginGroundBg", this.style.innerHTML = "\n .BackgroundPluginBg {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n height: 200%;\n background: linear-gradient(#0A0B0D, #2E3033);\n z-index: -1;\n pointerEvents: none;\n }\n .BackgroundPluginGroundBg {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background-image: radial-gradient(circle, #2E303350 0, transparent 0);\n z-index: -1;\n pointerEvents: none;\n }\n ", this.enable());
|
|
343
|
+
}
|
|
344
|
+
}, E = (e, t) => new T(e, t);
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region build/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js
|
|
347
|
+
function D(e, t, n) {
|
|
348
|
+
if (n) {
|
|
349
|
+
let r = new a.Vector3().subVectors(e.position, n).applyQuaternion(e.quaternion.clone().invert()).applyQuaternion(t).add(n);
|
|
350
|
+
e.position.copy(r);
|
|
351
|
+
}
|
|
352
|
+
e.quaternion.copy(t);
|
|
353
|
+
}
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region build/five/utils/isNil.js
|
|
356
|
+
function te(e) {
|
|
357
|
+
return e == null;
|
|
358
|
+
}
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region build/plugins/Object3DHelperPlugin/Helper/BaseHelper.js
|
|
361
|
+
var O = class extends a.Object3D {
|
|
362
|
+
removeChildren() {
|
|
363
|
+
for (; this.children.length > 0;) this.remove(this.children[0]);
|
|
364
|
+
return this;
|
|
365
|
+
}
|
|
366
|
+
add(...e) {
|
|
367
|
+
let t = e.filter(Boolean);
|
|
368
|
+
return t.length === 0 ? this : super.add(...t);
|
|
369
|
+
}
|
|
370
|
+
addIfNotExists(...e) {
|
|
371
|
+
return e.forEach((e) => {
|
|
372
|
+
this.children.includes(e) || this.add(e);
|
|
373
|
+
}), this;
|
|
374
|
+
}
|
|
375
|
+
remove(...e) {
|
|
376
|
+
if (e.length === 0) return this;
|
|
377
|
+
let t = e.filter(Boolean);
|
|
378
|
+
return super.remove(...t);
|
|
379
|
+
}
|
|
380
|
+
removeFromParent() {
|
|
381
|
+
let e = this.parent;
|
|
382
|
+
return e !== null && e.remove(this), this;
|
|
383
|
+
}
|
|
384
|
+
get helperObject() {
|
|
385
|
+
return this;
|
|
386
|
+
}
|
|
387
|
+
constructor(e, t) {
|
|
388
|
+
var n, r;
|
|
389
|
+
super(), this.originObject3D = e, this.onRender = (n = t == null ? void 0 : t.onRender) == null ? (() => {}) : n, this.positionFrom = (r = t == null ? void 0 : t.positionFrom) == null ? "objectPosition" : r;
|
|
390
|
+
}
|
|
391
|
+
render() {
|
|
392
|
+
this.onRender();
|
|
393
|
+
}
|
|
394
|
+
enable() {
|
|
395
|
+
this.parent && (this.parent.children.includes(this) || this.parent.add(this));
|
|
396
|
+
}
|
|
397
|
+
disable() {
|
|
398
|
+
this.removeFromParent();
|
|
399
|
+
}
|
|
400
|
+
show() {
|
|
401
|
+
this.visible = !0, this.render();
|
|
402
|
+
}
|
|
403
|
+
hide() {
|
|
404
|
+
this.visible = !1, this.render();
|
|
405
|
+
}
|
|
406
|
+
raycasterIntersectObject(e, t = []) {
|
|
407
|
+
return e.intersectObject(this, !0, t);
|
|
408
|
+
}
|
|
409
|
+
initialPosition(e) {
|
|
410
|
+
this.positionFrom === "objectPosition" ? this.position.copy(this.originObject3D.position) : this.positionFrom === "boundingBox" || this.positionFrom === "boundingSphere" ? this.position.copy(new a.Box3().expandByObject(this.originObject3D).getCenter(new a.Vector3())) : this.positionFrom instanceof u ? this.position.copy(this.positionFrom) : this.positionFrom instanceof Function && this.position.copy(this.positionFrom(this.originObject3D)), e && this.position.add(e);
|
|
411
|
+
}
|
|
412
|
+
setScaleByCamera(e) {}
|
|
413
|
+
initQuaternion(e) {
|
|
414
|
+
if (this.quaternion.set(0, 0, 0, 1), e && (e.xAxis || e.yAxis || e.zAxis)) {
|
|
415
|
+
let t = e.xAxis instanceof Function ? e.xAxis() : e.xAxis, n = e.yAxis instanceof Function ? e.yAxis() : e.yAxis, r = e.zAxis instanceof Function ? e.zAxis() : e.zAxis, i = t == null ? void 0 : t.clone(), o = n == null ? void 0 : n.clone(), s = r == null ? void 0 : r.clone();
|
|
416
|
+
if (i && !o && !o) {
|
|
417
|
+
let e = new a.Quaternion().setFromUnitVectors(new a.Vector3(1, 0, 0), i.normalize());
|
|
418
|
+
this.applyQuaternion(e);
|
|
419
|
+
}
|
|
420
|
+
if (o && !i && !s) {
|
|
421
|
+
let e = new a.Quaternion().setFromUnitVectors(new a.Vector3(0, 1, 0), o.normalize());
|
|
422
|
+
this.applyQuaternion(e);
|
|
423
|
+
}
|
|
424
|
+
if (s && !i && !o) {
|
|
425
|
+
let e = new a.Quaternion().setFromUnitVectors(new a.Vector3(0, 0, 1), s.normalize());
|
|
426
|
+
this.applyQuaternion(e);
|
|
427
|
+
}
|
|
428
|
+
if ([
|
|
429
|
+
i,
|
|
430
|
+
o,
|
|
431
|
+
s
|
|
432
|
+
].filter((e) => !te(e)).length >= 2) {
|
|
433
|
+
i || (i = new a.Vector3().crossVectors(o, s).normalize()), o || (o = new a.Vector3().crossVectors(i, s).normalize()), s || (s = new a.Vector3().crossVectors(i, o).normalize()), i.applyQuaternion(this.quaternion), o.applyQuaternion(this.quaternion), s.applyQuaternion(this.quaternion);
|
|
434
|
+
let e = new a.Matrix4().makeBasis(i, o, s), t = new a.Quaternion().setFromRotationMatrix(e);
|
|
435
|
+
this.quaternion.copy(t);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
applyHelperScaleMatrix4(e, t) {
|
|
440
|
+
this.scale.applyMatrix4(e);
|
|
441
|
+
}
|
|
442
|
+
setHelperQuaternion(e, t) {
|
|
443
|
+
this.initQuaternion(), t ? D(this, this.quaternion.clone().premultiply(e), t) : this.quaternion.premultiply(e);
|
|
444
|
+
}
|
|
445
|
+
applyHelperQuaternion(e, t) {
|
|
446
|
+
if (t) {
|
|
447
|
+
let n = new u().subVectors(this.position, t).applyQuaternion(e).add(t);
|
|
448
|
+
this.position.copy(n);
|
|
449
|
+
}
|
|
450
|
+
this.applyQuaternion(e);
|
|
451
|
+
}
|
|
452
|
+
dispose() {
|
|
453
|
+
this.removeFromParent();
|
|
454
|
+
}
|
|
455
|
+
}, ne = class extends O {}, re = class extends O {}, ie = class extends O {}, k = class extends a.Group {
|
|
456
|
+
constructor(e) {
|
|
457
|
+
super(), this.direction = e || "x";
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
a.Line;
|
|
461
|
+
var ae = class extends a.Mesh {
|
|
462
|
+
constructor(e, t, n) {
|
|
463
|
+
super(e, t), this.direction = n || "x";
|
|
464
|
+
}
|
|
465
|
+
}, oe = {
|
|
466
|
+
X: 16730698,
|
|
467
|
+
Y: 54927,
|
|
468
|
+
Z: 3368703
|
|
469
|
+
}, A = class {
|
|
470
|
+
static get X() {
|
|
471
|
+
return new a.Color(oe.X).convertSRGBToLinear().clone();
|
|
472
|
+
}
|
|
473
|
+
static get Y() {
|
|
474
|
+
return new a.Color(oe.Y).convertSRGBToLinear().clone();
|
|
475
|
+
}
|
|
476
|
+
static get Z() {
|
|
477
|
+
return new a.Color(oe.Z).convertSRGBToLinear().clone();
|
|
478
|
+
}
|
|
479
|
+
}, j = {
|
|
480
|
+
ROTATE_HELPER: 9992,
|
|
481
|
+
MOVE_HELPER: 9993,
|
|
482
|
+
SCALE_HELPER_LINE: 9994,
|
|
483
|
+
SCALE_HELPER_SPHERE: 9995,
|
|
484
|
+
MOVE_HELPER_ARROW: 10001,
|
|
485
|
+
MOVE_HELPER_CENTER: 10002,
|
|
486
|
+
DRAG_GUIDE_LINE: 10003,
|
|
487
|
+
DRAG_FACE_PATCH: 10004
|
|
488
|
+
}, se = class extends k {
|
|
489
|
+
constructor(e) {
|
|
490
|
+
var t;
|
|
491
|
+
super(e.direction), this.lineHeight = .5, this.arrowHeight = .1, this.name = "ArrowGroup";
|
|
492
|
+
let n = new a.Color((t = e.color) == null ? 16214315 : t), r = () => new a.MeshBasicMaterial({
|
|
493
|
+
color: n,
|
|
494
|
+
transparent: !0,
|
|
495
|
+
opacity: 1,
|
|
496
|
+
depthTest: !1,
|
|
497
|
+
depthWrite: !1
|
|
498
|
+
}), i = new a.ConeGeometry(.04, this.arrowHeight, 32);
|
|
499
|
+
this.arrow = new ae(i, r(), e.direction), this.arrow.name = `arrow-${e.direction}`, this.arrow.renderOrder = j.MOVE_HELPER_ARROW;
|
|
500
|
+
let o = new a.ConeGeometry(.04, this.arrowHeight, 32);
|
|
501
|
+
this.arrowNeg = new ae(o, r(), e.direction), this.arrowNeg.name = `arrow-neg-${e.direction}`, this.arrowNeg.renderOrder = j.MOVE_HELPER_ARROW;
|
|
502
|
+
let s = .004, c = new a.CylinderGeometry(s, s, this.lineHeight, 32);
|
|
503
|
+
this.line = new ae(c, r(), e.direction), this.line.name = `line-${e.direction}`, this.line.renderOrder = j.MOVE_HELPER_ARROW, this.formatGeometries(), this.add(this.arrow, this.arrowNeg, this.line);
|
|
504
|
+
}
|
|
505
|
+
formatGeometries() {
|
|
506
|
+
let e = this.lineHeight, t = this.arrowHeight;
|
|
507
|
+
this.arrow.geometry.translate(0, e + t / 2, 0), this.arrowNeg.geometry.rotateZ(Math.PI), this.arrowNeg.geometry.translate(0, -(e + t / 2), 0), this.line.geometry.translate(0, e / 2, 0), this.direction === "x" ? (this.arrow.geometry.rotateX(Math.PI / 2), this.arrow.geometry.rotateY(Math.PI / 2), this.arrowNeg.geometry.rotateX(Math.PI / 2), this.arrowNeg.geometry.rotateY(Math.PI / 2), this.line.geometry.rotateX(Math.PI / 2), this.line.geometry.rotateY(Math.PI / 2)) : this.direction === "z" && (this.arrow.geometry.rotateX(Math.PI / 2), this.arrowNeg.geometry.rotateX(Math.PI / 2), this.line.geometry.rotateX(Math.PI / 2));
|
|
508
|
+
}
|
|
509
|
+
}, ce = class extends k {
|
|
510
|
+
constructor(e) {
|
|
511
|
+
var t, n;
|
|
512
|
+
super("plane"), this.name = "CenterHandle", this.faceNormals = [
|
|
513
|
+
new a.Vector3(1, 0, 0),
|
|
514
|
+
new a.Vector3(-1, 0, 0),
|
|
515
|
+
new a.Vector3(0, 1, 0),
|
|
516
|
+
new a.Vector3(0, -1, 0),
|
|
517
|
+
new a.Vector3(0, 0, 1),
|
|
518
|
+
new a.Vector3(0, 0, -1)
|
|
519
|
+
], this.baseColor = new a.Color((t = e == null ? void 0 : e.color) == null ? 16419862 : t);
|
|
520
|
+
let r = (n = e == null ? void 0 : e.size) == null ? .05 : n, i = new a.Color(16755008).convertSRGBToLinear();
|
|
521
|
+
this.faceMaterials = Array.from({ length: 6 }, () => new a.MeshBasicMaterial({
|
|
522
|
+
color: i,
|
|
523
|
+
transparent: !0,
|
|
524
|
+
opacity: 1,
|
|
525
|
+
depthTest: !1,
|
|
526
|
+
depthWrite: !1,
|
|
527
|
+
side: a.FrontSide
|
|
528
|
+
}));
|
|
529
|
+
let o = new a.BoxGeometry(r, r, r), s = new a.Mesh(o, this.faceMaterials);
|
|
530
|
+
s.direction = "plane", s.renderOrder = j.MOVE_HELPER_CENTER, s.name = "center-plane-handle", this.cube = s, this.add(this.cube);
|
|
531
|
+
}
|
|
532
|
+
update(e) {
|
|
533
|
+
let t = new a.Vector3().subVectors(e.position, this.cube.getWorldPosition(new a.Vector3())).normalize(), n = this.cube.getWorldQuaternion(new a.Quaternion()), r = this.faceNormals.map((e, r) => {
|
|
534
|
+
let i = e.clone().applyQuaternion(n).dot(t);
|
|
535
|
+
return {
|
|
536
|
+
index: r,
|
|
537
|
+
angle: Math.acos(Math.abs(i))
|
|
538
|
+
};
|
|
539
|
+
});
|
|
540
|
+
r.sort((e, t) => e.angle - t.angle);
|
|
541
|
+
let i = [
|
|
542
|
+
new a.Color(16755008).convertSRGBToLinear(),
|
|
543
|
+
new a.Color(16419862).convertSRGBToLinear(),
|
|
544
|
+
new a.Color(13921032).convertSRGBToLinear()
|
|
545
|
+
];
|
|
546
|
+
r.forEach((e, t) => {
|
|
547
|
+
let n = Math.floor(t / 2);
|
|
548
|
+
this.faceMaterials[e.index].color.copy(i[n]);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}, le = class extends k {
|
|
552
|
+
constructor(e) {
|
|
553
|
+
var t, n, r;
|
|
554
|
+
super(e.direction), this.name = "PlaneHandle";
|
|
555
|
+
let i = (t = e.size) == null ? .12 : t, o = (n = e.offset) == null ? .12 : n, s = new a.Color((r = e.color) == null ? 16776960 : r), c = new a.BoxGeometry(i, i, .005), l = new a.MeshBasicMaterial({
|
|
556
|
+
color: s,
|
|
557
|
+
transparent: !0,
|
|
558
|
+
opacity: .4,
|
|
559
|
+
depthTest: !1,
|
|
560
|
+
depthWrite: !1,
|
|
561
|
+
side: a.DoubleSide
|
|
562
|
+
});
|
|
563
|
+
switch (this.handle = new a.Mesh(c, l), this.handle.direction = e.direction, this.handle.renderOrder = j.MOVE_HELPER_ARROW, this.handle.name = `plane-handle-${e.direction}`, e.direction) {
|
|
564
|
+
case "xy":
|
|
565
|
+
this.handle.position.set(o, o, 0);
|
|
566
|
+
break;
|
|
567
|
+
case "xz":
|
|
568
|
+
this.handle.position.set(o, 0, o), this.handle.rotation.x = -Math.PI / 2;
|
|
569
|
+
break;
|
|
570
|
+
case "yz":
|
|
571
|
+
this.handle.position.set(0, o, o), this.handle.rotation.y = Math.PI / 2;
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
this.add(this.handle);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region build/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js
|
|
579
|
+
function ue(e, t, n) {
|
|
580
|
+
let r = e.position.distanceTo(t), i = e.fov, a = e.distance || 3, o = r / 3, s = i / 90, c = a / 3, l = o * s * c, u = (n == null ? void 0 : n.min) || .6, d = n == null ? void 0 : n.max;
|
|
581
|
+
return u && l < u ? u : d && l > d ? d : l;
|
|
582
|
+
}
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region build/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js
|
|
585
|
+
function de(e) {
|
|
586
|
+
let { latitude: t, longitude: n } = e, r = new a.Vector3();
|
|
587
|
+
return fe - t < .03 ? r.set(0, 1, 0) : M(0, n) ? r.set(0, 0, 1) : M(Math.PI, n) ? r.set(0, 0, -1) : M(fe, n) ? r.set(1, 0, 0) : r.set(-1, 0, 0), r;
|
|
588
|
+
}
|
|
589
|
+
var fe = Number((Math.PI / 2).toFixed(5));
|
|
590
|
+
function M(e, t) {
|
|
591
|
+
return typeof e != "number" || typeof t != "number" ? !1 : Math.abs(e - t) < .001;
|
|
592
|
+
}
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region build/plugins/Object3DHelperPlugin/utils/tipsDom.js
|
|
595
|
+
function pe(e, t) {
|
|
596
|
+
return me(document.createElement(t == null ? "div" : t), e);
|
|
597
|
+
}
|
|
598
|
+
function me(e, t) {
|
|
599
|
+
if (!t) return e;
|
|
600
|
+
for (let n in t) n && t[n] && (e.style[n] = t[n]);
|
|
601
|
+
return e;
|
|
602
|
+
}
|
|
603
|
+
function he(e) {
|
|
604
|
+
let t = pe(Object.assign({
|
|
605
|
+
position: "absolute",
|
|
606
|
+
display: "block",
|
|
607
|
+
borderRadius: "4px",
|
|
608
|
+
paddingTop: "1px",
|
|
609
|
+
paddingBottom: "1px",
|
|
610
|
+
paddingLeft: "4px",
|
|
611
|
+
paddingRight: "4px",
|
|
612
|
+
pointerEvents: "none",
|
|
613
|
+
userSelect: "none",
|
|
614
|
+
zIndex: "99999",
|
|
615
|
+
backgroundColor: "rgba(0,0,0,0.7)",
|
|
616
|
+
fontSize: "12px",
|
|
617
|
+
color: "#fff",
|
|
618
|
+
letterSpacing: "0",
|
|
619
|
+
lineHeight: "18px"
|
|
620
|
+
}, e)), n = () => {
|
|
621
|
+
t.style.display !== "block" && t.style.top && t.style.left && (t.style.display = "block");
|
|
622
|
+
};
|
|
623
|
+
return {
|
|
624
|
+
element: t,
|
|
625
|
+
show: n,
|
|
626
|
+
hide: () => {
|
|
627
|
+
t.style.display = "none", t.style.top = "", t.style.left = "";
|
|
628
|
+
},
|
|
629
|
+
setLeftTop: (e, r) => {
|
|
630
|
+
t.style.left = e, t.style.top = r, n();
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region build/plugins/Object3DHelperPlugin/Helper/MoveHelper.js
|
|
636
|
+
var ge = class extends ne {
|
|
637
|
+
constructor(e, t) {
|
|
638
|
+
super(e, t), this.name = "MoveHelper", (t == null ? void 0 : t.xArrowEnable) !== !1 && (this.xArrow = new se({
|
|
639
|
+
direction: "x",
|
|
640
|
+
color: A.X
|
|
641
|
+
})), (t == null ? void 0 : t.yArrowEnable) !== !1 && (this.yArrow = new se({
|
|
642
|
+
direction: "y",
|
|
643
|
+
color: A.Y
|
|
644
|
+
})), (t == null ? void 0 : t.zArrowEnable) !== !1 && (this.zArrow = new se({
|
|
645
|
+
direction: "z",
|
|
646
|
+
color: A.Z
|
|
647
|
+
})), (t == null ? void 0 : t.centerHandleEnable) !== !1 && (this.centerHandle = new ce()), (t == null ? void 0 : t.xyPlaneEnable) !== !1 && (this.xyPlane = new le({
|
|
648
|
+
direction: "xy",
|
|
649
|
+
color: A.Z
|
|
650
|
+
})), (t == null ? void 0 : t.xzPlaneEnable) !== !1 && (this.xzPlane = new le({
|
|
651
|
+
direction: "xz",
|
|
652
|
+
color: A.Y
|
|
653
|
+
})), (t == null ? void 0 : t.yzPlaneEnable) !== !1 && (this.yzPlane = new le({
|
|
654
|
+
direction: "yz",
|
|
655
|
+
color: A.X
|
|
656
|
+
})), t != null && t.container && (t == null ? void 0 : t.moveTipsEnable) !== !1 && (this.container = t.container, this.moveTips = he({ display: "none" }), this.container.appendChild(this.moveTips.element)), this.add(...[
|
|
657
|
+
this.xArrow,
|
|
658
|
+
this.yArrow,
|
|
659
|
+
this.zArrow,
|
|
660
|
+
this.centerHandle,
|
|
661
|
+
this.xyPlane,
|
|
662
|
+
this.xzPlane,
|
|
663
|
+
this.yzPlane
|
|
664
|
+
].filter(Boolean));
|
|
665
|
+
}
|
|
666
|
+
update(e) {
|
|
667
|
+
if (this.xArrow && (this.xArrow.visible = !0), this.yArrow && (this.yArrow.visible = !0), this.zArrow && (this.zArrow.visible = !0), this.centerHandle && this.centerHandle.update(e), e.type === "OrthographicCamera") {
|
|
668
|
+
let t = new a.Vector3(1, 0, 0).applyQuaternion(this.quaternion), n = new a.Vector3(0, 1, 0).applyQuaternion(this.quaternion), r = new a.Vector3(0, 0, 1).applyQuaternion(this.quaternion), i = e.pose, o = de(i), s = .0872665;
|
|
669
|
+
Math.abs(t.angleTo(o) - 0) < s || Math.abs(t.angleTo(o) - Math.PI) < s ? this.xArrow && (this.xArrow.visible = !1) : Math.abs(n.angleTo(o) - 0) < s || Math.abs(n.angleTo(o) - Math.PI) < s ? this.yArrow && (this.yArrow.visible = !1) : (Math.abs(r.angleTo(o) - 0) < s || Math.abs(r.angleTo(o) - Math.PI) < s) && this.zArrow && (this.zArrow.visible = !1);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
show() {
|
|
673
|
+
var e;
|
|
674
|
+
super.show(), this.xArrow && this.add(this.xArrow), this.yArrow && this.add(this.yArrow), this.zArrow && this.add(this.zArrow), this.centerHandle && this.add(this.centerHandle), this.xyPlane && this.add(this.xyPlane), this.xzPlane && this.add(this.xzPlane), this.yzPlane && this.add(this.yzPlane), (e = this.moveTips) == null || e.hide();
|
|
675
|
+
}
|
|
676
|
+
setScaleByCamera(e) {
|
|
677
|
+
this.scale.setScalar(ue(e, this.position));
|
|
678
|
+
}
|
|
679
|
+
showDraggingHelper(e) {
|
|
680
|
+
this.xArrow && (e.includes("x") ? this.add(this.xArrow) : this.remove(this.xArrow)), this.yArrow && (e.includes("y") ? this.add(this.yArrow) : this.remove(this.yArrow)), this.zArrow && (e.includes("z") ? this.add(this.zArrow) : this.remove(this.zArrow)), this.centerHandle && (e.includes("plane") ? this.add(this.centerHandle) : this.remove(this.centerHandle)), this.xyPlane && (e.includes("xy") ? this.add(this.xyPlane) : this.remove(this.xyPlane)), this.xzPlane && (e.includes("xz") ? this.add(this.xzPlane) : this.remove(this.xzPlane)), this.yzPlane && (e.includes("yz") ? this.add(this.yzPlane) : this.remove(this.yzPlane));
|
|
681
|
+
}
|
|
682
|
+
dispose() {
|
|
683
|
+
var e, t;
|
|
684
|
+
this.remove(...[
|
|
685
|
+
this.xArrow,
|
|
686
|
+
this.yArrow,
|
|
687
|
+
this.zArrow,
|
|
688
|
+
this.centerHandle,
|
|
689
|
+
this.xyPlane,
|
|
690
|
+
this.xzPlane,
|
|
691
|
+
this.yzPlane
|
|
692
|
+
].filter(Boolean)), (t = (e = this.moveTips) == null ? void 0 : e.element) == null || t.remove(), super.dispose();
|
|
693
|
+
}
|
|
694
|
+
}, _e = class extends ie {
|
|
695
|
+
constructor(e, t) {
|
|
696
|
+
super(e, t), this.name = "RotateHelper", this.children = [], (t == null ? void 0 : t.yzCircleEnable) !== !1 && (this.xCircle = new N({
|
|
697
|
+
direction: "x",
|
|
698
|
+
color: A.X
|
|
699
|
+
})), (t == null ? void 0 : t.xzCircleEnable) !== !1 && (this.yCircle = new N({
|
|
700
|
+
direction: "y",
|
|
701
|
+
color: A.Y
|
|
702
|
+
})), (t == null ? void 0 : t.xyCircleEnable) !== !1 && (this.zCircle = new N({
|
|
703
|
+
direction: "z",
|
|
704
|
+
color: A.Z
|
|
705
|
+
})), t != null && t.container && (t == null ? void 0 : t.angleTipsEnable) !== !1 && (this.container = t == null ? void 0 : t.container, this.angleTips = he({ display: "none" }), this.container.appendChild(this.angleTips.element)), this.add(...[
|
|
706
|
+
this.xCircle,
|
|
707
|
+
this.yCircle,
|
|
708
|
+
this.zCircle
|
|
709
|
+
].filter(Boolean)), this.show();
|
|
710
|
+
}
|
|
711
|
+
hide() {
|
|
712
|
+
this.children.forEach((e) => e.hide());
|
|
713
|
+
}
|
|
714
|
+
show() {
|
|
715
|
+
var e;
|
|
716
|
+
this.children.forEach((e) => e.showCircle()), (e = this.angleTips) == null || e.hide();
|
|
717
|
+
}
|
|
718
|
+
setScaleByCamera(e) {
|
|
719
|
+
this.scale.setScalar(ue(e, this.position));
|
|
720
|
+
}
|
|
721
|
+
update(e) {
|
|
722
|
+
if (e.type === "OrthographicCamera") return;
|
|
723
|
+
let t = this.helperObject.position.clone().sub(e.position).normalize(), n = new a.Vector3(1, 0, 0).applyQuaternion(this.quaternion), r = new a.Vector3(0, 1, 0).applyQuaternion(this.quaternion), i = new a.Vector3(0, 0, 1).applyQuaternion(this.quaternion), o = t.angleTo(n), s = t.angleTo(r), c = t.angleTo(i), l = Math.PI / 2, u = s >= l, d = c >= l, f = o >= l;
|
|
724
|
+
if (this.xCircle) {
|
|
725
|
+
let e = this.xCircle.circle.gapAngle;
|
|
726
|
+
u && d ? this.xCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, e, Math.PI / 2 - e * 2) : u && !d ? this.xCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 2 + e, Math.PI / 2 - e * 2) : !u && d ? this.xCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 2 * 3 + e, Math.PI / 2 - e * 2) : !u && !d && (this.xCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI + e, Math.PI / 2 - e * 2)), this.xCircle.angleSector && (this.xCircle.angleSector.offsetAngle = (e) => e, u && d || u && !d ? this.xCircle.angleSector.baseAxes = new a.Vector3(0, 0, 1) : !u && d ? (this.xCircle.angleSector.baseAxes = new a.Vector3(0, -1, 0), this.xCircle.angleSector.offsetAngle = (e) => e - Math.PI / 2) : !u && !d && (this.xCircle.angleSector.baseAxes = new a.Vector3(0, 0, -1), this.xCircle.angleSector.offsetAngle = (e) => e - Math.PI));
|
|
727
|
+
}
|
|
728
|
+
if (this.yCircle) {
|
|
729
|
+
this.yCircle.angleSector.offsetAngle = (e) => e;
|
|
730
|
+
let e = this.yCircle.circle.gapAngle;
|
|
731
|
+
f && d ? this.yCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, e, Math.PI / 2 - e * 2) : f && !d ? this.yCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 2 * 3 + e, Math.PI / 2 - e * 2) : !f && d ? this.yCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 2 + e, Math.PI / 2 - e * 2) : !f && !d && (this.yCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI + e, Math.PI / 2 - e * 2)), f && d ? this.yCircle.angleSector.baseAxes = new a.Vector3(1, 0, 0) : f && !d ? (this.yCircle.angleSector.baseAxes = new a.Vector3(0, 0, -1), this.yCircle.angleSector.offsetAngle = (e) => e - Math.PI / 2) : !f && d ? (this.yCircle.angleSector.baseAxes = new a.Vector3(0, 0, 1), this.yCircle.angleSector.offsetAngle = (e) => e + Math.PI / 2) : !f && !d && (this.yCircle.angleSector.baseAxes = new a.Vector3(-1, 0, 0), this.yCircle.angleSector.offsetAngle = (e) => e + Math.PI);
|
|
732
|
+
}
|
|
733
|
+
if (this.zCircle) {
|
|
734
|
+
this.zCircle.angleSector.offsetAngle = (e) => e;
|
|
735
|
+
let e = this.zCircle.circle.gapAngle;
|
|
736
|
+
f && u ? this.zCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, e, Math.PI / 2 - e * 2) : f && !u ? this.zCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 2 * 3 + e, Math.PI / 2 - e * 2) : !f && u ? this.zCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 2 + e, Math.PI / 2 - e * 2) : !f && !u && (this.zCircle.circle.geometry = new a.RingGeometry(.3, .35, 20, 8, Math.PI + e, Math.PI / 2 - e * 2)), this.zCircle.angleSector && (f && u ? this.zCircle.angleSector.baseAxes = new a.Vector3(1, 0, 0) : f && !u ? (this.zCircle.angleSector.baseAxes = new a.Vector3(0, -1, 0), this.zCircle.angleSector.offsetAngle = (e) => e - Math.PI / 2) : !f && u ? (this.zCircle.angleSector.baseAxes = new a.Vector3(0, 1, 0), this.zCircle.angleSector.offsetAngle = (e) => e + Math.PI / 2) : !f && !u && (this.zCircle.angleSector.baseAxes = new a.Vector3(-1, 0, 0), this.zCircle.angleSector.offsetAngle = (e) => e + Math.PI));
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
showDraggingHelper(e) {
|
|
740
|
+
var t;
|
|
741
|
+
this.hide(), this.children.filter((t) => e.includes(t.direction)).forEach((e) => e.showRing()), (t = this.angleTips) == null || t.show();
|
|
742
|
+
}
|
|
743
|
+
dispose() {
|
|
744
|
+
var e, t;
|
|
745
|
+
this.removeFromParent(), (t = (e = this.angleTips) == null ? void 0 : e.element) == null || t.remove();
|
|
746
|
+
}
|
|
747
|
+
}, N = class extends a.Group {
|
|
748
|
+
constructor(e) {
|
|
749
|
+
super(), this.direction = e.direction, this.circle = new ve(e), this.ring = new ye(e), this.angleSector = new be(e), this.add(this.circle, this.ring, this.angleSector), this.direction === "y" ? this.rotation.x = Math.PI / 2 : this.direction === "x" && (this.rotation.y = -Math.PI / 2);
|
|
750
|
+
}
|
|
751
|
+
showCircle() {
|
|
752
|
+
this.add(this.circle), this.remove(this.ring, this.angleSector);
|
|
753
|
+
}
|
|
754
|
+
showRing() {
|
|
755
|
+
this.add(this.ring, this.angleSector), this.remove(this.circle);
|
|
756
|
+
}
|
|
757
|
+
hide() {
|
|
758
|
+
this.remove(this.ring, this.angleSector, this.circle);
|
|
759
|
+
}
|
|
760
|
+
}, ve = class extends a.Mesh {
|
|
761
|
+
constructor(e) {
|
|
762
|
+
var t;
|
|
763
|
+
super(), this.gapAngle = .02, this.geometry = new a.RingGeometry(.3, .35, 20, 8, this.gapAngle, Math.PI / 2 - this.gapAngle * 2), this.material = new a.MeshBasicMaterial({
|
|
764
|
+
opacity: .6,
|
|
765
|
+
transparent: !0,
|
|
766
|
+
color: (t = e.color) == null ? 16777215 : t,
|
|
767
|
+
side: a.DoubleSide,
|
|
768
|
+
depthTest: !1
|
|
769
|
+
}), this.direction = e.direction, this.renderOrder = j.ROTATE_HELPER, this.geometry.name = `RotateHelperCircleGeometry-${this.direction}`;
|
|
770
|
+
}
|
|
771
|
+
}, ye = class extends a.Group {
|
|
772
|
+
constructor(e) {
|
|
773
|
+
super(), this.direction = e.direction;
|
|
774
|
+
let t = .015, n = Array(8).fill(null).map((e, n) => {
|
|
775
|
+
let r = new a.RingGeometry(.3, .35, 20, 8, Math.PI / 4 * n + t, Math.PI / 4 - t * 2), i = new a.MeshBasicMaterial({
|
|
776
|
+
opacity: 1,
|
|
777
|
+
color: 16777215,
|
|
778
|
+
depthTest: !1,
|
|
779
|
+
depthWrite: !1,
|
|
780
|
+
transparent: !0,
|
|
781
|
+
side: a.DoubleSide
|
|
782
|
+
}), o = new a.Mesh(r, i);
|
|
783
|
+
return o.name = `AxesDashedRing-${this.direction}-${n}`, o;
|
|
784
|
+
});
|
|
785
|
+
this.add(...n);
|
|
786
|
+
}
|
|
787
|
+
}, be = class extends a.Mesh {
|
|
788
|
+
constructor(e) {
|
|
789
|
+
var t;
|
|
790
|
+
switch (super(), this.offsetAngle = (e) => e, e.direction) {
|
|
791
|
+
case "x":
|
|
792
|
+
this.baseAxes = new a.Vector3(0, 0, 1);
|
|
793
|
+
break;
|
|
794
|
+
case "y":
|
|
795
|
+
this.baseAxes = new a.Vector3(1, 0, 0);
|
|
796
|
+
break;
|
|
797
|
+
case "z":
|
|
798
|
+
this.baseAxes = new a.Vector3(1, 0, 0);
|
|
799
|
+
break;
|
|
800
|
+
}
|
|
801
|
+
this.geometry = new a.CircleGeometry(.3505, 48, 0, 1e-4), this.material = new a.MeshBasicMaterial({
|
|
802
|
+
opacity: .4,
|
|
803
|
+
color: (t = e.color) == null ? 16777215 : t,
|
|
804
|
+
depthTest: !1,
|
|
805
|
+
depthWrite: !1,
|
|
806
|
+
transparent: !0,
|
|
807
|
+
side: a.DoubleSide
|
|
808
|
+
}), this.direction = e.direction, this.angleDirection = 1;
|
|
809
|
+
}
|
|
810
|
+
setClockwiseDirection() {
|
|
811
|
+
this.angleDirection = -1;
|
|
812
|
+
}
|
|
813
|
+
setCounterClockwiseDirection() {
|
|
814
|
+
this.angleDirection = 1;
|
|
815
|
+
}
|
|
816
|
+
toggleDirection() {
|
|
817
|
+
this.angleDirection = this.angleDirection === 1 ? -1 : 1;
|
|
818
|
+
}
|
|
819
|
+
setBaseAxes(e) {
|
|
820
|
+
this.baseAxes = e.clone().normalize();
|
|
821
|
+
}
|
|
822
|
+
getDirection() {
|
|
823
|
+
return this.angleDirection === -1 ? "clockwise" : "counterclockwise";
|
|
824
|
+
}
|
|
825
|
+
}, xe = class extends re {
|
|
826
|
+
constructor(e) {
|
|
827
|
+
super(e), this.name = "BoundingBoxHelper", this.positionAttribute = new a.BufferAttribute(/* @__PURE__ */ new Float32Array(24), 3), this.box = this.createBox(), this.outline = this.createOutline(), this.add(this.box, this.outline), this.update();
|
|
828
|
+
}
|
|
829
|
+
initQuaternion() {
|
|
830
|
+
this.quaternion.copy(this.originObject3D.quaternion), this.scale.copy(this.originObject3D.scale);
|
|
831
|
+
}
|
|
832
|
+
setHelperQuaternion(e, t) {
|
|
833
|
+
D(this, e, t);
|
|
834
|
+
}
|
|
835
|
+
raycasterIntersectObject(e, t) {
|
|
836
|
+
return e.intersectObject(this, !1, t);
|
|
837
|
+
}
|
|
838
|
+
raycast(e, t) {
|
|
839
|
+
this.box.raycast(e, t);
|
|
840
|
+
}
|
|
841
|
+
update() {
|
|
842
|
+
let e = new a.Box3(), t = new a.Matrix4().copy(this.originObject3D.matrixWorld).invert(), n = new a.Vector3();
|
|
843
|
+
if (this.originObject3D.updateMatrixWorld(!0), this.originObject3D.traverse((r) => {
|
|
844
|
+
let i = r.geometry;
|
|
845
|
+
if (!i) return;
|
|
846
|
+
r.updateMatrixWorld(!0);
|
|
847
|
+
let o = new a.Matrix4().multiplyMatrices(t, r.matrixWorld);
|
|
848
|
+
if (i.isBufferGeometry) {
|
|
849
|
+
let t = i, r = t.attributes.position;
|
|
850
|
+
if (r) for (let t = 0, i = r.count; t < i; t++) n.fromBufferAttribute(r, t).applyMatrix4(o), e.expandByPoint(n);
|
|
851
|
+
let a = t.attributes.instanceStart, s = t.attributes.instanceEnd;
|
|
852
|
+
if (a) for (let t = 0, r = a.count; t < r; t++) n.fromBufferAttribute(a, t).applyMatrix4(o), e.expandByPoint(n);
|
|
853
|
+
if (s) for (let t = 0, r = s.count; t < r; t++) n.fromBufferAttribute(s, t).applyMatrix4(o), e.expandByPoint(n);
|
|
854
|
+
} else if (i.vertices) {
|
|
855
|
+
let t = i.vertices;
|
|
856
|
+
for (let r of t) n.copy(r).applyMatrix4(o), e.expandByPoint(n);
|
|
857
|
+
}
|
|
858
|
+
}), e.isEmpty()) return;
|
|
859
|
+
let { min: r, max: i } = e;
|
|
860
|
+
this.positionAttribute.setXYZ(0, i.x, i.y, i.z), this.positionAttribute.setXYZ(1, r.x, i.y, i.z), this.positionAttribute.setXYZ(2, r.x, r.y, i.z), this.positionAttribute.setXYZ(3, i.x, r.y, i.z), this.positionAttribute.setXYZ(4, i.x, i.y, r.z), this.positionAttribute.setXYZ(5, r.x, i.y, r.z), this.positionAttribute.setXYZ(6, r.x, r.y, r.z), this.positionAttribute.setXYZ(7, i.x, r.y, r.z), this.positionAttribute.needsUpdate = !0;
|
|
861
|
+
}
|
|
862
|
+
createOutline() {
|
|
863
|
+
let e = new Uint16Array([
|
|
864
|
+
0,
|
|
865
|
+
1,
|
|
866
|
+
1,
|
|
867
|
+
2,
|
|
868
|
+
2,
|
|
869
|
+
3,
|
|
870
|
+
3,
|
|
871
|
+
0,
|
|
872
|
+
4,
|
|
873
|
+
5,
|
|
874
|
+
5,
|
|
875
|
+
6,
|
|
876
|
+
6,
|
|
877
|
+
7,
|
|
878
|
+
7,
|
|
879
|
+
4,
|
|
880
|
+
0,
|
|
881
|
+
4,
|
|
882
|
+
1,
|
|
883
|
+
5,
|
|
884
|
+
2,
|
|
885
|
+
6,
|
|
886
|
+
3,
|
|
887
|
+
7
|
|
888
|
+
]), t = new a.BufferGeometry();
|
|
889
|
+
t.setIndex(new a.BufferAttribute(e, 1)), t.setAttribute("position", this.positionAttribute);
|
|
890
|
+
let n = new a.LineBasicMaterial({
|
|
891
|
+
color: 64767,
|
|
892
|
+
linewidth: 1,
|
|
893
|
+
opacity: 1,
|
|
894
|
+
toneMapped: !1
|
|
895
|
+
}), r = new a.LineSegments(t, n);
|
|
896
|
+
return r.matrixAutoUpdate = !1, r;
|
|
897
|
+
}
|
|
898
|
+
createBox() {
|
|
899
|
+
let e = new Uint16Array([
|
|
900
|
+
0,
|
|
901
|
+
1,
|
|
902
|
+
2,
|
|
903
|
+
0,
|
|
904
|
+
2,
|
|
905
|
+
3,
|
|
906
|
+
0,
|
|
907
|
+
3,
|
|
908
|
+
7,
|
|
909
|
+
0,
|
|
910
|
+
7,
|
|
911
|
+
4,
|
|
912
|
+
0,
|
|
913
|
+
4,
|
|
914
|
+
5,
|
|
915
|
+
0,
|
|
916
|
+
5,
|
|
917
|
+
1,
|
|
918
|
+
6,
|
|
919
|
+
1,
|
|
920
|
+
5,
|
|
921
|
+
6,
|
|
922
|
+
2,
|
|
923
|
+
1,
|
|
924
|
+
6,
|
|
925
|
+
5,
|
|
926
|
+
4,
|
|
927
|
+
6,
|
|
928
|
+
4,
|
|
929
|
+
7,
|
|
930
|
+
6,
|
|
931
|
+
3,
|
|
932
|
+
2,
|
|
933
|
+
6,
|
|
934
|
+
7,
|
|
935
|
+
3
|
|
936
|
+
]), t = new a.BufferGeometry();
|
|
937
|
+
t.setIndex(new a.BufferAttribute(e, 1)), t.setAttribute("position", this.positionAttribute);
|
|
938
|
+
let n = new a.MeshBasicMaterial({
|
|
939
|
+
color: 64767,
|
|
940
|
+
opacity: .1,
|
|
941
|
+
depthTest: !1,
|
|
942
|
+
transparent: !0
|
|
943
|
+
});
|
|
944
|
+
return new a.Mesh(t, n);
|
|
945
|
+
}
|
|
946
|
+
}, P = /* @__PURE__ */ new Map();
|
|
947
|
+
function Se(e) {
|
|
948
|
+
if (P.has(e)) return P.get(e).hooks;
|
|
949
|
+
let t = new r(), n = null, i, a = () => {
|
|
950
|
+
n = requestAnimationFrame(a);
|
|
951
|
+
let r = e.projectionMatrix.toArray().join(",") + e.matrixWorld.toArray().join(",");
|
|
952
|
+
r !== i && (i = r, t.emit("cameraUpdate"));
|
|
953
|
+
};
|
|
954
|
+
return a(), P.set(e, {
|
|
955
|
+
hooks: t,
|
|
956
|
+
dispose: () => {
|
|
957
|
+
P.delete(e), cancelAnimationFrame(n);
|
|
958
|
+
}
|
|
959
|
+
}), t;
|
|
960
|
+
}
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region build/plugins/Object3DHelperPlugin/Controllers/BaseController.js
|
|
963
|
+
function Ce(e) {
|
|
964
|
+
return arguments.length === 0 ? [] : Array.isArray(e) ? e : [e];
|
|
965
|
+
}
|
|
966
|
+
var F = class {
|
|
967
|
+
updateOtherControllers(e) {
|
|
968
|
+
this.otherControllers = e;
|
|
969
|
+
}
|
|
970
|
+
getIsDragging() {
|
|
971
|
+
return this.isDragging;
|
|
972
|
+
}
|
|
973
|
+
constructor(e, t) {
|
|
974
|
+
var n, i, o;
|
|
975
|
+
this.preventTapDefaultEvent = !1, this.disposers = [], this.isDragging = !1, this.enabled = !1, this.name = "BaseController", this.onWantsTapGesture = (e) => {
|
|
976
|
+
if (this.getIntersectObject(e)) return !1;
|
|
977
|
+
}, this.updateHelperScale = () => {
|
|
978
|
+
"update" in this.helperObject3D && typeof this.helperObject3D.update == "function" && this.helperObject3D.update(this.camera), this.helperObject3D.setScaleByCamera(this.camera);
|
|
979
|
+
}, this.getBox = () => (this.boundingBox || (this.boundingBox = new a.Box3().expandByObject(this.originObject3D)), this.boundingBox), this.hooks = (n = e.sharedHooks) == null ? new r() : n, this.internalHooks = (i = e.sharedInternalHooks) == null ? new r() : i, this.camera = e.camera, this.model = e.model, this.originObject3D = e.originObject3D, this.helperObject3D = e.helperObject3D, this.container = e.container, this.scene = e.scene, this.domEvents = e.domEvents, this.onRender = (o = e.onRender) == null ? (() => {}) : o, this.config = t == null ? {} : t, this.otherControllers = e.otherControllers, this.initialHelperPosition(), this.initialHelperQuaternion(), this.updateHelperScale(), this.cameraHooks = Se(this.camera), this.enable();
|
|
980
|
+
let s = this.onSetOriginObjectScale.bind(this), c = this.onSetOriginObjectRotate.bind(this), l = this.onSetOriginObjectPosition.bind(this), u = this.onApplyOriginObjectScale.bind(this), d = this.onApplyOriginObjectRotate.bind(this), f = this.onApplyOriginObjectPosition.bind(this), p = this.initialHelperPosition.bind(this);
|
|
981
|
+
this.cameraHooks.on("cameraUpdate", this.updateHelperScale), this.internalHooks.on("initialHelperPosition", p), this.internalHooks.on("setObjectScale", s), this.internalHooks.on("setObjectRotate", c), this.internalHooks.on("setObjectPosition", l), this.internalHooks.on("applyObjectPosition", f), this.internalHooks.on("applyObjectRotate", d), this.internalHooks.on("applyObjectScale", u), this.hooks.on("moveEnd", this.updateHelperScale), this.internalHooks.on("setObjectPosition", this.updateHelperScale), this.internalHooks.on("initialHelperPosition", this.updateHelperScale), this.disposers.push(() => {
|
|
982
|
+
this.cameraHooks.off("cameraUpdate", this.updateHelperScale), this.internalHooks.off("initialHelperPosition", p), this.internalHooks.off("setObjectScale", s), this.internalHooks.off("setObjectRotate", c), this.internalHooks.off("setObjectPosition", l), this.internalHooks.off("applyObjectPosition", f), this.internalHooks.off("applyObjectRotate", d), this.internalHooks.off("applyObjectScale", u), this.hooks.off("moveEnd", this.updateHelperScale), this.internalHooks.off("setObjectPosition", this.updateHelperScale), this.internalHooks.off("initialHelperPosition", this.updateHelperScale);
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
initialHelperPosition() {
|
|
986
|
+
this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset));
|
|
987
|
+
}
|
|
988
|
+
initialHelperQuaternion() {
|
|
989
|
+
this.helperObject3D.initQuaternion(this.config);
|
|
990
|
+
}
|
|
991
|
+
enable() {
|
|
992
|
+
this.enabled || (this.enabled = !0, this.scene.add(this.helperObject3D), this.helperObject3D.enable(), this.render());
|
|
993
|
+
}
|
|
994
|
+
disable() {
|
|
995
|
+
this.enabled && (this.enabled = !1, this.helperObject3D.disable(), this.render());
|
|
996
|
+
}
|
|
997
|
+
show() {
|
|
998
|
+
this.helperObject3D.show(), this.render();
|
|
999
|
+
}
|
|
1000
|
+
hide() {
|
|
1001
|
+
this.helperObject3D.hide(), this.render();
|
|
1002
|
+
}
|
|
1003
|
+
dispose() {
|
|
1004
|
+
var e;
|
|
1005
|
+
(e = this.disposers) == null || e.forEach((e) => e == null ? void 0 : e()), this.helperObject3D.dispose(), this.render();
|
|
1006
|
+
}
|
|
1007
|
+
applyHelperMatrix4(e) {
|
|
1008
|
+
this.helperObject3D.applyMatrix4(e);
|
|
1009
|
+
}
|
|
1010
|
+
applyHelperQuaternion(e, t) {
|
|
1011
|
+
this.helperObject3D.applyHelperQuaternion(e, t);
|
|
1012
|
+
}
|
|
1013
|
+
applyHelperScaleMatrix4(e, t) {
|
|
1014
|
+
this.helperObject3D.applyHelperScaleMatrix4(e, t);
|
|
1015
|
+
}
|
|
1016
|
+
onWantsGesture(e, t, n) {
|
|
1017
|
+
if (this.isDragging) return !1;
|
|
1018
|
+
}
|
|
1019
|
+
onIntersectionOnModelUpdate(e) {}
|
|
1020
|
+
onApplyOriginObjectScale(e) {
|
|
1021
|
+
this.applyHelperScaleMatrix4(e.matrix, e.origin);
|
|
1022
|
+
}
|
|
1023
|
+
onApplyOriginObjectRotate(e) {
|
|
1024
|
+
let t = e.origin;
|
|
1025
|
+
if (t) {
|
|
1026
|
+
let n = new a.Vector3().subVectors(this.helperObject3D.position, t).applyQuaternion(e.quaternion).add(t);
|
|
1027
|
+
this.helperObject3D.position.copy(n);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
onApplyOriginObjectPosition(e) {
|
|
1031
|
+
this.applyHelperMatrix4(e.matrix);
|
|
1032
|
+
}
|
|
1033
|
+
onSetOriginObjectScale(e) {
|
|
1034
|
+
this.helperObject3D.scale.copy(e), this.updateOffsetByScale(e);
|
|
1035
|
+
}
|
|
1036
|
+
onSetOriginObjectRotate(e, t) {}
|
|
1037
|
+
onSetOriginObjectPosition(e) {
|
|
1038
|
+
this.helperObject3D.position.copy(e.clone().add(this.calculateOffset(this.config.offset)));
|
|
1039
|
+
}
|
|
1040
|
+
render() {
|
|
1041
|
+
this.onRender();
|
|
1042
|
+
}
|
|
1043
|
+
updateOffsetByScale(e) {
|
|
1044
|
+
if (this.boundingBox && this.config.offset) {
|
|
1045
|
+
let t = this.originObject3D.position, n = new a.Vector3().subVectors(this.boundingBox.max, t).multiply(e).add(t), r = new a.Vector3().subVectors(this.boundingBox.min, t).multiply(e).add(t), i = this.calculateOffset(this.config.offset, {
|
|
1046
|
+
min: r,
|
|
1047
|
+
max: n
|
|
1048
|
+
});
|
|
1049
|
+
this.helperObject3D.initialPosition(i);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
hoverListener(e, t = 16777215, n = 1) {
|
|
1053
|
+
let r = Ce(e).filter((e) => !te(e)), i = [];
|
|
1054
|
+
for (let e of r) if (e.material || e instanceof a.Group) {
|
|
1055
|
+
let r = e instanceof a.Group ? e.children.filter((e) => e instanceof a.Mesh) : [e];
|
|
1056
|
+
r.forEach((e) => {
|
|
1057
|
+
var t, n, r, i;
|
|
1058
|
+
let a = e.material;
|
|
1059
|
+
Array.isArray(a) ? (e.__originalColor__ = (t = e.__originalColor__) == null ? a.map((e) => e.color.clone()) : t, e.__originalOpacity__ = (n = e.__originalOpacity__) == null ? a.map((e) => e.opacity) : n) : (e.__originalColor__ = (r = e.__originalColor__) == null ? a.color.clone() : r, e.__originalOpacity__ = (i = e.__originalOpacity__) == null ? a.opacity : i);
|
|
1060
|
+
});
|
|
1061
|
+
let o = () => {
|
|
1062
|
+
r.forEach((e) => {
|
|
1063
|
+
if (e.name === "ScaleHelperTransparentGroup") {
|
|
1064
|
+
if (e.children[0]) {
|
|
1065
|
+
let r = e.children[0].material;
|
|
1066
|
+
r.color.set(t), r.opacity = n;
|
|
1067
|
+
}
|
|
1068
|
+
} else {
|
|
1069
|
+
let r = e.material;
|
|
1070
|
+
Array.isArray(r) ? r.forEach((e) => {
|
|
1071
|
+
e.color.set(t), e.opacity = n;
|
|
1072
|
+
}) : (r.color.set(t), r.opacity = n);
|
|
1073
|
+
}
|
|
1074
|
+
}), this.render();
|
|
1075
|
+
}, s = () => {
|
|
1076
|
+
r.forEach((e) => {
|
|
1077
|
+
if (e.name === "ScaleHelperTransparentGroup") {
|
|
1078
|
+
if (e.children[0]) {
|
|
1079
|
+
let t = e.children[0].material;
|
|
1080
|
+
t.color.set(16776960), t.opacity = 1;
|
|
1081
|
+
}
|
|
1082
|
+
} else {
|
|
1083
|
+
let t = e.material;
|
|
1084
|
+
if (Array.isArray(t)) {
|
|
1085
|
+
let n = e.__originalColor__, r = e.__originalOpacity__;
|
|
1086
|
+
t.forEach((e, t) => {
|
|
1087
|
+
n && n[t] && e.color.copy(n[t]), r && r[t] !== void 0 && (e.opacity = r[t]);
|
|
1088
|
+
});
|
|
1089
|
+
} else t.color.copy(e.__originalColor__), t.opacity = e.__originalOpacity__;
|
|
1090
|
+
}
|
|
1091
|
+
}), this.render();
|
|
1092
|
+
}, c = (e) => {
|
|
1093
|
+
this.isDragging || o();
|
|
1094
|
+
}, l = (e) => {
|
|
1095
|
+
this.isDragging || s();
|
|
1096
|
+
};
|
|
1097
|
+
for (let e of r) this.domEvents.addEventListener(e, "mouseover", c), this.domEvents.addEventListener(e, "mouseout", l), this.hooks.on("moveStart", o), this.hooks.on("moveEnd", s), this.hooks.on("rotateEnd", s), this.hooks.on("scaleEnd", s), i.push(() => {
|
|
1098
|
+
this.domEvents.removeEventListener(e, "mouseover", c), this.domEvents.removeEventListener(e, "mouseout", l), this.hooks.off("moveStart", o), this.hooks.off("moveEnd", s), this.hooks.off("rotateEnd", s), this.hooks.off("scaleEnd", s);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
return () => i.forEach((e) => e == null ? void 0 : e());
|
|
1102
|
+
}
|
|
1103
|
+
getIntersectObject(e) {
|
|
1104
|
+
let t = this.camera.position, n = this.helperObject3D;
|
|
1105
|
+
if (!n) return;
|
|
1106
|
+
let r = this.helperObject3D.raycasterIntersectObject(e)[0];
|
|
1107
|
+
if (!r) return;
|
|
1108
|
+
let i = r;
|
|
1109
|
+
if (i.object = n, this.model.intersectRaycaster) {
|
|
1110
|
+
let n = this.model.intersectRaycaster(e)[0];
|
|
1111
|
+
if (n && n.point.distanceTo(t) < i.point.distanceTo(t)) return;
|
|
1112
|
+
}
|
|
1113
|
+
return i.object;
|
|
1114
|
+
}
|
|
1115
|
+
calculateOffset(e, t) {
|
|
1116
|
+
let n = new a.Vector3(0, 0, 0);
|
|
1117
|
+
if (!e) return n;
|
|
1118
|
+
let r = () => t || this.getBox();
|
|
1119
|
+
if (typeof e.x == "number") n.setX(e.x);
|
|
1120
|
+
else if (typeof e.x == "object") {
|
|
1121
|
+
let t = r();
|
|
1122
|
+
n.setX((t.max.x - t.min.x) * e.x.percents);
|
|
1123
|
+
}
|
|
1124
|
+
if (typeof e.y == "number") n.setY(e.y);
|
|
1125
|
+
else if (typeof e.y == "object") {
|
|
1126
|
+
let t = r();
|
|
1127
|
+
n.setY((t.max.y - t.min.y) * e.y.percents);
|
|
1128
|
+
}
|
|
1129
|
+
if (typeof e.z == "number") n.setZ(e.z);
|
|
1130
|
+
else if (typeof e.z == "object") {
|
|
1131
|
+
let t = r();
|
|
1132
|
+
n.setZ((t.max.z - t.min.z) * e.z.percents);
|
|
1133
|
+
}
|
|
1134
|
+
return n;
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region build/plugins/Object3DHelperPlugin/utils/solidGuide.js
|
|
1139
|
+
function we(e, t) {
|
|
1140
|
+
let n = 10, r = 10, i = e.isPerspectiveCamera, a = e.isOrthographicCamera;
|
|
1141
|
+
if (i) {
|
|
1142
|
+
let i = e, a = i.position.distanceTo(t), o = i.fov * Math.PI / 180;
|
|
1143
|
+
r = 2 * Math.tan(o / 2) * a, n = r * i.aspect;
|
|
1144
|
+
} else if (a) {
|
|
1145
|
+
let t = e;
|
|
1146
|
+
n = Math.abs(t.right - t.left), r = Math.abs(t.top - t.bottom);
|
|
1147
|
+
}
|
|
1148
|
+
let o = Math.sqrt(n * n + r * r), s = o * .8, c = Math.min(n, r) * .25, l = o * 1.2;
|
|
1149
|
+
return Math.max(c, Math.min(s, l));
|
|
1150
|
+
}
|
|
1151
|
+
var Te = class {
|
|
1152
|
+
constructor(e, t, n) {
|
|
1153
|
+
this.camera = e, this.container = t, this.defaults = Object.assign({}, n || {});
|
|
1154
|
+
}
|
|
1155
|
+
createSolidLine(e, t, n) {
|
|
1156
|
+
let r = Object.assign(Object.assign({
|
|
1157
|
+
color: 16777215,
|
|
1158
|
+
renderOrder: j.DRAG_GUIDE_LINE
|
|
1159
|
+
}, this.defaults), n || {}), i = t.clone().normalize(), o = this.computeInfiniteLineLength(e), s = e.clone().add(i.clone().multiplyScalar(-o)), c = e.clone().add(i.clone().multiplyScalar(o)), l = new Float32Array([
|
|
1160
|
+
s.x,
|
|
1161
|
+
s.y,
|
|
1162
|
+
s.z,
|
|
1163
|
+
c.x,
|
|
1164
|
+
c.y,
|
|
1165
|
+
c.z
|
|
1166
|
+
]), u = new a.BufferGeometry();
|
|
1167
|
+
u.setAttribute("position", new a.BufferAttribute(l, 3));
|
|
1168
|
+
let d = new a.LineBasicMaterial({
|
|
1169
|
+
color: r.color,
|
|
1170
|
+
depthTest: !1,
|
|
1171
|
+
depthWrite: !1,
|
|
1172
|
+
transparent: !0,
|
|
1173
|
+
opacity: .65
|
|
1174
|
+
}), f = new a.Line(u, d);
|
|
1175
|
+
return f.renderOrder = r.renderOrder, f;
|
|
1176
|
+
}
|
|
1177
|
+
updateSolidLine(e, t, n, r) {
|
|
1178
|
+
let i = n.clone().normalize(), o = this.computeInfiniteLineLength(t), s = t.clone().add(i.clone().multiplyScalar(-o)), c = t.clone().add(i.clone().multiplyScalar(o)), l = new Float32Array([
|
|
1179
|
+
s.x,
|
|
1180
|
+
s.y,
|
|
1181
|
+
s.z,
|
|
1182
|
+
c.x,
|
|
1183
|
+
c.y,
|
|
1184
|
+
c.z
|
|
1185
|
+
]), u = e.geometry, d = u.getAttribute("position");
|
|
1186
|
+
d && d.itemSize === 3 && d.array.length === l.length ? (d.array.set(l), d.needsUpdate = !0) : u.setAttribute("position", new a.BufferAttribute(l, 3)), (r == null ? void 0 : r.color) !== void 0 && e.material.color.setHex(r.color);
|
|
1187
|
+
}
|
|
1188
|
+
computeInfiniteLineLength(e) {
|
|
1189
|
+
return we(this.camera, e) * 10;
|
|
1190
|
+
}
|
|
1191
|
+
dispose(e) {
|
|
1192
|
+
if (!e) return;
|
|
1193
|
+
e.geometry.dispose();
|
|
1194
|
+
let t = e.material;
|
|
1195
|
+
Array.isArray(t) ? t.forEach((e) => e.dispose()) : t.dispose();
|
|
1196
|
+
}
|
|
1197
|
+
updateDefaults(e) {
|
|
1198
|
+
this.defaults = Object.assign(Object.assign({}, this.defaults), e);
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region build/five/utils/calculateThreeMouse.js
|
|
1203
|
+
function Ee(e, t, n) {
|
|
1204
|
+
let { top: r, left: i, width: o, height: s } = t.getBoundingClientRect();
|
|
1205
|
+
return n && (i += o * n.left, r += s * (1 - n.bottom - n.height), o *= n.width, s *= n.height), new a.Vector2((e.x - i) / o * 2 - 1, -(e.y - r) / s * 2 + 1);
|
|
1206
|
+
}
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region build/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js
|
|
1209
|
+
function De(e, t, n) {
|
|
1210
|
+
if (!t || !n || !e) return;
|
|
1211
|
+
let r = Ee(t, n);
|
|
1212
|
+
if (Math.abs(r.x) === 1 || Math.abs(r.y) === 1) return;
|
|
1213
|
+
let i = new a.Raycaster();
|
|
1214
|
+
return i.setFromCamera(r, e), i.params.Points && (i.params.Points.threshold = .1), i;
|
|
1215
|
+
}
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region build/plugins/Object3DHelperPlugin/Controllers/MoveController.js
|
|
1218
|
+
function Oe(e) {
|
|
1219
|
+
let { raycaster: t, line: n, clampToLine: r = !0 } = e, i = new a.Plane().setFromNormalAndCoplanarPoint(t.ray.direction.clone().normalize(), new a.Vector3()), o = i.projectPoint(n.start, new a.Vector3()), s = i.projectPoint(n.end, new a.Vector3()), c = new a.Line3(o, s), l = c.closestPointToPoint(t.ray.origin, r, new a.Vector3()), u = l.distanceTo(s), d = l.distanceTo(o), f = c.distance();
|
|
1220
|
+
if (u > d && u > f) {
|
|
1221
|
+
let e = -l.distanceTo(o) / f, t = n.start.clone().sub(n.end).normalize();
|
|
1222
|
+
return n.start.clone().sub(t.clone().multiplyScalar(e * n.distance()));
|
|
1223
|
+
} else {
|
|
1224
|
+
let e = l.distanceTo(o) / f;
|
|
1225
|
+
return new a.Vector3().lerpVectors(n.start, n.end, e);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
var ke = class extends F {
|
|
1229
|
+
get moveByMouseEnable() {
|
|
1230
|
+
return this._moveByMouse.enabled;
|
|
1231
|
+
}
|
|
1232
|
+
constructor(...e) {
|
|
1233
|
+
var t, n, r, i, o;
|
|
1234
|
+
super(...e), this.name = "MoveController", this.solidGuide = new Te(this.camera, this.container, (n = (t = this.config) == null ? void 0 : t.solidGuide) == null ? {} : n), this._moveByMouse = { enabled: !1 }, this.dragStart = (e) => {
|
|
1235
|
+
if (this.moveByMouseEnable || this.isDragging) return;
|
|
1236
|
+
let t = e == null ? void 0 : e.intersect;
|
|
1237
|
+
if (!t) return this.dragEnd();
|
|
1238
|
+
let n = (t == null ? void 0 : t.object).direction;
|
|
1239
|
+
if (!n) return this.dragEnd();
|
|
1240
|
+
let r = new a.Vector3(1, 0, 0), i = new a.Vector3(0, 1, 0), o = new a.Vector3(0, 0, 1), s = (() => {
|
|
1241
|
+
switch (n) {
|
|
1242
|
+
case "x": return r;
|
|
1243
|
+
case "y": return i;
|
|
1244
|
+
case "z": return o;
|
|
1245
|
+
case "xy":
|
|
1246
|
+
case "xz":
|
|
1247
|
+
case "yz":
|
|
1248
|
+
case "plane": return;
|
|
1249
|
+
}
|
|
1250
|
+
})(), c = t.point.clone();
|
|
1251
|
+
if (n === "xy" || n === "xz" || n === "yz") {
|
|
1252
|
+
let e = (() => {
|
|
1253
|
+
switch (n) {
|
|
1254
|
+
case "xy": return o;
|
|
1255
|
+
case "xz": return i;
|
|
1256
|
+
case "yz": return r;
|
|
1257
|
+
}
|
|
1258
|
+
})(), t = new a.Plane().setFromNormalAndCoplanarPoint(e, c), s = c.clone();
|
|
1259
|
+
this.startInfo = {
|
|
1260
|
+
draggingDirection: n,
|
|
1261
|
+
startVectorProject: s,
|
|
1262
|
+
line: new a.Line3(s.clone(), s.clone()),
|
|
1263
|
+
plane: t
|
|
1264
|
+
};
|
|
1265
|
+
} else if (n === "plane") {
|
|
1266
|
+
let e = this.camera.position.clone(), t = c.clone(), r = t.clone().sub(e).normalize(), i = new a.Plane().setFromNormalAndCoplanarPoint(r, t), o = t.clone();
|
|
1267
|
+
this.startInfo = {
|
|
1268
|
+
draggingDirection: n,
|
|
1269
|
+
startVectorProject: o,
|
|
1270
|
+
line: new a.Line3(o.clone(), o.clone()),
|
|
1271
|
+
plane: i
|
|
1272
|
+
};
|
|
1273
|
+
} else {
|
|
1274
|
+
if (!s) return this.dragEnd();
|
|
1275
|
+
let e = new a.Line3(c.clone().sub(s.normalize()), c.clone().add(s.normalize()));
|
|
1276
|
+
this.startInfo = {
|
|
1277
|
+
draggingDirection: n,
|
|
1278
|
+
startVectorProject: c,
|
|
1279
|
+
line: e
|
|
1280
|
+
};
|
|
1281
|
+
try {
|
|
1282
|
+
let e = s.clone().normalize(), t = this.helperObject3D.getWorldPosition(new a.Vector3()), n = this.solidGuide.createSolidLine(t, e, {
|
|
1283
|
+
color: 16777215,
|
|
1284
|
+
renderOrder: j.DRAG_GUIDE_LINE
|
|
1285
|
+
});
|
|
1286
|
+
this.scene.add(n), this.dragGuideLine = n;
|
|
1287
|
+
} catch (e) {}
|
|
1288
|
+
}
|
|
1289
|
+
let l = (() => {
|
|
1290
|
+
switch (n) {
|
|
1291
|
+
case "plane": return [];
|
|
1292
|
+
case "xy": return [
|
|
1293
|
+
"x",
|
|
1294
|
+
"y",
|
|
1295
|
+
"xy"
|
|
1296
|
+
];
|
|
1297
|
+
case "xz": return [
|
|
1298
|
+
"x",
|
|
1299
|
+
"z",
|
|
1300
|
+
"xz"
|
|
1301
|
+
];
|
|
1302
|
+
case "yz": return [
|
|
1303
|
+
"y",
|
|
1304
|
+
"z",
|
|
1305
|
+
"yz"
|
|
1306
|
+
];
|
|
1307
|
+
default: return [n];
|
|
1308
|
+
}
|
|
1309
|
+
})();
|
|
1310
|
+
this.helperObject3D.showDraggingHelper(l), this.hooks.emit("moveStart", n), this.isDragging = !0, this.setTipsText(this.originObject3D.position), this.setTipsPosition(c);
|
|
1311
|
+
}, this.dragging = (e) => {
|
|
1312
|
+
if (!this.isDragging || !this.startInfo) return;
|
|
1313
|
+
let t = "touches" in e ? e.touches[0].clientX : e.x, n = "touches" in e ? e.touches[0].clientY : e.y, r = De(this.camera, {
|
|
1314
|
+
x: t,
|
|
1315
|
+
y: n
|
|
1316
|
+
}, this.container);
|
|
1317
|
+
return r ? (this.move(r), !1) : this.dragEnd();
|
|
1318
|
+
}, this.dragEnd = () => {
|
|
1319
|
+
if (this.isDragging) {
|
|
1320
|
+
if (this.startInfo = void 0, this.isDragging = !1, this.dragGuideLine) {
|
|
1321
|
+
this.scene.remove(this.dragGuideLine), this.dragGuideLine.geometry.dispose();
|
|
1322
|
+
let e = this.dragGuideLine.material;
|
|
1323
|
+
Array.isArray(e) ? e.forEach((e) => e.dispose()) : e.dispose(), this.dragGuideLine = void 0;
|
|
1324
|
+
}
|
|
1325
|
+
this.helperObject3D.show(), this.hooks.emit("moveEnd");
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
let s = this.helperObject3D;
|
|
1329
|
+
if (this.hoverListener([
|
|
1330
|
+
s.xArrow,
|
|
1331
|
+
s.yArrow,
|
|
1332
|
+
s.zArrow,
|
|
1333
|
+
(r = s.xyPlane) == null ? void 0 : r.handle,
|
|
1334
|
+
(i = s.xzPlane) == null ? void 0 : i.handle,
|
|
1335
|
+
(o = s.yzPlane) == null ? void 0 : o.handle
|
|
1336
|
+
]), s.centerHandle && s.centerHandle instanceof ce) {
|
|
1337
|
+
let e = s.centerHandle, t = e.cube;
|
|
1338
|
+
this.domEvents.addEventListener(t, "mouseover", () => {
|
|
1339
|
+
this.isDragging || (Array.isArray(t.material) && t.material.forEach((e) => {
|
|
1340
|
+
e.color.set(16777215);
|
|
1341
|
+
}), this.render());
|
|
1342
|
+
}), this.domEvents.addEventListener(t, "mouseout", () => {
|
|
1343
|
+
this.isDragging || (e.update(this.camera), this.render());
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
let c = this.show.bind(this), l = this.hide.bind(this), u = () => {
|
|
1347
|
+
this.helperObject3D.update(this.camera), this.isDragging && this.updateDragGuideLineScale(), this.render();
|
|
1348
|
+
};
|
|
1349
|
+
u(), this.domEvents.addEventListener(this.helperObject3D, "mousedown", this.dragStart), document.addEventListener("mousemove", this.dragging), document.addEventListener("mouseup", this.dragEnd), this.domEvents.addEventListener(this.helperObject3D, "touchstart", this.dragStart), document.addEventListener("touchmove", this.dragging), document.addEventListener("touchend", this.dragEnd), this.hooks.on("rotateStart", l), this.hooks.on("rotateEnd", c), this.hooks.on("scaleStart", l), this.hooks.on("scaleEnd", c), this.hooks.on("moveByMouseEnable", l), this.hooks.on("moveByMouseDisable", c), this.hooks.on("updateOtherHelpers", (e) => {
|
|
1350
|
+
this.helperObject3D.update(e.camera), this.render();
|
|
1351
|
+
}), this.cameraHooks.on("cameraUpdate", u), this.disposers.push(() => {
|
|
1352
|
+
this.domEvents.removeEventListener(this.helperObject3D, "mousedown", this.dragStart), document.removeEventListener("mousemove", this.dragging), document.removeEventListener("mouseup", this.dragEnd), this.domEvents.removeEventListener(this.helperObject3D, "touchstart", this.dragStart), document.removeEventListener("touchmove", this.dragging), document.removeEventListener("touchend", this.dragEnd), this.hooks.off("rotateStart", l), this.hooks.off("rotateEnd", c), this.hooks.off("scaleStart", l), this.hooks.off("scaleEnd", c), this.hooks.off("moveByMouseEnable", l), this.hooks.off("moveByMouseDisable", c), this.hooks.off("updateOtherHelpers"), this.cameraHooks.off("cameraUpdate", u);
|
|
1353
|
+
}), this.moveByMouseEnable && this.moveByMouse();
|
|
1354
|
+
}
|
|
1355
|
+
dispose() {
|
|
1356
|
+
var e;
|
|
1357
|
+
super.dispose(), (e = this.disposers) == null || e.forEach((e) => e == null ? void 0 : e());
|
|
1358
|
+
}
|
|
1359
|
+
moveByMouse(e) {
|
|
1360
|
+
this._moveByMouse = {
|
|
1361
|
+
enabled: !0,
|
|
1362
|
+
useFaceNormal: e == null ? void 0 : e.useFaceNormal
|
|
1363
|
+
}, this.preventTapDefaultEvent = !0;
|
|
1364
|
+
let t = this.handleMouseDown.bind(this), n = this.handleMouseUp.bind(this);
|
|
1365
|
+
this.hooks.emit("moveByMouseEnable"), setTimeout(() => {
|
|
1366
|
+
this.container.addEventListener("mousedown", t), this.container.addEventListener("mouseup", n);
|
|
1367
|
+
}), this.mousedownEventListenerDisposer = () => {
|
|
1368
|
+
this.container.removeEventListener("mousedown", t), this.container.removeEventListener("mouseup", n);
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
disableMoveByMouse() {
|
|
1372
|
+
var e;
|
|
1373
|
+
this._moveByMouse = { enabled: !1 }, this.preventTapDefaultEvent = !1, this.hooks.emit("moveByMouseDisable"), (e = this.mousedownEventListenerDisposer) == null || e.call(this);
|
|
1374
|
+
}
|
|
1375
|
+
onIntersectionOnModelUpdate(e) {
|
|
1376
|
+
var t, n, r;
|
|
1377
|
+
if (!this.moveByMouseEnable) return;
|
|
1378
|
+
let { point: i, face: o } = e;
|
|
1379
|
+
if (!this.hooks.emit("wantToMove", i)) {
|
|
1380
|
+
if (this.originObject3D.position.copy(i), (this._moveByMouse.useFaceNormal === !0 || typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.enable !== !1) && o != null && o.normal) {
|
|
1381
|
+
let e = typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.alignmentVector ? this._moveByMouse.useFaceNormal.alignmentVector : {
|
|
1382
|
+
x: 0,
|
|
1383
|
+
y: 1,
|
|
1384
|
+
z: 0
|
|
1385
|
+
}, i = new a.Vector3((t = e.x) == null ? 0 : t, (n = e.y) == null ? 0 : n, (r = e.z) == null ? 0 : r), s = typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.fixedFaceNormal ? this._moveByMouse.useFaceNormal.fixedFaceNormal(o.normal) : o.normal;
|
|
1386
|
+
this.originObject3D.quaternion.setFromUnitVectors(i, s), this.internalHooks.emit("setObjectRotate", this.originObject3D.quaternion.clone(), new a.Vector3());
|
|
1387
|
+
}
|
|
1388
|
+
this.internalHooks.emit("setObjectPosition", i), this.hooks.emit("move", i);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
handleMouseDown(e) {
|
|
1392
|
+
let { x: t, y: n } = e;
|
|
1393
|
+
this.mouseInfo = {
|
|
1394
|
+
x: t,
|
|
1395
|
+
y: n,
|
|
1396
|
+
mouseDownTimestamp: Date.now()
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
handleMouseUp(e) {
|
|
1400
|
+
if (!this.mouseInfo) return;
|
|
1401
|
+
let { x: t, y: n } = e;
|
|
1402
|
+
this.mouseInfo.x === t && this.mouseInfo.y === n && Date.now() - this.mouseInfo.mouseDownTimestamp < 500 && (this.disableMoveByMouse(), this.mouseInfo = void 0);
|
|
1403
|
+
}
|
|
1404
|
+
updateDragGuideLineScale() {
|
|
1405
|
+
if (!this.dragGuideLine || !this.startInfo) return;
|
|
1406
|
+
let { line: e } = this.startInfo, t = e.end.clone().sub(e.start).normalize();
|
|
1407
|
+
if (t.lengthSq() < 1e-6) return;
|
|
1408
|
+
let n = this.helperObject3D.getWorldPosition(new a.Vector3());
|
|
1409
|
+
this.solidGuide.updateSolidLine(this.dragGuideLine, n, t);
|
|
1410
|
+
}
|
|
1411
|
+
move(e) {
|
|
1412
|
+
if (!this.startInfo) return this.dragEnd();
|
|
1413
|
+
let { line: t, startVectorProject: n } = this.startInfo, r = this.originObject3D, i = this.startInfo.draggingDirection === "plane" || this.startInfo.draggingDirection === "xy" || this.startInfo.draggingDirection === "xz" || this.startInfo.draggingDirection === "yz", o;
|
|
1414
|
+
if (i) {
|
|
1415
|
+
let t = this.startInfo.plane;
|
|
1416
|
+
if (!t) return;
|
|
1417
|
+
let n = new a.Vector3(), r = t.normal.dot(e.ray.direction);
|
|
1418
|
+
if (Math.abs(r) < 1e-6) return;
|
|
1419
|
+
let i = -(t.normal.dot(e.ray.origin) + t.constant) / r;
|
|
1420
|
+
if (i < 0) return;
|
|
1421
|
+
n.copy(e.ray.origin.clone().add(e.ray.direction.clone().multiplyScalar(i))), o = n;
|
|
1422
|
+
} else o = Oe({
|
|
1423
|
+
raycaster: e,
|
|
1424
|
+
line: t,
|
|
1425
|
+
clampToLine: !1
|
|
1426
|
+
});
|
|
1427
|
+
let s = r.position.clone(), c = o.clone().sub(n), l = new a.Matrix4();
|
|
1428
|
+
l.setPosition(c);
|
|
1429
|
+
let u = r.position.clone().applyMatrix4(l);
|
|
1430
|
+
if (this.hooks.emit("wantToMove", u)) return;
|
|
1431
|
+
let d = u.clone();
|
|
1432
|
+
this.hooks.emit("moveBefore", d);
|
|
1433
|
+
let f = new a.Matrix4();
|
|
1434
|
+
f.setPosition(d.clone().sub(s)), r.position.copy(d), this.setTipsText(d), this.setTipsPosition(d), n.copy(o), this.internalHooks.emit("applyObjectPosition", { matrix: f }), this.hooks.emit("move", d);
|
|
1435
|
+
}
|
|
1436
|
+
setTipsText(e) {
|
|
1437
|
+
var t;
|
|
1438
|
+
let n = (t = this.helperObject3D.moveTips) == null ? void 0 : t.element;
|
|
1439
|
+
if (!n || !this.startInfo) return;
|
|
1440
|
+
let r = this.startInfo.draggingDirection, i = (e) => e.toFixed(3);
|
|
1441
|
+
switch (r) {
|
|
1442
|
+
case "x":
|
|
1443
|
+
n.innerText = `x: ${i(e.x)}`;
|
|
1444
|
+
break;
|
|
1445
|
+
case "y":
|
|
1446
|
+
n.innerText = `y: ${i(e.y)}`;
|
|
1447
|
+
break;
|
|
1448
|
+
case "z":
|
|
1449
|
+
n.innerText = `z: ${i(e.z)}`;
|
|
1450
|
+
break;
|
|
1451
|
+
case "xy":
|
|
1452
|
+
n.innerText = `x: ${i(e.x)} y: ${i(e.y)}`;
|
|
1453
|
+
break;
|
|
1454
|
+
case "xz":
|
|
1455
|
+
n.innerText = `x: ${i(e.x)} z: ${i(e.z)}`;
|
|
1456
|
+
break;
|
|
1457
|
+
case "yz":
|
|
1458
|
+
n.innerText = `y: ${i(e.y)} z: ${i(e.z)}`;
|
|
1459
|
+
break;
|
|
1460
|
+
case "plane":
|
|
1461
|
+
n.innerText = `x: ${i(e.x)} y: ${i(e.y)} z: ${i(e.z)}`;
|
|
1462
|
+
break;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
setTipsPosition(e) {
|
|
1466
|
+
let t = this.helperObject3D.moveTips;
|
|
1467
|
+
if (!t) return;
|
|
1468
|
+
let { x: n, y: r, z: i } = this.helperObject3D.getWorldPosition(new a.Vector3()).clone().project(this.camera);
|
|
1469
|
+
if (i > 1) {
|
|
1470
|
+
t.hide();
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
let o = this.container.getBoundingClientRect(), s = (n + 1) / 2 * o.width, c = (-r + 1) / 2 * o.height;
|
|
1474
|
+
t.setLeftTop(s + "px", c + "px");
|
|
1475
|
+
}
|
|
1476
|
+
}, I = class {
|
|
1477
|
+
constructor(e, t, n, r, i, a, o, s, c) {
|
|
1478
|
+
this.onFiveWantsTapGesture = (e) => {
|
|
1479
|
+
if (!this.helperController) return;
|
|
1480
|
+
if (this.helperController.preventTapDefaultEvent) return !1;
|
|
1481
|
+
let t = this.helperController.onWantsTapGesture(e);
|
|
1482
|
+
return this.five.needsRender = !0, t;
|
|
1483
|
+
}, this.onFiveWantsGesture = (...e) => {
|
|
1484
|
+
if (!this.helperController) return;
|
|
1485
|
+
let t = this.helperController.onWantsGesture(...e);
|
|
1486
|
+
return this.five.needsRender = !0, t;
|
|
1487
|
+
}, this.onFiveIntersectionOnModelUpdate = (...e) => {
|
|
1488
|
+
this.helperController && this.helperController.onIntersectionOnModelUpdate(...e);
|
|
1489
|
+
};
|
|
1490
|
+
let { camera: l, model: u, scene: d } = e, f = e.getElement();
|
|
1491
|
+
if (this.five = e, !l || !u || !f || !d) return;
|
|
1492
|
+
let p = c == null ? d : c, m = () => {
|
|
1493
|
+
e.needsRender = !0;
|
|
1494
|
+
};
|
|
1495
|
+
this.helperController = new n({
|
|
1496
|
+
camera: l,
|
|
1497
|
+
model: u,
|
|
1498
|
+
domEvents: t,
|
|
1499
|
+
originObject3D: r,
|
|
1500
|
+
helperObject3D: i,
|
|
1501
|
+
container: f,
|
|
1502
|
+
scene: p,
|
|
1503
|
+
onRender: m,
|
|
1504
|
+
sharedHooks: o,
|
|
1505
|
+
sharedInternalHooks: s
|
|
1506
|
+
}, a), e.on("wantsTapGesture", this.onFiveWantsTapGesture), e.on("wantsGesture", this.onFiveWantsGesture), e.on("intersectionOnModelUpdate", this.onFiveIntersectionOnModelUpdate);
|
|
1507
|
+
}
|
|
1508
|
+
dispose() {
|
|
1509
|
+
var e;
|
|
1510
|
+
this.five.off("wantsTapGesture", this.onFiveWantsTapGesture), this.five.off("wantsGesture", this.onFiveWantsGesture), this.five.off("intersectionOnModelUpdate", this.onFiveIntersectionOnModelUpdate), (e = this.helperController) == null || e.dispose();
|
|
1511
|
+
}
|
|
1512
|
+
}, Ae = new a.Quaternion(), je = class extends F {
|
|
1513
|
+
get rotateCenter() {
|
|
1514
|
+
return this.helperObject3D.position.clone();
|
|
1515
|
+
}
|
|
1516
|
+
constructor(...e) {
|
|
1517
|
+
var t, n, r;
|
|
1518
|
+
super(...e), this.name = "RotateController", this.solidGuide = new Te(this.camera, this.container), this.snapGuideLines = [];
|
|
1519
|
+
let i = this.helperObject3D;
|
|
1520
|
+
this.hoverListener([
|
|
1521
|
+
(t = i.xCircle) == null ? void 0 : t.circle,
|
|
1522
|
+
(n = i.yCircle) == null ? void 0 : n.circle,
|
|
1523
|
+
(r = i.zCircle) == null ? void 0 : r.circle
|
|
1524
|
+
].filter(Boolean));
|
|
1525
|
+
let a = this.dragStart.bind(this), o = this.dragging.bind(this), s = this.dragEnd.bind(this), c = this.show.bind(this), l = this.hide.bind(this), u = () => {
|
|
1526
|
+
this.helperObject3D.update(this.camera), this.render();
|
|
1527
|
+
};
|
|
1528
|
+
u(), this.domEvents.addEventListener(this.helperObject3D, "mousedown", a), document.addEventListener("mousemove", o), document.addEventListener("mouseup", s), this.domEvents.addEventListener(this.helperObject3D, "touchstart", a), document.addEventListener("touchmove", o), document.addEventListener("touchend", s), this.hooks.on("moveStart", l), this.hooks.on("moveEnd", c), this.hooks.on("scaleStart", l), this.hooks.on("scaleEnd", c), this.hooks.on("moveByMouseEnable", l), this.hooks.on("moveByMouseDisable", c), this.hooks.on("updateOtherHelpers", (e) => {
|
|
1529
|
+
this.helperObject3D.update(e.camera), this.render();
|
|
1530
|
+
}), this.cameraHooks.on("cameraUpdate", u), this.disposers.push(() => {
|
|
1531
|
+
this.domEvents.removeEventListener(this.helperObject3D, "mousedown", a), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s), this.domEvents.removeEventListener(this.helperObject3D, "touchstart", a), document.removeEventListener("touchmove", o), document.removeEventListener("touchend", s), this.hooks.off("moveStart", l), this.hooks.off("moveEnd", c), this.hooks.off("scaleStart", l), this.hooks.off("scaleEnd", c), this.hooks.off("moveByMouseEnable", l), this.hooks.off("moveByMouseDisable", c), this.hooks.off("updateOtherHelpers"), this.cameraHooks.off("cameraUpdate", u);
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
setRotateAngle(e) {
|
|
1535
|
+
let { x: t = 0, y: n = 0, z: r = 0 } = e, i = new a.Euler(a.MathUtils.degToRad(t), a.MathUtils.degToRad(n), a.MathUtils.degToRad(r)), o = new a.Quaternion().setFromEuler(i);
|
|
1536
|
+
if (this.hooks.emit("wantToRotate", o)) return;
|
|
1537
|
+
let { originObject3D: s, rotateCenter: c } = this;
|
|
1538
|
+
D(s, o, c), this.internalHooks.emit("setObjectRotate", o, c), this.hooks.emit("rotate", o), this.render();
|
|
1539
|
+
}
|
|
1540
|
+
getEulerAngle(e, t) {
|
|
1541
|
+
let { originObject3D: n } = this, r = new a.Euler().setFromQuaternion(n.quaternion), i = {
|
|
1542
|
+
x: a.MathUtils.radToDeg(r.x),
|
|
1543
|
+
y: a.MathUtils.radToDeg(r.y),
|
|
1544
|
+
z: a.MathUtils.radToDeg(r.z)
|
|
1545
|
+
}, o = {
|
|
1546
|
+
x: e === "x" ? t : i.x,
|
|
1547
|
+
y: e === "y" ? t : i.y,
|
|
1548
|
+
z: e === "z" ? t : i.z
|
|
1549
|
+
}, s = new a.Euler(a.MathUtils.degToRad(o.x), a.MathUtils.degToRad(o.y), a.MathUtils.degToRad(o.z));
|
|
1550
|
+
return new a.Quaternion().setFromEuler(s);
|
|
1551
|
+
}
|
|
1552
|
+
onApplyOriginObjectRotate(e) {
|
|
1553
|
+
this.isDragging || super.onApplyOriginObjectRotate(e);
|
|
1554
|
+
}
|
|
1555
|
+
onApplyOriginObjectScale(e) {}
|
|
1556
|
+
dragStart(e) {
|
|
1557
|
+
if (this.isDragging) return;
|
|
1558
|
+
this.helperObject3D.update(this.camera);
|
|
1559
|
+
let t = e == null ? void 0 : e.intersect;
|
|
1560
|
+
if (!t) return this.dragEnd();
|
|
1561
|
+
let n = (t == null ? void 0 : t.object).direction;
|
|
1562
|
+
if (!n) return this.dragEnd();
|
|
1563
|
+
let r = t.point;
|
|
1564
|
+
this.setTipsAngle(0);
|
|
1565
|
+
let i = r.clone();
|
|
1566
|
+
i.y += .2, this.setTipsPosition(i);
|
|
1567
|
+
let o = new a.Quaternion(), s = n === "x" ? new a.Vector3(1, 0, 0) : n === "y" ? new a.Vector3(0, 1, 0) : n === "z" ? new a.Vector3(0, 0, 1) : new a.Vector3(0, 1, 0), c = new a.Plane().setFromNormalAndCoplanarPoint(s, r), l = c.projectPoint(r.clone(), new a.Vector3()).clone().sub(this.rotateCenter), u = this.getAngleHelper(n);
|
|
1568
|
+
if (!u) return this.dragEnd();
|
|
1569
|
+
let d = l.angleTo(u.baseAxes.clone().applyQuaternion(o)), f = u.offsetAngle(d);
|
|
1570
|
+
this.setAngleHelperStart(n, f), this.setAngleHelperLength(n, 0), this.startInfo = {
|
|
1571
|
+
direction: n,
|
|
1572
|
+
startVector: l,
|
|
1573
|
+
directionVector: s,
|
|
1574
|
+
plane: c,
|
|
1575
|
+
angleHelper: u,
|
|
1576
|
+
angle: 0,
|
|
1577
|
+
helperQuaternion: o.clone(),
|
|
1578
|
+
startQuaternion: this.originObject3D.quaternion.clone()
|
|
1579
|
+
}, Ae = new a.Quaternion(), this.helperObject3D.showDraggingHelper([n]), this.hooks.emit("rotateStart", n), this.isDragging = !0;
|
|
1580
|
+
}
|
|
1581
|
+
getMatrix() {
|
|
1582
|
+
var e, t;
|
|
1583
|
+
return (t = (e = this.originObject3D) == null ? void 0 : e.ext) == null ? void 0 : t.matrix;
|
|
1584
|
+
}
|
|
1585
|
+
getMatrixAngle(e, t) {
|
|
1586
|
+
let n;
|
|
1587
|
+
if (e && e.isMatrix4) {
|
|
1588
|
+
n = new a.Quaternion(), e.decompose(new a.Vector3(), n, new a.Vector3());
|
|
1589
|
+
let r = new a.Euler().setFromQuaternion(n);
|
|
1590
|
+
if (t === "x") return Math.round(a.MathUtils.radToDeg(r.z));
|
|
1591
|
+
if (t === "y") return Math.round(a.MathUtils.radToDeg(r.y));
|
|
1592
|
+
if (t === "z") return Math.round(a.MathUtils.radToDeg(r.x));
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
parseAngleByDirection(e) {
|
|
1596
|
+
var t, n;
|
|
1597
|
+
let r = (n = (t = this.originObject3D) == null ? void 0 : t.ext) == null ? void 0 : n.matrix, i;
|
|
1598
|
+
if (r && r.isMatrix4) {
|
|
1599
|
+
i = new a.Quaternion(), r.decompose(new a.Vector3(), i, new a.Vector3());
|
|
1600
|
+
let t = new a.Euler().setFromQuaternion(i);
|
|
1601
|
+
if (e === "x") return Math.round(a.MathUtils.radToDeg(t.z));
|
|
1602
|
+
if (e === "y") return Math.round(a.MathUtils.radToDeg(t.y));
|
|
1603
|
+
if (e === "z") return Math.round(a.MathUtils.radToDeg(t.x));
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
dragging(e) {
|
|
1607
|
+
if (!this.isDragging) return;
|
|
1608
|
+
let t = "touches" in e ? e.touches[0].clientX : e.x, n = "touches" in e ? e.touches[0].clientY : e.y, r = De(this.camera, {
|
|
1609
|
+
x: t,
|
|
1610
|
+
y: n
|
|
1611
|
+
}, this.container);
|
|
1612
|
+
return r ? (this.rotate(r), !1) : this.dragEnd();
|
|
1613
|
+
}
|
|
1614
|
+
rotate(e) {
|
|
1615
|
+
if (!this.startInfo) return this.dragEnd();
|
|
1616
|
+
let { startVector: t, plane: n, angleHelper: r, direction: i, helperQuaternion: o } = this.startInfo, { originObject3D: s } = this, c = e.ray.intersectPlane(n, new a.Vector3());
|
|
1617
|
+
if (!c) return;
|
|
1618
|
+
let l = this.rotateCenter.clone(), u = n.projectPoint(c.clone(), new a.Vector3()).clone().sub(l), d = this.startInfo.directionVector.clone().normalize();
|
|
1619
|
+
u = u.clone().projectOnPlane(d).normalize().multiplyScalar(u.length());
|
|
1620
|
+
let f = new a.Quaternion().setFromUnitVectors(t.clone().normalize(), u.clone().normalize()), p = s.quaternion.clone().premultiply(f);
|
|
1621
|
+
if (t.angleTo(u) === 0 || this.hooks.emit("wantToRotate", p)) return;
|
|
1622
|
+
let m = new a.Euler().setFromQuaternion(new a.Quaternion().setFromUnitVectors(t.clone().normalize().applyQuaternion(o.clone().invert()), u.clone().normalize().applyQuaternion(o.clone().invert())), `${i.toUpperCase()}${"XZY".replace(i.toUpperCase(), "")}`)[i] * r.angleDirection, h = this.startInfo.angle, g = h + m, _ = Math.PI / 2, v = a.MathUtils.degToRad(5), y = a.MathUtils.degToRad(10), b = new a.Quaternion().setFromAxisAngle(d, g), x = this.startInfo.startQuaternion.clone().premultiply(b), S = this.extractAxisAngle(x, d), C = Math.round(S / _) * _, ee = Math.abs(S - C);
|
|
1623
|
+
if (Math.abs(g) > y && ee < v) {
|
|
1624
|
+
let e = C - S;
|
|
1625
|
+
g += e;
|
|
1626
|
+
}
|
|
1627
|
+
let w = g - h;
|
|
1628
|
+
this.startInfo.angle = g;
|
|
1629
|
+
let T = Math.abs(w) < 1e-6 && Math.abs(m) > 1e-6, E = this.snapGuideLines.length > 0;
|
|
1630
|
+
T && !E ? this.showSnapGuideLines(i, l) : !T && E && this.removeSnapGuideLines(), this.setAngleHelperLength(i, this.startInfo.angle), this.setTipsAngle(a.MathUtils.radToDeg(this.startInfo.angle));
|
|
1631
|
+
let D = new a.Quaternion().setFromAxisAngle(d, w);
|
|
1632
|
+
if (l) {
|
|
1633
|
+
let e = new a.Vector3().subVectors(s.position, l).applyQuaternion(D).add(l);
|
|
1634
|
+
s.position.copy(e);
|
|
1635
|
+
}
|
|
1636
|
+
s.applyQuaternion(D), Ae.premultiply(D), this.internalHooks.emit("applyObjectRotate", {
|
|
1637
|
+
quaternion: D,
|
|
1638
|
+
origin: l
|
|
1639
|
+
}), this.hooks.emit("rotate", s.quaternion), T || (this.startInfo.startVector = u);
|
|
1640
|
+
}
|
|
1641
|
+
dragEnd() {
|
|
1642
|
+
var e;
|
|
1643
|
+
this.isDragging && (this.removeSnapGuideLines(), (e = this.startInfo) != null && e.lineMeshes && this.startInfo.lineMeshes.forEach((e) => {
|
|
1644
|
+
this.scene.remove(e), e.geometry.dispose(), e.material instanceof a.Material && e.material.dispose();
|
|
1645
|
+
}), this.startInfo = void 0, this.isDragging = !1, this.helperObject3D.show(), this.updateOtherHelpers(), this.hooks.emit("rotateEnd"));
|
|
1646
|
+
}
|
|
1647
|
+
updateOtherHelpers() {
|
|
1648
|
+
this.hooks.emit("updateOtherHelpers", { camera: this.camera });
|
|
1649
|
+
}
|
|
1650
|
+
getAngleHelper(e) {
|
|
1651
|
+
var t, n, r;
|
|
1652
|
+
switch (e) {
|
|
1653
|
+
case "x": return (t = this.helperObject3D.xCircle) == null ? void 0 : t.angleSector;
|
|
1654
|
+
case "y": return (n = this.helperObject3D.yCircle) == null ? void 0 : n.angleSector;
|
|
1655
|
+
case "z": return (r = this.helperObject3D.zCircle) == null ? void 0 : r.angleSector;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
setAngleHelperStart(e, t) {
|
|
1659
|
+
let n = this.getAngleHelper(e);
|
|
1660
|
+
if (!n) {
|
|
1661
|
+
console.warn("angleHelper is undefined");
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
if (n instanceof a.Mesh && n.geometry instanceof a.CircleGeometry) {
|
|
1665
|
+
let { radius: e, segments: r, thetaLength: i } = n.geometry.parameters;
|
|
1666
|
+
n.geometry = new a.CircleGeometry(e, r, t, i);
|
|
1667
|
+
} else console.warn("only support THREE.CircleGeometry");
|
|
1668
|
+
}
|
|
1669
|
+
setAngleHelperLength(e, t) {
|
|
1670
|
+
let n = e === "x" || e === "y" ? -t : t, r = n >= 0 ? Math.max(n, .001) : Math.min(n, -.001), i = this.getAngleHelper(e);
|
|
1671
|
+
if (i instanceof a.Mesh && i.geometry instanceof a.CircleGeometry) {
|
|
1672
|
+
let { radius: e, thetaStart: t } = i.geometry.parameters, n = Math.ceil(Math.abs(r) * (40 / (2 * Math.PI)));
|
|
1673
|
+
i.geometry = new a.CircleGeometry(e, n, t, r);
|
|
1674
|
+
} else console.warn("only support THREE.CircleGeometry");
|
|
1675
|
+
}
|
|
1676
|
+
setTipsAngle(e) {
|
|
1677
|
+
var t;
|
|
1678
|
+
let n = (t = this.helperObject3D.angleTips) == null ? void 0 : t.element;
|
|
1679
|
+
n && (n.innerText = `${e.toFixed(0)}°`);
|
|
1680
|
+
}
|
|
1681
|
+
setTipsPosition(e) {
|
|
1682
|
+
let t = this.helperObject3D.angleTips;
|
|
1683
|
+
if (!t) return;
|
|
1684
|
+
let { x: n, y: r, z: i } = this.helperObject3D.getWorldPosition(new a.Vector3()).clone().project(this.camera);
|
|
1685
|
+
if (i > 1) {
|
|
1686
|
+
t.hide();
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
let o = this.container.getBoundingClientRect(), s = (n + 1) / 2 * o.width, c = (-r + 1) / 2 * o.height;
|
|
1690
|
+
t.setLeftTop(s + "px", c + "px");
|
|
1691
|
+
}
|
|
1692
|
+
extractAxisAngle(e, t) {
|
|
1693
|
+
let n = t.clone().normalize(), r = e.x * n.x + e.y * n.y + e.z * n.z, i = e.w, a = 2 * Math.atan2(r, i);
|
|
1694
|
+
return Math.atan2(Math.sin(a), Math.cos(a));
|
|
1695
|
+
}
|
|
1696
|
+
showSnapGuideLines(e, t) {
|
|
1697
|
+
this.removeSnapGuideLines();
|
|
1698
|
+
let n = (() => {
|
|
1699
|
+
switch (e) {
|
|
1700
|
+
case "x": return [new a.Vector3(0, 1, 0), new a.Vector3(0, 0, 1)];
|
|
1701
|
+
case "y": return [new a.Vector3(1, 0, 0), new a.Vector3(0, 0, 1)];
|
|
1702
|
+
case "z": return [new a.Vector3(1, 0, 0), new a.Vector3(0, 1, 0)];
|
|
1703
|
+
default: return [];
|
|
1704
|
+
}
|
|
1705
|
+
})();
|
|
1706
|
+
for (let e of n) {
|
|
1707
|
+
let n = this.solidGuide.createSolidLine(t, e, {
|
|
1708
|
+
color: 16777215,
|
|
1709
|
+
renderOrder: j.DRAG_GUIDE_LINE
|
|
1710
|
+
});
|
|
1711
|
+
this.scene.add(n), this.snapGuideLines.push(n);
|
|
1712
|
+
}
|
|
1713
|
+
this.render();
|
|
1714
|
+
}
|
|
1715
|
+
removeSnapGuideLines() {
|
|
1716
|
+
for (let e of this.snapGuideLines) this.scene.remove(e), this.solidGuide.dispose(e);
|
|
1717
|
+
this.snapGuideLines = [];
|
|
1718
|
+
}
|
|
1719
|
+
}, Me = class extends F {
|
|
1720
|
+
constructor(...e) {
|
|
1721
|
+
super(...e), this.name = "BoundingBoxController";
|
|
1722
|
+
let t = () => {
|
|
1723
|
+
this.syncWithObject(), this.render();
|
|
1724
|
+
};
|
|
1725
|
+
this.hooks.on("moveEnd", t), this.hooks.on("rotateEnd", t), this.hooks.on("scaleEnd", t), this.disposers.push(() => {
|
|
1726
|
+
this.hooks.off("moveEnd", t), this.hooks.off("rotateEnd", t), this.hooks.off("scaleEnd", t);
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
onApplyOriginObjectRotate(e) {
|
|
1730
|
+
this.helperObject3D.applyHelperQuaternion(e.quaternion, e.origin);
|
|
1731
|
+
}
|
|
1732
|
+
onSetOriginObjectRotate(e, t) {
|
|
1733
|
+
this.helperObject3D.setHelperQuaternion(e, t);
|
|
1734
|
+
}
|
|
1735
|
+
syncWithObject() {
|
|
1736
|
+
this.helperObject3D.position.copy(this.originObject3D.position), this.helperObject3D.quaternion.copy(this.originObject3D.quaternion), this.helperObject3D.scale.copy(this.originObject3D.scale);
|
|
1737
|
+
let e = this.helperObject3D;
|
|
1738
|
+
e.update && e.update();
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
//#endregion
|
|
1742
|
+
//#region build/plugins/thirdParty/domevents.js
|
|
1743
|
+
function L(e, t) {
|
|
1744
|
+
this._camera = e || null, this._domElement = t || document, this._raycaster = new a.Raycaster(), this._selected = null, this._boundObjs = {};
|
|
1745
|
+
var n = this;
|
|
1746
|
+
this._$onClick = function() {
|
|
1747
|
+
n._onClick.apply(n, arguments);
|
|
1748
|
+
}, this._$onDblClick = function() {
|
|
1749
|
+
n._onDblClick.apply(n, arguments);
|
|
1750
|
+
}, this._$onMouseMove = function() {
|
|
1751
|
+
n._onMouseMove.apply(n, arguments);
|
|
1752
|
+
}, this._$onMouseDown = function() {
|
|
1753
|
+
n._onMouseDown.apply(n, arguments);
|
|
1754
|
+
}, this._$onMouseUp = function() {
|
|
1755
|
+
n._onMouseUp.apply(n, arguments);
|
|
1756
|
+
}, this._$onTouchMove = function() {
|
|
1757
|
+
n._onTouchMove.apply(n, arguments);
|
|
1758
|
+
}, this._$onTouchStart = function() {
|
|
1759
|
+
n._onTouchStart.apply(n, arguments);
|
|
1760
|
+
}, this._$onTouchEnd = function() {
|
|
1761
|
+
n._onTouchEnd.apply(n, arguments);
|
|
1762
|
+
}, this._$onContextmenu = function() {
|
|
1763
|
+
n._onContextmenu.apply(n, arguments);
|
|
1764
|
+
}, this._domElement.addEventListener("click", this._$onClick, !1), this._domElement.addEventListener("dblclick", this._$onDblClick, !1), this._domElement.addEventListener("mousemove", this._$onMouseMove, !1), this._domElement.addEventListener("mousedown", this._$onMouseDown, !1), this._domElement.addEventListener("mouseup", this._$onMouseUp, !1), this._domElement.addEventListener("touchmove", this._$onTouchMove, !1), this._domElement.addEventListener("touchstart", this._$onTouchStart, !1), this._domElement.addEventListener("touchend", this._$onTouchEnd, !1), this._domElement.addEventListener("contextmenu", this._$onContextmenu, !1);
|
|
1765
|
+
}
|
|
1766
|
+
L.prototype.destroy = function() {
|
|
1767
|
+
this._domElement.removeEventListener("click", this._$onClick, !1), this._domElement.removeEventListener("dblclick", this._$onDblClick, !1), this._domElement.removeEventListener("mousemove", this._$onMouseMove, !1), this._domElement.removeEventListener("mousedown", this._$onMouseDown, !1), this._domElement.removeEventListener("mouseup", this._$onMouseUp, !1), this._domElement.removeEventListener("touchmove", this._$onTouchMove, !1), this._domElement.removeEventListener("touchstart", this._$onTouchStart, !1), this._domElement.removeEventListener("touchend", this._$onTouchEnd, !1), this._domElement.removeEventListener("contextmenu", this._$onContextmenu, !1);
|
|
1768
|
+
}, L.eventNames = [
|
|
1769
|
+
"click",
|
|
1770
|
+
"dblclick",
|
|
1771
|
+
"mouseover",
|
|
1772
|
+
"mouseout",
|
|
1773
|
+
"mousemove",
|
|
1774
|
+
"mousedown",
|
|
1775
|
+
"mouseup",
|
|
1776
|
+
"contextmenu",
|
|
1777
|
+
"touchstart",
|
|
1778
|
+
"touchend"
|
|
1779
|
+
], L.prototype._getRelativeMouseXY = function(e) {
|
|
1780
|
+
var t = e.target || e.srcElement;
|
|
1781
|
+
t.nodeType === 3 && (t = t.parentNode);
|
|
1782
|
+
var n = {
|
|
1783
|
+
x: 0,
|
|
1784
|
+
y: 0
|
|
1785
|
+
}, r = t, i = getComputedStyle(r, null);
|
|
1786
|
+
n.y += parseInt(i.getPropertyValue("padding-top"), 10), n.x += parseInt(i.getPropertyValue("padding-left"), 10);
|
|
1787
|
+
do
|
|
1788
|
+
n.x += r.offsetLeft, n.y += r.offsetTop, i = getComputedStyle(r, null), n.x += parseInt(i.getPropertyValue("border-left-width"), 10), n.y += parseInt(i.getPropertyValue("border-top-width"), 10);
|
|
1789
|
+
while (r = r.offsetParent);
|
|
1790
|
+
var a = {
|
|
1791
|
+
width: t === window ? window.innerWidth : t.offsetWidth,
|
|
1792
|
+
height: t === window ? window.innerHeight : t.offsetHeight
|
|
1793
|
+
};
|
|
1794
|
+
return {
|
|
1795
|
+
x: Number((e.pageX - n.x) / a.width) * 2 - 1,
|
|
1796
|
+
y: -((e.pageY - n.y) / a.height) * 2 + 1
|
|
1797
|
+
};
|
|
1798
|
+
}, L.prototype._objectCtxInit = function(e) {
|
|
1799
|
+
e._3xDomEvent = {};
|
|
1800
|
+
}, L.prototype._objectCtxDeinit = function(e) {
|
|
1801
|
+
delete e._3xDomEvent;
|
|
1802
|
+
}, L.prototype._objectCtxIsInit = function(e) {
|
|
1803
|
+
return !!e._3xDomEvent;
|
|
1804
|
+
}, L.prototype._objectCtxGet = function(e) {
|
|
1805
|
+
return e._3xDomEvent;
|
|
1806
|
+
}, L.prototype.camera = function(e) {
|
|
1807
|
+
return e && (this._camera = e), this._camera;
|
|
1808
|
+
}, L.prototype.bind = function(e, t, n, r) {
|
|
1809
|
+
console.assert(L.eventNames.indexOf(t) !== -1, "not available events:" + t), this._objectCtxIsInit(e) || this._objectCtxInit(e);
|
|
1810
|
+
var i = this._objectCtxGet(e);
|
|
1811
|
+
i[t + "Handlers"] || (i[t + "Handlers"] = []), i[t + "Handlers"].push({
|
|
1812
|
+
callback: n,
|
|
1813
|
+
useCapture: r
|
|
1814
|
+
}), this._boundObjs[t] === void 0 && (this._boundObjs[t] = []), this._boundObjs[t].push(e);
|
|
1815
|
+
}, L.prototype.addEventListener = L.prototype.bind, L.prototype.unbind = function(e, t, n, r) {
|
|
1816
|
+
console.assert(L.eventNames.indexOf(t) !== -1, "not available events:" + t), this._objectCtxIsInit(e) || this._objectCtxInit(e);
|
|
1817
|
+
var i = this._objectCtxGet(e);
|
|
1818
|
+
i[t + "Handlers"] || (i[t + "Handlers"] = []);
|
|
1819
|
+
for (var a = i[t + "Handlers"], o = 0; o < a.length; o++) {
|
|
1820
|
+
var s = a[o];
|
|
1821
|
+
if (n == s.callback && r == s.useCapture) {
|
|
1822
|
+
a.splice(o, 1);
|
|
1823
|
+
break;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
var c = this._boundObjs[t].indexOf(e);
|
|
1827
|
+
this._boundObjs[t].splice(c, 1);
|
|
1828
|
+
}, L.prototype.removeEventListener = L.prototype.unbind, L.prototype._bound = function(e, t) {
|
|
1829
|
+
var n = this._objectCtxGet(t);
|
|
1830
|
+
return n ? !!n[e + "Handlers"] : !1;
|
|
1831
|
+
}, L.prototype._isObjectVisible = function(e) {
|
|
1832
|
+
for (var t = e; t;) {
|
|
1833
|
+
if (t.visible === !1) return !1;
|
|
1834
|
+
t = t.parent;
|
|
1835
|
+
}
|
|
1836
|
+
return !0;
|
|
1837
|
+
}, L.prototype._filterVisibleObjects = function(e) {
|
|
1838
|
+
var t = this;
|
|
1839
|
+
return e.filter(function(e) {
|
|
1840
|
+
return t._isObjectVisible(e);
|
|
1841
|
+
});
|
|
1842
|
+
}, L.prototype._onMove = function(e, t, n, r) {
|
|
1843
|
+
var i = this._boundObjs[e];
|
|
1844
|
+
if (!(i === void 0 || i.length === 0)) {
|
|
1845
|
+
var o = this._filterVisibleObjects(i);
|
|
1846
|
+
if (o.length !== 0) {
|
|
1847
|
+
var s = new a.Vector2();
|
|
1848
|
+
s.set(t, n), this._raycaster.setFromCamera(s, this._camera);
|
|
1849
|
+
var c = this._raycaster.intersectObjects(o), l = this;
|
|
1850
|
+
c = c.filter(function(e) {
|
|
1851
|
+
return l._isObjectVisible(e.object);
|
|
1852
|
+
}), c.sort(function(e, t) {
|
|
1853
|
+
var n = e.object.renderOrder || 0, r = t.object.renderOrder || 0;
|
|
1854
|
+
return n === r ? e.distance - t.distance : r - n;
|
|
1855
|
+
});
|
|
1856
|
+
var u = this._selected;
|
|
1857
|
+
if (c.length > 0) {
|
|
1858
|
+
var d, f, p, m = c[0], h = m.object;
|
|
1859
|
+
this._selected = h, p = this._bound("mousemove", h), u != h && (d = this._bound("mouseover", h), f = u && this._bound("mouseout", u));
|
|
1860
|
+
} else f = u && this._bound("mouseout", u), this._selected = null;
|
|
1861
|
+
p && this._notify("mousemove", h, r, m), d && this._notify("mouseover", h, r, m), f && this._notify("mouseout", u, r, m);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}, L.prototype._onEvent = function(e, t, n, r) {
|
|
1865
|
+
var i = this._boundObjs[e];
|
|
1866
|
+
if (!(i === void 0 || i.length === 0)) {
|
|
1867
|
+
var o = this._filterVisibleObjects(i);
|
|
1868
|
+
if (o.length !== 0) {
|
|
1869
|
+
var s = new a.Vector2();
|
|
1870
|
+
s.set(t, n), this._raycaster.setFromCamera(s, this._camera);
|
|
1871
|
+
var c = this._raycaster.intersectObjects(o, !0), l = this;
|
|
1872
|
+
if (c = c.filter(function(e) {
|
|
1873
|
+
return l._isObjectVisible(e.object);
|
|
1874
|
+
}), c.sort(function(e, t) {
|
|
1875
|
+
var n = e.object.renderOrder || 0, r = t.object.renderOrder || 0;
|
|
1876
|
+
return n === r ? e.distance - t.distance : r - n;
|
|
1877
|
+
}), c.length !== 0) {
|
|
1878
|
+
for (var u = c[0], d = u.object, f = this._objectCtxGet(d), p = d.parent; f === void 0 && p;) f = this._objectCtxGet(p), p = p.parent;
|
|
1879
|
+
f && this._notify(e, d, r, u);
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
}, L.prototype._notify = function(e, t, n, r) {
|
|
1884
|
+
var i = this._objectCtxGet(t), a = i ? i[e + "Handlers"] : null;
|
|
1885
|
+
if (!i || !a || a.length === 0) {
|
|
1886
|
+
t.parent && this._notify(e, t.parent, n, r);
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
for (var a = i[e + "Handlers"], o = 0; o < a.length; o++) {
|
|
1890
|
+
var s = a[o], c = !0;
|
|
1891
|
+
s.callback({
|
|
1892
|
+
type: e,
|
|
1893
|
+
target: t,
|
|
1894
|
+
origDomEvent: n,
|
|
1895
|
+
intersect: r,
|
|
1896
|
+
stopPropagation: function() {
|
|
1897
|
+
c = !1;
|
|
1898
|
+
}
|
|
1899
|
+
}), c && s.useCapture === !1 && t.parent && this._notify(e, t.parent, n, r);
|
|
1900
|
+
}
|
|
1901
|
+
}, L.prototype._onMouseDown = function(e) {
|
|
1902
|
+
return this._onMouseEvent("mousedown", e);
|
|
1903
|
+
}, L.prototype._onMouseUp = function(e) {
|
|
1904
|
+
return this._onMouseEvent("mouseup", e);
|
|
1905
|
+
}, L.prototype._onMouseEvent = function(e, t) {
|
|
1906
|
+
var n = this._getRelativeMouseXY(t);
|
|
1907
|
+
this._onEvent(e, n.x, n.y, t);
|
|
1908
|
+
}, L.prototype._onMouseMove = function(e) {
|
|
1909
|
+
var t = this._getRelativeMouseXY(e);
|
|
1910
|
+
this._onMove("mousemove", t.x, t.y, e), this._onMove("mouseover", t.x, t.y, e), this._onMove("mouseout", t.x, t.y, e);
|
|
1911
|
+
}, L.prototype._onClick = function(e) {
|
|
1912
|
+
this._onMouseEvent("click", e);
|
|
1913
|
+
}, L.prototype._onDblClick = function(e) {
|
|
1914
|
+
this._onMouseEvent("dblclick", e);
|
|
1915
|
+
}, L.prototype._onContextmenu = function(e) {
|
|
1916
|
+
this._onMouseEvent("contextmenu", e);
|
|
1917
|
+
}, L.prototype._onTouchStart = function(e) {
|
|
1918
|
+
return this._onTouchEvent("touchstart", e);
|
|
1919
|
+
}, L.prototype._onTouchEnd = function(e) {
|
|
1920
|
+
return this._onTouchEvent("touchend", e);
|
|
1921
|
+
}, L.prototype._onTouchMove = function(e) {
|
|
1922
|
+
if (e.touches.length == 1) {
|
|
1923
|
+
var t = Number(e.touches[0].pageX / window.innerWidth) * 2 - 1, n = -(e.touches[0].pageY / window.innerHeight) * 2 + 1;
|
|
1924
|
+
this._onMove("mousemove", t, n, e), this._onMove("mouseover", t, n, e), this._onMove("mouseout", t, n, e);
|
|
1925
|
+
}
|
|
1926
|
+
}, L.prototype._onTouchEvent = function(e, t) {
|
|
1927
|
+
var n = t.touches;
|
|
1928
|
+
if (n.length == 0 && (n = t.changedTouches), n.length == 1) {
|
|
1929
|
+
var r = Number(n[0].pageX / window.innerWidth) * 2 - 1, i = -(n[0].pageY / window.innerHeight) * 2 + 1;
|
|
1930
|
+
this._onEvent(e, r, i, t);
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
//#endregion
|
|
1934
|
+
//#region build/plugins/Object3DHelperPlugin/Controller.js
|
|
1935
|
+
var Ne = "Object3DHelperPlugin", R = Ne, Pe = () => {
|
|
1936
|
+
console.error(`${R} is disposed`);
|
|
1937
|
+
}, Fe = () => {
|
|
1938
|
+
console.warn(`${R} is disabled`);
|
|
1939
|
+
}, Ie = () => {
|
|
1940
|
+
console.error(`${R} is disabled`);
|
|
1941
|
+
}, Le = class {
|
|
1942
|
+
constructor(e) {
|
|
1943
|
+
this.controllers = {}, this.state = {
|
|
1944
|
+
visible: !0,
|
|
1945
|
+
enabled: !0,
|
|
1946
|
+
disposed: !1
|
|
1947
|
+
}, this.hooks = new r(), e && this.addControllers(e), this.setState(this.state);
|
|
1948
|
+
}
|
|
1949
|
+
show(e) {
|
|
1950
|
+
this.setState({ visible: !0 }, e);
|
|
1951
|
+
}
|
|
1952
|
+
hide(e) {
|
|
1953
|
+
this.setState({ visible: !1 }, e);
|
|
1954
|
+
}
|
|
1955
|
+
enable(e) {
|
|
1956
|
+
this.setState({ enabled: !0 }, e);
|
|
1957
|
+
}
|
|
1958
|
+
disable(e) {
|
|
1959
|
+
this.setState({ enabled: !1 }, e);
|
|
1960
|
+
}
|
|
1961
|
+
dispose() {
|
|
1962
|
+
this.setState({ disposed: !0 });
|
|
1963
|
+
}
|
|
1964
|
+
setState(e, t) {
|
|
1965
|
+
if (this.state.disposed || !this.state.enabled && e.enabled !== !0 && e.disposed !== !0) return;
|
|
1966
|
+
let n = Object.assign({}, this.state);
|
|
1967
|
+
this.state = Object.assign(Object.assign({}, this.state), e), e.disposed !== void 0 && e.disposed !== n.disposed && e.disposed && this.handleDispose(), e.visible !== void 0 && this.handleVisible(e.visible), e.enabled !== void 0 && this.handleEnable(e.enabled), this.hooks.emit("stateChange", {
|
|
1968
|
+
state: this.state,
|
|
1969
|
+
prevState: n
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
addControllers(e) {
|
|
1973
|
+
this.controllers = Object.assign(Object.assign({}, this.controllers), e), this.setState(this.state);
|
|
1974
|
+
}
|
|
1975
|
+
initialHelperMatrix() {
|
|
1976
|
+
this.everyControllerDo((e) => {
|
|
1977
|
+
e.initialHelperPosition(), e.initialHelperQuaternion();
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
handleEnable(e, t = !0) {
|
|
1981
|
+
e ? (this.everyControllerDo((e) => e.enable()), this.hooks.emit("enable", { userAction: t })) : (this.everyControllerDo((e) => e.disable()), this.hooks.emit("disable", { userAction: t }));
|
|
1982
|
+
}
|
|
1983
|
+
handleVisible(e, t = !0) {
|
|
1984
|
+
e ? (this.everyControllerDo((e) => e.show()), this.state.enabled && this.hooks.emit("show", { userAction: t })) : (this.everyControllerDo((e) => e.hide()), this.state.enabled && this.hooks.emit("hide", { userAction: t }));
|
|
1985
|
+
}
|
|
1986
|
+
handleDispose() {
|
|
1987
|
+
Object.values(this.controllers).forEach((e) => {
|
|
1988
|
+
e == null || e.dispose();
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
everyControllerDo(e) {
|
|
1992
|
+
Object.values(this.controllers).forEach((t) => {
|
|
1993
|
+
t && e(t);
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
}, Re = class extends w.Controller {
|
|
1997
|
+
constructor(e) {
|
|
1998
|
+
super(e), this.name = Ne, this.state = {
|
|
1999
|
+
visible: !0,
|
|
2000
|
+
enabled: !0,
|
|
2001
|
+
disposed: !1
|
|
2002
|
+
}, this.objectHelperMap = /* @__PURE__ */ new Map(), this.five = e;
|
|
2003
|
+
}
|
|
2004
|
+
show(e) {
|
|
2005
|
+
return S(this, void 0, void 0, function* () {
|
|
2006
|
+
this.setState({ visible: !0 }, e);
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
hide(e) {
|
|
2010
|
+
return S(this, void 0, void 0, function* () {
|
|
2011
|
+
this.setState({ visible: !1 }, e);
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
enable(e) {
|
|
2015
|
+
this.setState({ enabled: !0 }, e);
|
|
2016
|
+
}
|
|
2017
|
+
disable(e) {
|
|
2018
|
+
this.setState({ enabled: !1 }, e);
|
|
2019
|
+
}
|
|
2020
|
+
dispose() {
|
|
2021
|
+
this.setState({ disposed: !0 });
|
|
2022
|
+
}
|
|
2023
|
+
load(e) {
|
|
2024
|
+
return S(this, void 0, void 0, function* () {});
|
|
2025
|
+
}
|
|
2026
|
+
setState(e, t) {
|
|
2027
|
+
var n;
|
|
2028
|
+
if (this.state.disposed) return Pe();
|
|
2029
|
+
if (!this.state.enabled && e.enabled !== !0 && e.disposed !== !0) return Ie();
|
|
2030
|
+
let r = Object.assign({}, this.state);
|
|
2031
|
+
this.state = Object.assign(Object.assign({}, this.state), e), e.disposed !== void 0 && e.disposed !== r.disposed && e.disposed && this.handleDispose(), e.visible !== void 0 && e.visible !== r.visible && this.handleVisible(e.visible), e.enabled !== void 0 && e.enabled !== r.enabled && this.handleEnable(e.enabled), this.hooks.emit("stateChange", {
|
|
2032
|
+
state: this.state,
|
|
2033
|
+
prevState: r,
|
|
2034
|
+
userAction: (n = t == null ? void 0 : t.userAction) == null ? !0 : n
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
getObject3DHelper(e) {
|
|
2038
|
+
return this.objectHelperMap.get(e);
|
|
2039
|
+
}
|
|
2040
|
+
addObject3DHelper(e, t = {}) {
|
|
2041
|
+
var n, i;
|
|
2042
|
+
if (!e) {
|
|
2043
|
+
console.error("Object3D is undefined");
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
if (this.objectHelperMap.has(e)) {
|
|
2047
|
+
console.warn(`Object3DHelperPlugin: object3D ${e.name} already has helper`);
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
let o = new Le(), s = [], c = (n = this.five.getElement()) == null ? void 0 : n.parentElement;
|
|
2051
|
+
this.five.camera;
|
|
2052
|
+
let l = Object.assign(Object.assign({}, {
|
|
2053
|
+
moveHelper: !0,
|
|
2054
|
+
rotateHelper: !0,
|
|
2055
|
+
boundingBoxHelper: !1,
|
|
2056
|
+
moveHelperTips: !1,
|
|
2057
|
+
positionFrom: "objectPosition"
|
|
2058
|
+
}), t), { moveHelper: u, rotateHelper: d, boundingBoxHelper: f } = l, p = new a.Group();
|
|
2059
|
+
l.helperOffset && p.position.copy(l.helperOffset), this.five.scene.add(p);
|
|
2060
|
+
let m = o.hooks, h = new r(), g = new L(this.five.camera, this.five.getElement()), _ = (e) => {
|
|
2061
|
+
if (e) return typeof e == "boolean" ? e : e.enable;
|
|
2062
|
+
}, v = {};
|
|
2063
|
+
if (_(u)) {
|
|
2064
|
+
let t = Object.assign(Object.assign({}, this.getConfig(l.moveHelper)), l), n = new ge(e, Object.assign({
|
|
2065
|
+
container: c == null ? void 0 : c,
|
|
2066
|
+
moveTipsEnable: (i = l.moveHelperTips) == null ? !1 : i
|
|
2067
|
+
}, t)), r = new I(this.five, g, ke, e, n, t, m, h, p);
|
|
2068
|
+
v.moveController = r.helperController, s.push(() => r.dispose());
|
|
2069
|
+
}
|
|
2070
|
+
if (_(d)) {
|
|
2071
|
+
let t = Object.assign(Object.assign({}, this.getConfig(l.rotateHelper)), l), n = new _e(e, Object.assign({ container: c == null ? void 0 : c }, t)), r = new I(this.five, g, je, e, n, t, m, h, p);
|
|
2072
|
+
v.rotateController = r.helperController, s.push(() => r.dispose());
|
|
2073
|
+
}
|
|
2074
|
+
if (_(f)) {
|
|
2075
|
+
let t = new xe(e), n = new I(this.five, g, Me, e, t, void 0, m, h, p);
|
|
2076
|
+
v.boundingBoxController = n.helperController, s.push(() => n.dispose());
|
|
2077
|
+
}
|
|
2078
|
+
return Object.values(v).forEach((e) => {
|
|
2079
|
+
e && typeof e.updateOtherControllers == "function" && e.updateOtherControllers(v);
|
|
2080
|
+
}), o.addControllers(v), this.objectHelperMap.set(e, {
|
|
2081
|
+
helper: o,
|
|
2082
|
+
disposers: s,
|
|
2083
|
+
helperGroup: p
|
|
2084
|
+
}), o.controllers;
|
|
2085
|
+
}
|
|
2086
|
+
removeObject3DHelper(e) {
|
|
2087
|
+
if (!this.objectHelperMap.has(e)) return;
|
|
2088
|
+
let { helper: t, disposers: n, helperGroup: r } = this.objectHelperMap.get(e);
|
|
2089
|
+
this.objectHelperMap.delete(e), t.dispose(), n == null || n.forEach((e) => e == null ? void 0 : e()), r.parent && r.parent.remove(r);
|
|
2090
|
+
}
|
|
2091
|
+
handleEnable(e, t = !0) {
|
|
2092
|
+
e ? (this.everyHelperDo((e) => e.enable()), this.hooks.emit("enable", { userAction: t })) : (this.everyHelperDo((e) => e.disable()), this.hooks.emit("disable", { userAction: t })), this.state.enabled = e;
|
|
2093
|
+
}
|
|
2094
|
+
handleVisible(e, t = !0) {
|
|
2095
|
+
e ? (this.everyHelperDo((e) => e.show()), this.actionIfStateIsEnabled(() => this.hooks.emit("show", { userAction: t }))) : (this.everyHelperDo((e) => e.hide()), this.actionIfStateIsEnabled(() => this.hooks.emit("hide", { userAction: t }))), this.state.visible = e;
|
|
2096
|
+
}
|
|
2097
|
+
handleDispose() {
|
|
2098
|
+
this.objectHelperMap.forEach(({ helper: e, disposers: t, helperGroup: n }) => {
|
|
2099
|
+
e.dispose(), t == null || t.forEach((e) => e == null ? void 0 : e()), n.parent && n.parent.remove(n);
|
|
2100
|
+
}), this.objectHelperMap.clear();
|
|
2101
|
+
}
|
|
2102
|
+
everyHelperDo(e) {
|
|
2103
|
+
this.objectHelperMap.forEach(({ helper: t, disposers: n }) => {
|
|
2104
|
+
t && e(t, n);
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
actionIfStateIsEnabled(e, t) {
|
|
2108
|
+
if (this.state.enabled) return e();
|
|
2109
|
+
t != null && t.warnLog && Fe();
|
|
2110
|
+
}
|
|
2111
|
+
getConfig(e) {
|
|
2112
|
+
if (e && typeof e != "boolean" && e.enable) return e;
|
|
2113
|
+
}
|
|
2114
|
+
}, ze = (e) => new Re(e);
|
|
2115
|
+
//#endregion
|
|
2116
|
+
//#region build/plugins/utils/clamp.js
|
|
2117
|
+
function Be(e, t, n) {
|
|
2118
|
+
return e < t ? t : e > n ? n : e;
|
|
2119
|
+
}
|
|
2120
|
+
//#endregion
|
|
2121
|
+
//#region build/plugins/PanoAnimePlugin/Controller.js
|
|
2122
|
+
function Ve() {
|
|
2123
|
+
let e = {
|
|
2124
|
+
map: h(new a.Texture()),
|
|
2125
|
+
progress: g(0),
|
|
2126
|
+
opacity: g(0)
|
|
2127
|
+
}, t = f(() => {
|
|
2128
|
+
let t = _(), n = v(p);
|
|
2129
|
+
d(t.y.greaterThan(e.progress));
|
|
2130
|
+
let r = e.map.sample(t), i = b(y(1, 1, 1), e.progress.sub(n.y).mul(.7)), a = i.add(b(r.rgb, r.a.mul(n.y.oneMinus()))), o = m(e.progress.equal(1), a, i);
|
|
2131
|
+
return b(o.rgb, o.a.mul(e.opacity));
|
|
2132
|
+
}), n = new a.NodeMaterial();
|
|
2133
|
+
return n.fragmentNode = t(), n.transparent = !0, n.depthTest = !1, {
|
|
2134
|
+
material: n,
|
|
2135
|
+
u: e
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
var He = [
|
|
2139
|
+
1,
|
|
2140
|
+
5,
|
|
2141
|
+
2,
|
|
2142
|
+
6,
|
|
2143
|
+
3,
|
|
2144
|
+
7,
|
|
2145
|
+
4,
|
|
2146
|
+
8,
|
|
2147
|
+
9,
|
|
2148
|
+
13,
|
|
2149
|
+
10,
|
|
2150
|
+
14,
|
|
2151
|
+
11,
|
|
2152
|
+
15,
|
|
2153
|
+
12,
|
|
2154
|
+
16
|
|
2155
|
+
], Ue = 512, We = 512, z = 128, Ge = class extends w.Controller {
|
|
2156
|
+
get config() {
|
|
2157
|
+
return Object.assign({}, this._config);
|
|
2158
|
+
}
|
|
2159
|
+
updateState(e, t) {
|
|
2160
|
+
let n = this.state;
|
|
2161
|
+
this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
|
|
2162
|
+
state: this.state,
|
|
2163
|
+
prevState: n,
|
|
2164
|
+
userAction: t
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
updateConfig(e, t = {}) {
|
|
2168
|
+
var n;
|
|
2169
|
+
let r = this.config, i = Object.assign(Object.assign({}, r), e);
|
|
2170
|
+
this._config = i, this.hooks.emit("configChange", {
|
|
2171
|
+
prevConfig: r,
|
|
2172
|
+
config: i,
|
|
2173
|
+
userAction: (n = t.userAction) == null ? !0 : n
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
constructor(e, t) {
|
|
2177
|
+
super(e), this.group = new a.Group(), this.materialUniforms = Ve(), this.mesh = (() => {
|
|
2178
|
+
let e = new a.CylinderGeometry(.12, .12, 1, 32, 1, !0);
|
|
2179
|
+
return e.translate(0, .5, 0), new a.Mesh(e, this.materialUniforms.material);
|
|
2180
|
+
})(), this.panoMesh = new n({ scale: 1.5 }), this.stop = () => {}, this.drawLine = (e, t) => {
|
|
2181
|
+
if (!this.ctx) return;
|
|
2182
|
+
let n = (() => {
|
|
2183
|
+
var t;
|
|
2184
|
+
return 32 * ((t = He[e]) == null ? 0 : t);
|
|
2185
|
+
})(), r = (1 - (t + e * 150) % 1200 / 1200) * 640, i = this.ctx.createLinearGradient(0, r - z, 0, r);
|
|
2186
|
+
i.addColorStop(0, "rgba(255,255,255,0)"), i.addColorStop(.5, "rgba(255,255,255,1)"), i.addColorStop(1, "rgba(255,255,255,0)"), this.ctx.fillStyle = i, this.ctx.fillRect(n, r - z, 3, z);
|
|
2187
|
+
}, this.anime = (e) => {
|
|
2188
|
+
if (!this.ctx || !this.startTime) return;
|
|
2189
|
+
this.ctx.clearRect(0, 0, Ue, We);
|
|
2190
|
+
for (let t = 0; t < 16; t++) this.drawLine(t, e - this.startTime);
|
|
2191
|
+
let t = Be((e - this.startTime) / 1e3, 0, 1), n = Be((e - this.startTime) / 300, 0, this.config.maxOpacity);
|
|
2192
|
+
this.panoMesh.setOpacity(n), this.materialUniforms.u.progress.value = t, this.materialUniforms.u.opacity.value = n, this.canvasTexture && (this.canvasTexture.needsUpdate = !0), this.five.needsRender = !0;
|
|
2193
|
+
}, this.dispose = () => {
|
|
2194
|
+
this.disable();
|
|
2195
|
+
}, this.five = e;
|
|
2196
|
+
let r = {
|
|
2197
|
+
enabled: !1,
|
|
2198
|
+
visible: !0
|
|
2199
|
+
};
|
|
2200
|
+
this.state = Object.assign(r, t == null ? void 0 : t.initialState);
|
|
2201
|
+
let i = Object.assign(Object.assign({}, t == null ? void 0 : t.config), { maxOpacity: 1 });
|
|
2202
|
+
this._config = i, !(typeof document > "u") && (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), this.canvas.width = Ue, this.canvas.height = We, this.ctx.shadowColor = "rgba(255,255,255,0.5)", this.ctx.shadowBlur = 6, this.ctx.shadowOffsetX = 0, this.ctx.shadowOffsetY = 0, this.canvasTexture = new a.CanvasTexture(this.canvas), this.materialUniforms.u.map.value = this.canvasTexture, this.group.add(this.mesh), this.panoMesh.setProgress(1), this.panoMesh.setOpacity(0), this.group.add(this.panoMesh), this.state.enabled && this._enable({ userAction: !1 }));
|
|
2203
|
+
}
|
|
2204
|
+
load(e) {
|
|
2205
|
+
return S(this, void 0, void 0, function* () {});
|
|
2206
|
+
}
|
|
2207
|
+
_enable(t) {
|
|
2208
|
+
this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition), this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition), this.five.ready().then(() => {
|
|
2209
|
+
this.five.scene.add(this.group), this.stop = e.shared.add((e, t) => {
|
|
2210
|
+
this.startTime || (this.startTime = e), this.panoMesh.updateTime(e, t), this.anime(e);
|
|
2211
|
+
});
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
_disable(e) {
|
|
2215
|
+
this.five.scene.remove(this.group), this.panoMesh.setOpacity(0), this.startTime = void 0, this.stop(), this.five.needsRender = !0;
|
|
2216
|
+
}
|
|
2217
|
+
enable(e) {
|
|
2218
|
+
var t;
|
|
2219
|
+
if (!this.ctx || this.state.enabled || !this.five.observers[this.five.state.panoIndex]) return;
|
|
2220
|
+
let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
|
|
2221
|
+
this.updateState({ enabled: !0 }, n), this._enable({ userAction: n });
|
|
2222
|
+
}
|
|
2223
|
+
disable(e) {
|
|
2224
|
+
var t;
|
|
2225
|
+
if (this.state.enabled === !1) return;
|
|
2226
|
+
let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
|
|
2227
|
+
this.updateState({ enabled: !1 }, n), this._disable({ userAction: n });
|
|
2228
|
+
}
|
|
2229
|
+
setState(e, t = {}) {
|
|
2230
|
+
let n = this.state, r = t.userAction === void 0 ? !0 : t.userAction;
|
|
2231
|
+
if (this.updateState(e, r), e.enabled !== void 0 && n.enabled !== e.enabled) {
|
|
2232
|
+
let t = { userAction: r };
|
|
2233
|
+
e.enabled ? this._enable(t) : this._disable(t);
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
}, Ke = (e, t) => new Ge(e, t), qe = class extends s {
|
|
2237
|
+
constructor(e = document.createElement("div")) {
|
|
2238
|
+
super(), this.isCSS2DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.center = new l(.5, .5), this.addEventListener("removed", function() {
|
|
2239
|
+
this.traverse(function(e) {
|
|
2240
|
+
e.element && e.element instanceof Element && e.element.parentNode !== null && e.element.remove();
|
|
2241
|
+
});
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2244
|
+
copy(e, t) {
|
|
2245
|
+
return super.copy(e, t), this.element = e.element.cloneNode(!0), this.center = e.center.clone(), this;
|
|
2246
|
+
}
|
|
2247
|
+
}, B = new u(), Je = new o(), Ye = new o(), Xe = new u(), Ze = new u(), Qe = class {
|
|
2248
|
+
constructor(e = {}) {
|
|
2249
|
+
let t = this, n, r, i, a, o = { objects: /* @__PURE__ */ new WeakMap() }, s = e.element === void 0 ? document.createElement("div") : e.element;
|
|
2250
|
+
s.style.overflow = "hidden", this.domElement = s, this.sortObjects = !0, this.getSize = function() {
|
|
2251
|
+
return {
|
|
2252
|
+
width: n,
|
|
2253
|
+
height: r
|
|
2254
|
+
};
|
|
2255
|
+
}, this.render = function(e, n) {
|
|
2256
|
+
e.updateMatrixWorld(), n.parent === null && n.updateMatrixWorld(), Je.copy(n.matrixWorldInverse), Ye.multiplyMatrices(n.projectionMatrix, Je), l(e, e, n), t.sortObjects && f(e);
|
|
2257
|
+
}, this.setSize = function(e, t) {
|
|
2258
|
+
n = e, r = t, i = n / 2, a = r / 2, s.style.width = e + "px", s.style.height = t + "px";
|
|
2259
|
+
};
|
|
2260
|
+
function c(e) {
|
|
2261
|
+
e.isCSS2DObject && (e.element.style.display = "none");
|
|
2262
|
+
for (let t = 0, n = e.children.length; t < n; t++) c(e.children[t]);
|
|
2263
|
+
}
|
|
2264
|
+
function l(e, n, r) {
|
|
2265
|
+
if (e.visible === !1) {
|
|
2266
|
+
c(e);
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
if (e.isCSS2DObject) {
|
|
2270
|
+
B.setFromMatrixPosition(e.matrixWorld), B.applyMatrix4(Ye);
|
|
2271
|
+
let c = B.z >= -1 && B.z <= 1 && e.layers.test(r.layers) === !0, l = e.element;
|
|
2272
|
+
l.style.display = c === !0 ? "" : "none", c === !0 && (e.onBeforeRender(t, n, r), l.style.transform = "translate(" + -100 * e.center.x + "%," + -100 * e.center.y + "%)translate(" + (B.x * i + i) + "px," + (-B.y * a + a) + "px)", l.parentNode !== s && s.appendChild(l), e.onAfterRender(t, n, r));
|
|
2273
|
+
let d = { distanceToCameraSquared: u(r, e) };
|
|
2274
|
+
o.objects.set(e, d);
|
|
2275
|
+
}
|
|
2276
|
+
for (let t = 0, i = e.children.length; t < i; t++) l(e.children[t], n, r);
|
|
2277
|
+
}
|
|
2278
|
+
function u(e, t) {
|
|
2279
|
+
return Xe.setFromMatrixPosition(e.matrixWorld), Ze.setFromMatrixPosition(t.matrixWorld), Xe.distanceToSquared(Ze);
|
|
2280
|
+
}
|
|
2281
|
+
function d(e) {
|
|
2282
|
+
let t = [];
|
|
2283
|
+
return e.traverseVisible(function(e) {
|
|
2284
|
+
e.isCSS2DObject && t.push(e);
|
|
2285
|
+
}), t;
|
|
2286
|
+
}
|
|
2287
|
+
function f(e) {
|
|
2288
|
+
let t = d(e).sort(function(e, t) {
|
|
2289
|
+
return e.renderOrder === t.renderOrder ? o.objects.get(e).distanceToCameraSquared - o.objects.get(t).distanceToCameraSquared : t.renderOrder - e.renderOrder;
|
|
2290
|
+
}), n = t.length;
|
|
2291
|
+
for (let e = 0, r = t.length; e < r; e++) t[e].element.style.zIndex = n - e;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
}, $e = "#five-CSS2DPlugin {\n position: absolute;\n pointer-events: none;\n user-select: none;\n top: 0;\n left: 0;\n}\n\n.five-CSS2DPlugin-X {\n --timeout: 300ms;\n transition: opacity ease-in-out var(--timeout);\n}\n\n.five-CSS2DPlugin-hidden {\n opacity: 0;\n}\n\n#five-CSS2DPlugin .five-CSS2DPlugin-hidden * {\n pointer-events: none;\n}\n";
|
|
2295
|
+
//#endregion
|
|
2296
|
+
//#region build/plugins/utils/uuid.js
|
|
2297
|
+
function et() {
|
|
2298
|
+
return ((1 + Math.random()) * parseInt("10000", 36) | 0).toString(36).substring(1);
|
|
2299
|
+
}
|
|
2300
|
+
function tt() {
|
|
2301
|
+
let e = et() + et().substr(0, 2) + Date.now().toString(36), t = e.length, n = "", r = Math.floor(Math.random() * Math.pow(2, t));
|
|
2302
|
+
for (let i = 0; i < t; i++) {
|
|
2303
|
+
let t = e[i];
|
|
2304
|
+
t >= "a" && t <= "z" && r >> i & 1 && (t = t.toUpperCase()), n += t;
|
|
2305
|
+
}
|
|
2306
|
+
return "u-" + n;
|
|
2307
|
+
}
|
|
2308
|
+
//#endregion
|
|
2309
|
+
//#region build/plugins/CSS2DPlugin/Controller.js
|
|
2310
|
+
var nt = class extends w.Controller {
|
|
2311
|
+
updateState(e, t) {
|
|
2312
|
+
let n = this.state;
|
|
2313
|
+
this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
|
|
2314
|
+
state: this.state,
|
|
2315
|
+
prevState: n,
|
|
2316
|
+
userAction: t
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
constructor(e, t) {
|
|
2320
|
+
super(e), this.scene = new a.Scene(), this.styleSheet = new CSSStyleSheet(), this.camera = new a.PerspectiveCamera(), this.createCSS2DObject = ({ id: e = tt(), name: t, innerHTML: n, center: r, position: i, visible: a = !0, timeout: o }) => {
|
|
2321
|
+
let s = document.createElement("div");
|
|
2322
|
+
s.className = "five-CSS2DPlugin-X", a || s.classList.add("five-CSS2DPlugin-hidden"), o && s.style.setProperty("--timeout", o + "ms"), s.innerHTML = n;
|
|
2323
|
+
let c = new qe(s);
|
|
2324
|
+
return c.userData = {
|
|
2325
|
+
id: e,
|
|
2326
|
+
_visible: a,
|
|
2327
|
+
_timeout: o,
|
|
2328
|
+
get visible() {
|
|
2329
|
+
return this._visible;
|
|
2330
|
+
},
|
|
2331
|
+
set visible(e) {
|
|
2332
|
+
e ? s.classList.remove("five-CSS2DPlugin-hidden") : s.classList.add("five-CSS2DPlugin-hidden"), this._visible = e;
|
|
2333
|
+
},
|
|
2334
|
+
get timeout() {
|
|
2335
|
+
return this._timeout;
|
|
2336
|
+
},
|
|
2337
|
+
set timeout(e) {
|
|
2338
|
+
s.style.setProperty("--timeout", e + "ms"), this._timeout = e;
|
|
2339
|
+
}
|
|
2340
|
+
}, r && c.center.copy(r), i && c.position.copy(i), t && (c.name = t), c;
|
|
2341
|
+
}, this.render = () => {
|
|
2342
|
+
this.camera.fov = this.five.camera.fov, this.camera.aspect = this.five.camera.aspect, this.camera.position.copy(this.five.camera.position), this.camera.rotation.copy(this.five.camera.rotation), this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera);
|
|
2343
|
+
}, this._addEventListener = () => {
|
|
2344
|
+
this.five.on("render.prepare", this.render), this.appendToFiveContainer();
|
|
2345
|
+
}, this._removeEventListener = () => {
|
|
2346
|
+
var e;
|
|
2347
|
+
this.five.off("render.prepare", this.render), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = void 0;
|
|
2348
|
+
}, this.dispose = () => {
|
|
2349
|
+
this.removeAll(), this._disable({ userAction: !1 });
|
|
2350
|
+
}, this.five = e, this.renderer = new Qe(), this.renderer.domElement.id = "five-CSS2DPlugin", this.styleSheet.replaceSync($e), document && document.adoptedStyleSheets.push(this.styleSheet);
|
|
2351
|
+
let n = {
|
|
2352
|
+
enabled: !0,
|
|
2353
|
+
visible: !0
|
|
2354
|
+
};
|
|
2355
|
+
this.state = Object.assign(n, t == null ? void 0 : t.initialState), this.state.enabled ? this._enable({ userAction: !1 }) : this.styleSheet.disabled = !0;
|
|
2356
|
+
}
|
|
2357
|
+
load(e) {
|
|
2358
|
+
return S(this, void 0, void 0, function* () {});
|
|
2359
|
+
}
|
|
2360
|
+
appendToFiveContainer() {
|
|
2361
|
+
var e;
|
|
2362
|
+
if (!this.five.renderer) return;
|
|
2363
|
+
let t = this.five.getElement();
|
|
2364
|
+
if (!(t != null && t.parentElement)) return;
|
|
2365
|
+
let { x: n, y: r } = this.five.renderer.getSize(new a.Vector2());
|
|
2366
|
+
t.parentElement.appendChild(this.renderer.domElement), this.renderer.setSize(n, r), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = new ResizeObserver(() => {
|
|
2367
|
+
var e;
|
|
2368
|
+
if (!this.five.renderer) return;
|
|
2369
|
+
let t = (e = this.five.getElement()) == null ? void 0 : e.getBoundingClientRect();
|
|
2370
|
+
if (!t) return;
|
|
2371
|
+
let { x: n, y: r, width: i, height: a } = t;
|
|
2372
|
+
this.renderer.setSize(i, a), this.renderer.domElement.style.left = n + "px", this.renderer.domElement.style.top = r + "px", this.render();
|
|
2373
|
+
}), this.resizeObserver.observe(t);
|
|
2374
|
+
}
|
|
2375
|
+
add(...e) {
|
|
2376
|
+
this.scene.add(...e), this.render();
|
|
2377
|
+
}
|
|
2378
|
+
remove(e) {
|
|
2379
|
+
this.scene.remove(e), e.traverse((e) => {
|
|
2380
|
+
e instanceof qe && e.element.remove();
|
|
2381
|
+
}), this.render();
|
|
2382
|
+
}
|
|
2383
|
+
removeAll() {
|
|
2384
|
+
this.scene.remove(...this.scene.children), this.render();
|
|
2385
|
+
}
|
|
2386
|
+
fadeInObjects(...e) {
|
|
2387
|
+
for (let t of e) t.userData.visible = !0;
|
|
2388
|
+
this.render();
|
|
2389
|
+
}
|
|
2390
|
+
fadeOutObjects(...e) {
|
|
2391
|
+
for (let t of e) t.userData.visible = !1;
|
|
2392
|
+
this.render();
|
|
2393
|
+
}
|
|
2394
|
+
_enable(e) {
|
|
2395
|
+
this.styleSheet.disabled = !1, this.updateState({ enabled: !0 }, e.userAction), this._addEventListener(), this.render();
|
|
2396
|
+
}
|
|
2397
|
+
_disable(e) {
|
|
2398
|
+
this.styleSheet.disabled = !0, this.updateState({ enabled: !1 }, e.userAction), this._removeEventListener();
|
|
2399
|
+
}
|
|
2400
|
+
enable(e) {
|
|
2401
|
+
var t;
|
|
2402
|
+
if (this.state.enabled) return;
|
|
2403
|
+
let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
|
|
2404
|
+
this._enable({ userAction: n });
|
|
2405
|
+
}
|
|
2406
|
+
disable(e) {
|
|
2407
|
+
var t;
|
|
2408
|
+
if (this.state.enabled === !1) return;
|
|
2409
|
+
let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
|
|
2410
|
+
this._disable({ userAction: n });
|
|
2411
|
+
}
|
|
2412
|
+
show(e) {
|
|
2413
|
+
this.renderer.domElement.style.display = "block", this.updateState({ visible: !0 }, !0), this.render();
|
|
2414
|
+
}
|
|
2415
|
+
hide(e) {
|
|
2416
|
+
this.renderer.domElement.style.display = "none", this.updateState({ visible: !1 }, !0);
|
|
2417
|
+
}
|
|
2418
|
+
}, rt = (e, t) => new nt(e, t), V = new u(), it = new c(), H = new u(), U = class extends s {
|
|
2419
|
+
constructor(e = document.createElement("div")) {
|
|
2420
|
+
super(), this.isCSS3DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.addEventListener("removed", function() {
|
|
2421
|
+
this.traverse(function(e) {
|
|
2422
|
+
e.element && e.element instanceof Element && e.element.parentNode !== null && e.element.remove();
|
|
2423
|
+
});
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
copy(e, t) {
|
|
2427
|
+
return super.copy(e, t), this.element = e.element.cloneNode(!0), this;
|
|
2428
|
+
}
|
|
2429
|
+
}, at = class extends U {
|
|
2430
|
+
constructor(e) {
|
|
2431
|
+
super(e), this.isCSS3DSprite = !0, this.rotation2D = 0;
|
|
2432
|
+
}
|
|
2433
|
+
copy(e, t) {
|
|
2434
|
+
return super.copy(e, t), this.rotation2D = e.rotation2D, this;
|
|
2435
|
+
}
|
|
2436
|
+
}, W = new o(), ot = new o(), st = class {
|
|
2437
|
+
constructor(e = {}) {
|
|
2438
|
+
let t = this, n, r, i, a, o = {
|
|
2439
|
+
camera: { style: "" },
|
|
2440
|
+
objects: /* @__PURE__ */ new WeakMap()
|
|
2441
|
+
}, s = e.element === void 0 ? document.createElement("div") : e.element;
|
|
2442
|
+
s.style.overflow = "hidden", this.domElement = s;
|
|
2443
|
+
let c = document.createElement("div");
|
|
2444
|
+
c.style.transformOrigin = "0 0", c.style.pointerEvents = "none", s.appendChild(c);
|
|
2445
|
+
let l = document.createElement("div");
|
|
2446
|
+
l.style.transformStyle = "preserve-3d", c.appendChild(l), this.getSize = function() {
|
|
2447
|
+
return {
|
|
2448
|
+
width: n,
|
|
2449
|
+
height: r
|
|
2450
|
+
};
|
|
2451
|
+
};
|
|
2452
|
+
let u = !0, d = /* @__PURE__ */ new Set();
|
|
2453
|
+
this.markDirty = function() {
|
|
2454
|
+
u = !0;
|
|
2455
|
+
}, this.updateSpriteSet = function(e) {
|
|
2456
|
+
d.clear(), e.traverse(function(e) {
|
|
2457
|
+
e.isCSS3DSprite && d.add(e);
|
|
2458
|
+
});
|
|
2459
|
+
};
|
|
2460
|
+
function f(e, n, r) {
|
|
2461
|
+
if (e.visible === !1) return;
|
|
2462
|
+
let i = e.layers.test(r.layers) === !0, a = e.element;
|
|
2463
|
+
if (a.style.display = i === !0 ? "" : "none", i === !0) {
|
|
2464
|
+
e.onBeforeRender(t, n, r), W.copy(r.matrixWorldInverse), W.transpose(), e.rotation2D !== 0 && W.multiply(ot.makeRotationZ(e.rotation2D)), e.matrixWorld.decompose(V, it, H), W.setPosition(V), W.scale(H), W.elements[3] = 0, W.elements[7] = 0, W.elements[11] = 0, W.elements[15] = 1;
|
|
2465
|
+
let i = h(W), s = o.objects.get(e);
|
|
2466
|
+
(s === void 0 || s.style !== i) && (a.style.transform = i, o.objects.set(e, { style: i })), a.parentNode !== l && l.appendChild(a), e.onAfterRender(t, n, r);
|
|
270
2467
|
}
|
|
271
2468
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
2469
|
+
this.render = function(e, t) {
|
|
2470
|
+
let n = t.projectionMatrix.elements[5] * a;
|
|
2471
|
+
e.updateMatrixWorld(), t.parent === null && t.updateMatrixWorld();
|
|
2472
|
+
let r, s;
|
|
2473
|
+
t.isOrthographicCamera && (r = -(t.right + t.left) / 2, s = (t.top + t.bottom) / 2);
|
|
2474
|
+
let c = t.isOrthographicCamera ? "scale(" + n + ")translate(" + p(r) + "px," + p(s) + "px)" + m(t.matrixWorldInverse) : "translateZ(" + n + "px)" + m(t.matrixWorldInverse), h = (t.isPerspectiveCamera ? "perspective(" + n + "px) " : "") + c + " translate(" + i + "px," + a + "px)";
|
|
2475
|
+
if (o.camera.style !== h && (l.style.transform = h, o.camera.style = h), u) _(e, e, t, c), u = !1;
|
|
2476
|
+
else if (d.size > 0) for (let n of d) f(n, e, t);
|
|
2477
|
+
}, this.setSize = function(e, t) {
|
|
2478
|
+
n = e, r = t, i = n / 2, a = r / 2, s.style.width = e + "px", s.style.height = t + "px", c.style.width = e + "px", c.style.height = t + "px", l.style.width = e + "px", l.style.height = t + "px";
|
|
2479
|
+
};
|
|
2480
|
+
function p(e) {
|
|
2481
|
+
return Math.abs(e) < 1e-10 ? 0 : e;
|
|
2482
|
+
}
|
|
2483
|
+
function m(e) {
|
|
2484
|
+
let t = e.elements;
|
|
2485
|
+
return "matrix3d(" + p(t[0]) + "," + p(-t[1]) + "," + p(t[2]) + "," + p(t[3]) + "," + p(t[4]) + "," + p(-t[5]) + "," + p(t[6]) + "," + p(t[7]) + "," + p(t[8]) + "," + p(-t[9]) + "," + p(t[10]) + "," + p(t[11]) + "," + p(t[12]) + "," + p(-t[13]) + "," + p(t[14]) + "," + p(t[15]) + ")";
|
|
2486
|
+
}
|
|
2487
|
+
function h(e) {
|
|
2488
|
+
let t = e.elements;
|
|
2489
|
+
return `translate(-50%,-50%) matrix3d(${[
|
|
2490
|
+
t[0],
|
|
2491
|
+
t[1],
|
|
2492
|
+
t[2],
|
|
2493
|
+
t[3],
|
|
2494
|
+
-t[4],
|
|
2495
|
+
-t[5],
|
|
2496
|
+
-t[6],
|
|
2497
|
+
-t[7],
|
|
2498
|
+
t[8],
|
|
2499
|
+
t[9],
|
|
2500
|
+
t[10],
|
|
2501
|
+
t[11],
|
|
2502
|
+
t[12],
|
|
2503
|
+
t[13],
|
|
2504
|
+
t[14],
|
|
2505
|
+
t[15]
|
|
2506
|
+
].map((e) => Math.abs(e) < 1e-10 ? 0 : e).join(",")})`;
|
|
2507
|
+
}
|
|
2508
|
+
function g(e) {
|
|
2509
|
+
e.isCSS3DObject && (e.element.style.display = "none");
|
|
2510
|
+
for (let t = 0, n = e.children.length; t < n; t++) g(e.children[t]);
|
|
2511
|
+
}
|
|
2512
|
+
function _(e, n, r, i) {
|
|
2513
|
+
if (e.visible === !1) {
|
|
2514
|
+
g(e);
|
|
2515
|
+
return;
|
|
2516
|
+
}
|
|
2517
|
+
if (e.isCSS3DObject) {
|
|
2518
|
+
let i = e.layers.test(r.layers) === !0, a = e.element;
|
|
2519
|
+
if (a.style.display = i === !0 ? "" : "none", i === !0) {
|
|
2520
|
+
e.onBeforeRender(t, n, r);
|
|
2521
|
+
let i;
|
|
2522
|
+
e.isCSS3DSprite ? (W.copy(r.matrixWorldInverse), W.transpose(), e.rotation2D !== 0 && W.multiply(ot.makeRotationZ(e.rotation2D)), e.matrixWorld.decompose(V, it, H), W.setPosition(V), W.scale(H), W.elements[3] = 0, W.elements[7] = 0, W.elements[11] = 0, W.elements[15] = 1, i = h(W)) : i = h(e.matrixWorld);
|
|
2523
|
+
let s = o.objects.get(e);
|
|
2524
|
+
if (s === void 0 || s.style !== i) {
|
|
2525
|
+
a.style.transform = i;
|
|
2526
|
+
let t = { style: i };
|
|
2527
|
+
o.objects.set(e, t);
|
|
2528
|
+
}
|
|
2529
|
+
a.parentNode !== l && l.appendChild(a), e.onAfterRender(t, n, r);
|
|
2530
|
+
}
|
|
277
2531
|
}
|
|
2532
|
+
for (let t = 0, a = e.children.length; t < a; t++) _(e.children[t], n, r, i);
|
|
278
2533
|
}
|
|
279
|
-
|
|
280
|
-
|
|
2534
|
+
}
|
|
2535
|
+
}, ct = "#five-CSS3DPlugin {\n position: absolute;\n pointer-events: none;\n user-select: none;\n transform-origin: left top;\n}\n\n.five-CSS3DPlugin-X {\n --timeout: 300ms;\n transition: opacity ease-in-out var(--timeout);\n}\n\n.five-CSS3DPlugin-hidden {\n opacity: 0;\n}\n\n#five-CSS3DPlugin .five-CSS3DPlugin-hidden * {\n pointer-events: none;\n}\n", lt = class extends w.Controller {
|
|
2536
|
+
updateState(e, t) {
|
|
2537
|
+
let n = this.state;
|
|
2538
|
+
this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
|
|
2539
|
+
state: this.state,
|
|
2540
|
+
prevState: n,
|
|
2541
|
+
userAction: t
|
|
2542
|
+
});
|
|
2543
|
+
}
|
|
2544
|
+
constructor(e, t) {
|
|
2545
|
+
super(e), this.scene = new a.Scene(), this.styleSheet = new CSSStyleSheet(), this.camera = new a.PerspectiveCamera(), this.cacheMap = /* @__PURE__ */ new WeakMap(), this.createCSS3DObject = ({ id: e = tt(), name: t, innerHTML: n, sprite: r, normal: i, position: o, scalar: s = .00216, visible: c = !0, timeout: l }) => {
|
|
2546
|
+
let u = document.createElement("div");
|
|
2547
|
+
u.className = "five-CSS3DPlugin-X", c || u.classList.add("five-CSS3DPlugin-hidden"), l && u.style.setProperty("--timeout", l + "ms"), u.innerHTML = n;
|
|
2548
|
+
let d = r ? new at(u) : new U(u);
|
|
2549
|
+
if (d.userData = {
|
|
2550
|
+
id: e,
|
|
2551
|
+
_visible: c,
|
|
2552
|
+
_timeout: l,
|
|
2553
|
+
get visible() {
|
|
2554
|
+
return this._visible;
|
|
2555
|
+
},
|
|
2556
|
+
set visible(e) {
|
|
2557
|
+
e ? u.classList.remove("five-CSS3DPlugin-hidden") : u.classList.add("five-CSS3DPlugin-hidden"), this._visible = e;
|
|
2558
|
+
},
|
|
2559
|
+
get timeout() {
|
|
2560
|
+
return this._timeout;
|
|
2561
|
+
},
|
|
2562
|
+
set timeout(e) {
|
|
2563
|
+
u.style.setProperty("--timeout", e + "ms"), this._timeout = e;
|
|
2564
|
+
}
|
|
2565
|
+
}, i) {
|
|
2566
|
+
let e = new a.Vector3(0, 0, 1), t = new a.Quaternion().setFromUnitVectors(e, i.clone().normalize());
|
|
2567
|
+
d.quaternion.copy(t);
|
|
2568
|
+
}
|
|
2569
|
+
return o && d.position.copy(o), s && d.scale.setScalar(s), t && (d.name = t), d;
|
|
2570
|
+
}, this.render = () => {
|
|
2571
|
+
this.camera.fov = this.five.camera.fov, this.camera.aspect = this.five.camera.aspect, this.camera.position.copy(this.five.camera.position), this.camera.rotation.copy(this.five.camera.rotation), this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera);
|
|
2572
|
+
}, this.forceRender = () => {
|
|
2573
|
+
this.renderer.markDirty(), this.render();
|
|
2574
|
+
}, this._addEventListener = () => {
|
|
2575
|
+
this.five.on("render.prepare", this.render), this.appendToFiveContainer();
|
|
2576
|
+
}, this._removeEventListener = () => {
|
|
2577
|
+
var e;
|
|
2578
|
+
this.five.off("render.prepare", this.render), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = void 0;
|
|
2579
|
+
}, this.dispose = () => {
|
|
2580
|
+
this.removeAll(), this._disable({ userAction: !1 });
|
|
2581
|
+
}, this.five = e, this.renderer = new st(), this.renderer.domElement.id = "five-CSS3DPlugin", this.styleSheet.replaceSync(ct), /Chrome/.test(navigator.userAgent) && !/Edge|Edg|OPR/.test(navigator.userAgent) && this.styleSheet.insertRule("#five-CSS3DPlugin * { transform-style: preserve-3d; }"), document && document.adoptedStyleSheets.push(this.styleSheet);
|
|
2582
|
+
let n = {
|
|
2583
|
+
enabled: !0,
|
|
2584
|
+
visible: !0
|
|
2585
|
+
};
|
|
2586
|
+
this.state = Object.assign(n, t == null ? void 0 : t.initialState), this.state.enabled ? this._enable({ userAction: !1 }) : this.styleSheet.disabled = !0;
|
|
2587
|
+
}
|
|
2588
|
+
load(e) {
|
|
2589
|
+
return S(this, void 0, void 0, function* () {});
|
|
2590
|
+
}
|
|
2591
|
+
appendToFiveContainer() {
|
|
2592
|
+
var e;
|
|
2593
|
+
if (!this.five.renderer) return;
|
|
2594
|
+
let t = this.five.getElement();
|
|
2595
|
+
if (!(t != null && t.parentElement)) return;
|
|
2596
|
+
let { x: n, y: r } = this.five.renderer.getSize(new a.Vector2());
|
|
2597
|
+
t.parentElement.appendChild(this.renderer.domElement), this.renderer.setSize(n * 2, r * 2), this.renderer.domElement.style.width = n * 2 + "px", this.renderer.domElement.style.height = r * 2 + "px", this.renderer.domElement.style.transform = "scale(0.5)", (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = new ResizeObserver(() => {
|
|
2598
|
+
var e;
|
|
2599
|
+
if (!this.five.renderer) return;
|
|
2600
|
+
let t = (e = this.five.getElement()) == null ? void 0 : e.getBoundingClientRect();
|
|
2601
|
+
if (!t) return;
|
|
2602
|
+
let { x: n, y: r, width: i, height: a } = t;
|
|
2603
|
+
this.renderer.setSize(i * 2, a * 2), this.renderer.domElement.style.left = n + "px", this.renderer.domElement.style.top = r + "px", this.renderer.domElement.style.width = i * 2 + "px", this.renderer.domElement.style.height = a * 2 + "px", this.render();
|
|
2604
|
+
}), this.resizeObserver.observe(t);
|
|
2605
|
+
}
|
|
2606
|
+
add(...e) {
|
|
2607
|
+
this.scene.add(...e), this.renderer.updateSpriteSet(this.scene), this.forceRender();
|
|
2608
|
+
}
|
|
2609
|
+
remove(e) {
|
|
2610
|
+
this.scene.remove(e), e.traverse((e) => {
|
|
2611
|
+
e instanceof U && e.element.remove();
|
|
2612
|
+
}), this.renderer.updateSpriteSet(this.scene), this.forceRender();
|
|
2613
|
+
}
|
|
2614
|
+
removeAll() {
|
|
2615
|
+
this.scene.remove(...this.scene.children), this.renderer.updateSpriteSet(this.scene), this.forceRender();
|
|
2616
|
+
}
|
|
2617
|
+
fadeInObjects(...e) {
|
|
2618
|
+
for (let t of e) t.userData.visible = !0;
|
|
2619
|
+
this.render();
|
|
2620
|
+
}
|
|
2621
|
+
fadeOutObjects(...e) {
|
|
2622
|
+
for (let t of e) t.userData.visible = !1;
|
|
2623
|
+
this.render();
|
|
2624
|
+
}
|
|
2625
|
+
_enable(e) {
|
|
2626
|
+
this.styleSheet.disabled = !1, this.updateState({ enabled: !0 }, e.userAction), this._addEventListener(), this.render();
|
|
2627
|
+
}
|
|
2628
|
+
_disable(e) {
|
|
2629
|
+
this.styleSheet.disabled = !0, this.updateState({ enabled: !1 }, e.userAction), this._removeEventListener();
|
|
2630
|
+
}
|
|
2631
|
+
enable(e) {
|
|
2632
|
+
var t;
|
|
2633
|
+
if (this.state.enabled) return;
|
|
2634
|
+
let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
|
|
2635
|
+
this._enable({ userAction: n });
|
|
2636
|
+
}
|
|
2637
|
+
disable(e) {
|
|
2638
|
+
var t;
|
|
2639
|
+
if (this.state.enabled === !1) return;
|
|
2640
|
+
let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
|
|
2641
|
+
this._disable({ userAction: n });
|
|
2642
|
+
}
|
|
2643
|
+
show(e) {
|
|
2644
|
+
this.renderer.domElement.style.display = "block", this.updateState({ visible: !0 }, !0), this.forceRender();
|
|
2645
|
+
}
|
|
2646
|
+
hide(e) {
|
|
2647
|
+
this.renderer.domElement.style.display = "none", this.updateState({ visible: !1 }, !0);
|
|
2648
|
+
}
|
|
2649
|
+
}, ut = (e, t) => new lt(e, t);
|
|
2650
|
+
//#endregion
|
|
2651
|
+
//#region build/plugins/FloorplanPlugin/utils/formatData.js
|
|
2652
|
+
function dt(e) {
|
|
2653
|
+
return S(this, void 0, void 0, function* () {
|
|
2654
|
+
return Promise.all(e.map((e) => S(this, void 0, void 0, function* () {
|
|
2655
|
+
if (!e.svg_url) return {
|
|
2656
|
+
url: e.url,
|
|
2657
|
+
index: e.index
|
|
2658
|
+
};
|
|
2659
|
+
let t = yield fetch(e.svg_url).then((e) => e.text()).catch(() => void 0);
|
|
2660
|
+
return {
|
|
2661
|
+
url: e.url,
|
|
2662
|
+
index: e.index,
|
|
2663
|
+
svgUrl: e.svg_url,
|
|
2664
|
+
svgContent: t
|
|
2665
|
+
};
|
|
2666
|
+
})));
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
function ft(e) {
|
|
2670
|
+
let { room_type: t, floor_type: n, room_label: r, observer_indexs: i, customized_name: a, dimension: o } = e, s = x(e, [
|
|
2671
|
+
"room_type",
|
|
2672
|
+
"floor_type",
|
|
2673
|
+
"room_label",
|
|
2674
|
+
"observer_indexs",
|
|
2675
|
+
"customized_name",
|
|
2676
|
+
"dimension"
|
|
2677
|
+
]);
|
|
2678
|
+
return Object.assign(Object.assign({}, s), {
|
|
2679
|
+
roomType: t,
|
|
2680
|
+
floorType: n,
|
|
2681
|
+
roomLabel: {
|
|
2682
|
+
position: r.position,
|
|
2683
|
+
positionInImage: r.position_in_image
|
|
2684
|
+
},
|
|
2685
|
+
observerIndexs: i,
|
|
2686
|
+
customizedName: a,
|
|
2687
|
+
dimension: o ? {
|
|
2688
|
+
width: o.width,
|
|
2689
|
+
height: o.height,
|
|
2690
|
+
vertical: o.vertical,
|
|
2691
|
+
horizontal: o.horizontal
|
|
2692
|
+
} : void 0
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
function pt(e) {
|
|
2696
|
+
let { floor_name: t, floor_index: n, rooms: r } = e, i = x(e, [
|
|
2697
|
+
"floor_name",
|
|
2698
|
+
"floor_index",
|
|
2699
|
+
"rooms"
|
|
2700
|
+
]);
|
|
2701
|
+
return Object.assign(Object.assign({}, i), {
|
|
2702
|
+
floorName: t,
|
|
2703
|
+
floorIndex: n,
|
|
2704
|
+
rooms: r.map(ft)
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
function mt(e) {
|
|
2708
|
+
return {
|
|
2709
|
+
floorIndex: e.floor_index,
|
|
2710
|
+
positionInImage: e.position_in_image
|
|
2711
|
+
};
|
|
2712
|
+
}
|
|
2713
|
+
function ht(e) {
|
|
2714
|
+
return {
|
|
2715
|
+
positionInImage: e.position_in_image,
|
|
2716
|
+
northRad: e.north_rad,
|
|
2717
|
+
roomId: e.room_id,
|
|
2718
|
+
floorIndex: e.floor_index
|
|
2719
|
+
};
|
|
2720
|
+
}
|
|
2721
|
+
function gt(e) {
|
|
2722
|
+
return S(this, void 0, void 0, function* () {
|
|
2723
|
+
var t, n;
|
|
2724
|
+
let { computed_data: r } = e;
|
|
2725
|
+
return {
|
|
2726
|
+
outlines: yield dt((t = e.outlines) == null ? [] : t),
|
|
2727
|
+
bounding: r.bounding,
|
|
2728
|
+
floorDatas: r.floor_datas.map(pt),
|
|
2729
|
+
entrance: r.entrance ? ht(r.entrance) : null,
|
|
2730
|
+
observers: ((n = r.observers) == null ? [] : n).map(mt)
|
|
2731
|
+
};
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
//#endregion
|
|
2735
|
+
//#region build/plugins/FloorplanPlugin/utils/nearlyEqual.js
|
|
2736
|
+
function G(e, t, n = 2) {
|
|
2737
|
+
return Number(e.toFixed(n)) === Number(t.toFixed(n));
|
|
2738
|
+
}
|
|
2739
|
+
function _t(e, t, n = 2) {
|
|
2740
|
+
let r = Math.PI * 2, i = (e) => (e % r + r) % r, a = i(e), o = i(t), s = Math.min(Math.abs(a - o), r - Math.abs(a - o));
|
|
2741
|
+
return Number(s.toFixed(n)) === 0;
|
|
2742
|
+
}
|
|
2743
|
+
//#endregion
|
|
2744
|
+
//#region build/plugins/FloorplanPlugin/utils/to.js
|
|
2745
|
+
function K(e) {
|
|
2746
|
+
return S(this, void 0, void 0, function* () {
|
|
2747
|
+
try {
|
|
2748
|
+
return [null, yield e];
|
|
2749
|
+
} catch (e) {
|
|
2750
|
+
return e instanceof Error ? [e, null] : [Error(String(e)), null];
|
|
281
2751
|
}
|
|
282
|
-
c((r = r.apply(e, t || [])).next());
|
|
283
2752
|
});
|
|
284
2753
|
}
|
|
285
2754
|
//#endregion
|
|
286
|
-
//#region build/plugins/utils/
|
|
287
|
-
function
|
|
288
|
-
return
|
|
2755
|
+
//#region build/plugins/FloorplanPlugin/utils/changeMode.js
|
|
2756
|
+
function vt(e) {
|
|
2757
|
+
return Object.prototype.toString.call(e) === "[object Object]" && !!e.isVector3;
|
|
2758
|
+
}
|
|
2759
|
+
function yt(e, t) {
|
|
2760
|
+
return Object.keys(e).every((n) => {
|
|
2761
|
+
let r = t[n], i = e[n];
|
|
2762
|
+
return r === void 0 || i === void 0 ? !0 : n === "longitude" || n === "latitude" ? _t(r, i, 2) : typeof r == "number" && typeof i == "number" ? G(r, i, 2) : vt(i) && vt(r) ? i.distanceTo(r) < .01 : r === i;
|
|
2763
|
+
});
|
|
289
2764
|
}
|
|
290
|
-
function
|
|
291
|
-
return
|
|
2765
|
+
function bt(e, t) {
|
|
2766
|
+
return S(this, void 0, void 0, function* () {
|
|
2767
|
+
let [n] = yield K(e.changeMode(...t));
|
|
2768
|
+
if (n) throw Error("change mode canceled");
|
|
2769
|
+
yield new Promise((t) => {
|
|
2770
|
+
e.once("initAnimationWillStart", () => {
|
|
2771
|
+
e.once("initAnimationEnded", () => t());
|
|
2772
|
+
});
|
|
2773
|
+
});
|
|
2774
|
+
let r = t[1];
|
|
2775
|
+
if (r && !yt(r, e.getCurrentState())) throw Error("pose 与预期不符");
|
|
2776
|
+
});
|
|
292
2777
|
}
|
|
293
2778
|
//#endregion
|
|
294
|
-
//#region build/plugins/
|
|
295
|
-
|
|
296
|
-
(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
2779
|
+
//#region build/plugins/FloorplanPlugin/utils/getDistanceFromModel.js
|
|
2780
|
+
function xt(e, t, n) {
|
|
2781
|
+
let r = e.modelScene.boundingBox, i = r.isEmpty() ? 10 : Math.pow(Math.pow(r.max.x - r.min.x + 1, 2) + Math.pow(r.max.y - r.min.y + 1, 2) + Math.pow(r.max.z - r.min.z + 1, 2), 1 / 2), a = i / 2 / Math.tan(Math.PI * t / 360);
|
|
2782
|
+
return n < 1 && (a /= n), Number.isNaN(a) ? i : a;
|
|
2783
|
+
}
|
|
2784
|
+
//#endregion
|
|
2785
|
+
//#region build/plugins/FloorplanPlugin/utils/filter.js
|
|
2786
|
+
function St(e, t) {
|
|
2787
|
+
let n = Object.assign({}, e);
|
|
2788
|
+
for (let e of t) delete n[e];
|
|
2789
|
+
return n;
|
|
2790
|
+
}
|
|
2791
|
+
function Ct(e, t) {
|
|
2792
|
+
if (e.currentMode !== t.mode) return !1;
|
|
2793
|
+
let n = e.getCurrentState(), r = e.camera.fov;
|
|
2794
|
+
return !(!G(n.latitude, t.latitude, 2) || !G(n.longitude, t.longitude, 2) || t.fov !== void 0 && !G(r, t.fov, 2) || t.offset && n.offset.distanceTo(t.offset) > .01);
|
|
2795
|
+
}
|
|
2796
|
+
function wt(e, t) {
|
|
2797
|
+
return S(this, arguments, void 0, function* (e, t, n = !0) {
|
|
2798
|
+
var r;
|
|
2799
|
+
if (Ct(e, t)) return;
|
|
2800
|
+
let i = e.getCurrentState();
|
|
2801
|
+
if (e.currentMode !== t.mode) {
|
|
2802
|
+
let r = e.models.find((t) => t.name === e.state.workCode), i = typeof t.fov == "number" ? t.fov : 80;
|
|
2803
|
+
r && (t.distance = xt(e, i, e.camera.aspect));
|
|
2804
|
+
let [a] = yield K(bt(e, [
|
|
2805
|
+
t.mode,
|
|
2806
|
+
t,
|
|
2807
|
+
void 0,
|
|
2808
|
+
n
|
|
2809
|
+
]));
|
|
2810
|
+
if (a) throw a;
|
|
2811
|
+
return;
|
|
300
2812
|
}
|
|
301
|
-
|
|
302
|
-
|
|
2813
|
+
let { latitude: a, longitude: o, fov: s } = i, c = (r = t.fov) == null ? s : r, l = Math.min(1e3, Math.max(200, Math.abs(a - Math.PI / 2) * 1e3, (o > Math.PI ? Math.PI * 2 - o : o) * 500, Number.isFinite(c) ? Math.abs(s - c) * 10 : Infinity)), [u] = yield K(e.updateCamera(St(t, ["mode"]), l, n));
|
|
2814
|
+
if (u) throw Error("UpdateCameraError");
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
//#endregion
|
|
2818
|
+
//#region build/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js
|
|
2819
|
+
function Tt(e, t, n = 300) {
|
|
2820
|
+
let r = e.getElement();
|
|
2821
|
+
if (!r) return;
|
|
2822
|
+
r.style.opacity = t + "";
|
|
2823
|
+
let i = r.parentElement;
|
|
2824
|
+
if (i) for (let e = 0; e < i.children.length; e++) {
|
|
2825
|
+
let n = i.children[e];
|
|
2826
|
+
n instanceof HTMLElement && n.dataset.infive === "1" && (n.style.opacity = t + "");
|
|
2827
|
+
}
|
|
2828
|
+
r.style.transition = n === 0 ? "none" : `opacity ${n}ms linear`, n !== 0 && Promise.race([new Promise((e) => r.addEventListener("transitionend", () => e(), { once: !0 })), new Promise((e) => setTimeout(e, n))]).then(() => {
|
|
2829
|
+
r.style.transition = "none";
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
//#endregion
|
|
2833
|
+
//#region build/plugins/FloorplanPlugin/utils/getPxmm.js
|
|
2834
|
+
function Et(e, t) {
|
|
2835
|
+
var n, r;
|
|
2836
|
+
let i = (r = (n = e.work) == null ? void 0 : n.observers) == null ? [] : r;
|
|
2837
|
+
if (t > (i.length ? Math.max(...i.map((e) => e.floorIndex)) : 0)) return e.modelScene.boundingBox.max.y;
|
|
2838
|
+
let a = i.filter((e) => e.floorIndex === t).map((e) => e.standingPosition.y);
|
|
2839
|
+
return a.length ? Math.max(...a) : e.modelScene.boundingBox.min.y;
|
|
2840
|
+
}
|
|
2841
|
+
function Dt(e, t, n = 3) {
|
|
2842
|
+
let r = e.modelScene.boundingBox;
|
|
2843
|
+
return n === 3 ? (r.max.y + r.min.y) / 2 : n === 2 ? Et(e, t + 1) : Et(e, t);
|
|
2844
|
+
}
|
|
2845
|
+
function Ot(e, t, n, r) {
|
|
2846
|
+
let i = Dt(e, n, r == null ? void 0 : r.attachedTo), o = new a.Vector3(0, i, 0), s = new a.Vector3(1, i, 0), c = o.clone().project(e.camera), l = s.clone().project(e.camera);
|
|
2847
|
+
return Math.abs((l.x - c.x) / 1e3) * (t.getBoundingClientRect().width / 2);
|
|
2848
|
+
}
|
|
2849
|
+
//#endregion
|
|
2850
|
+
//#region build/plugins/FloorplanPlugin/utils/fiveModelLoad.js
|
|
2851
|
+
function kt(e) {
|
|
2852
|
+
var t;
|
|
2853
|
+
return ((t = e.models) == null ? void 0 : t.filter((t) => t.name === e.state.workCode)[0]) || e.model;
|
|
2854
|
+
}
|
|
2855
|
+
function At(e) {
|
|
2856
|
+
var t;
|
|
2857
|
+
return !!((t = kt(e)) != null && t.loaded);
|
|
2858
|
+
}
|
|
2859
|
+
function jt(e) {
|
|
2860
|
+
return S(this, void 0, void 0, function* () {
|
|
2861
|
+
return new Promise((t) => {
|
|
2862
|
+
if (At(e)) {
|
|
2863
|
+
t();
|
|
2864
|
+
return;
|
|
2865
|
+
}
|
|
2866
|
+
let n = (r) => {
|
|
2867
|
+
r === kt(e) && (e.off("modelLoaded", n), t());
|
|
2868
|
+
};
|
|
2869
|
+
e.on("modelLoaded", n);
|
|
2870
|
+
});
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
//#endregion
|
|
2874
|
+
//#region build/plugins/FloorplanPlugin/utils/isTruelyObject.js
|
|
2875
|
+
function q(e) {
|
|
2876
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
2877
|
+
}
|
|
2878
|
+
//#endregion
|
|
2879
|
+
//#region build/plugins/FloorplanPlugin/utils/equal.js
|
|
2880
|
+
function J(e, t) {
|
|
2881
|
+
return !!(e === t || typeof e == "number" && typeof t == "number" && Number.isNaN(e) && Number.isNaN(t));
|
|
2882
|
+
}
|
|
2883
|
+
function Mt(e, t) {
|
|
2884
|
+
let n = Object.keys(e);
|
|
2885
|
+
return n.length === Object.keys(t).length ? n.every((n) => J(e[n], t[n])) : !1;
|
|
2886
|
+
}
|
|
2887
|
+
function Nt(e, t) {
|
|
2888
|
+
let n = Object.keys(e);
|
|
2889
|
+
return n.length === Object.keys(t).length ? n.every((n) => Lt(e[n], t[n])) : !1;
|
|
2890
|
+
}
|
|
2891
|
+
function Pt(e, t) {
|
|
2892
|
+
return e.length === t.length ? e.every((e, n) => J(e, t[n])) : !1;
|
|
2893
|
+
}
|
|
2894
|
+
function Ft(e, t) {
|
|
2895
|
+
return e.length === t.length ? e.every((e, n) => Lt(e, t[n])) : !1;
|
|
2896
|
+
}
|
|
2897
|
+
function It(e, t) {
|
|
2898
|
+
return J(e, t) ? !0 : q(e) && q(t) ? Mt(e, t) : Array.isArray(e) && Array.isArray(t) ? Pt(e, t) : !1;
|
|
2899
|
+
}
|
|
2900
|
+
function Lt(e, t) {
|
|
2901
|
+
return J(e, t) ? !0 : q(e) && q(t) ? Nt(e, t) : Array.isArray(e) && Array.isArray(t) ? Ft(e, t) : !1;
|
|
2902
|
+
}
|
|
2903
|
+
function Rt(e, t, n = { deep: !1 }) {
|
|
2904
|
+
return n.deep ? Lt(e, t) : It(e, t);
|
|
2905
|
+
}
|
|
2906
|
+
//#endregion
|
|
2907
|
+
//#region build/plugins/FloorplanPlugin/utils/formatPosition.js
|
|
2908
|
+
function Y(e, t = {}) {
|
|
2909
|
+
let n = "", { needZ: r, format: i } = t;
|
|
2910
|
+
return (r ? e.slice().concat(e[0]) : e.slice()).forEach((e, t) => {
|
|
2911
|
+
let { x: r, y: a } = i ? i(e) : e, o = `${r},${a}`;
|
|
2912
|
+
n += (t === 0 ? "M" : "L") + o;
|
|
2913
|
+
}), n + (r ? "Z" : "");
|
|
2914
|
+
}
|
|
2915
|
+
function zt({ x: e, y: t }, n) {
|
|
2916
|
+
let { max: r, min: i } = n;
|
|
2917
|
+
return {
|
|
2918
|
+
x: e - i.x,
|
|
2919
|
+
y: r.y - t
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
//#endregion
|
|
2923
|
+
//#region build/plugins/FloorplanPlugin/render/isPointInPolygon.js
|
|
2924
|
+
function Bt(e, t) {
|
|
2925
|
+
let [n, r] = e, i = !1;
|
|
2926
|
+
for (let e = 0, a = t.length - 1; e < t.length; a = e++) {
|
|
2927
|
+
let [o, s] = t[e], [c, l] = t[a];
|
|
2928
|
+
s > r != l > r && n < (c - o) * (r - s) / (l - s) + o && (i = !i);
|
|
2929
|
+
}
|
|
2930
|
+
return i;
|
|
2931
|
+
}
|
|
2932
|
+
//#endregion
|
|
2933
|
+
//#region build/plugins/FloorplanPlugin/render/roomLabelVisibility.js
|
|
2934
|
+
function Vt(e, t, n) {
|
|
2935
|
+
if (t.width === 0 || t.height === 0) return !1;
|
|
2936
|
+
let r = e.path.map(({ x: e, y: t }) => [e, t]), { x: i, y: a } = e.roomLabel.position, o = t.width / 2, s = t.height / 2, c = i * n, l = a * n, u = r.map(([e, t]) => [e * n, t * n]);
|
|
2937
|
+
return [
|
|
2938
|
+
[c + o, l - s],
|
|
2939
|
+
[c - o, l - s],
|
|
2940
|
+
[c - o, l + s],
|
|
2941
|
+
[c + o, l + s]
|
|
2942
|
+
].every((e) => Bt(e, u));
|
|
2943
|
+
}
|
|
2944
|
+
var Ht = "data:image/png;base64,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", Ut = (e) => e * 180 / Math.PI;
|
|
2945
|
+
function X(e, t) {
|
|
2946
|
+
let n = document.createElement(e);
|
|
2947
|
+
return t && (n.className = t), n;
|
|
2948
|
+
}
|
|
2949
|
+
function Z(e, t) {
|
|
2950
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", e);
|
|
2951
|
+
if (t) for (let e in t) n.setAttribute(e, t[e]);
|
|
2952
|
+
return n;
|
|
2953
|
+
}
|
|
2954
|
+
function Wt(e) {
|
|
2955
|
+
let t = X("div", "floorplan-plugin__missing-floor"), { imageURL: n, imageWidth: r = 200, imageHeight: i = 120, text: a, textFontSize: o = 14 } = e.missingFloorConfig;
|
|
2956
|
+
if (n) {
|
|
2957
|
+
let e = X("img");
|
|
2958
|
+
e.src = n, e.alt = "缺省楼层展位图", e.style.width = r + "px", e.style.height = i + "px", e.style.maxWidth = "none", t.appendChild(e);
|
|
2959
|
+
}
|
|
2960
|
+
if (a) {
|
|
2961
|
+
let e = X("span", "floorplan-plugin__missing-floor-text");
|
|
2962
|
+
e.style.fontSize = o + "px", e.textContent = a, t.appendChild(e);
|
|
2963
|
+
}
|
|
2964
|
+
return t;
|
|
2965
|
+
}
|
|
2966
|
+
var Gt = 0;
|
|
2967
|
+
function Kt(e, t) {
|
|
2968
|
+
e.appendChild(Z("path", {
|
|
2969
|
+
d: t,
|
|
2970
|
+
fill: "#2F313A"
|
|
2971
|
+
}));
|
|
2972
|
+
}
|
|
2973
|
+
function qt(e, t) {
|
|
2974
|
+
let n = `fpm-room-pattern-tile-${Gt++}`, r = Z("defs"), i = Z("pattern", {
|
|
2975
|
+
id: n,
|
|
2976
|
+
x: "0",
|
|
2977
|
+
y: "0",
|
|
2978
|
+
width: "12",
|
|
2979
|
+
height: "12",
|
|
2980
|
+
patternUnits: "userSpaceOnUse",
|
|
2981
|
+
patternTransform: "scale(50 50)"
|
|
2982
|
+
});
|
|
2983
|
+
i.appendChild(Z("rect", {
|
|
2984
|
+
x: "0",
|
|
2985
|
+
y: "0",
|
|
2986
|
+
width: "12",
|
|
2987
|
+
height: "12",
|
|
2988
|
+
fill: "#323747"
|
|
2989
|
+
})), i.appendChild(Z("path", {
|
|
2990
|
+
d: "M0 6 h 12 M6 0 v 12",
|
|
2991
|
+
stroke: "#ffffff",
|
|
2992
|
+
"stroke-opacity": "0.06",
|
|
2993
|
+
"stroke-width": "0.5",
|
|
2994
|
+
fill: "none"
|
|
2995
|
+
})), r.appendChild(i), e.appendChild(r), e.appendChild(Z("path", {
|
|
2996
|
+
d: t,
|
|
2997
|
+
fill: `url(#${n})`
|
|
2998
|
+
}));
|
|
2999
|
+
}
|
|
3000
|
+
function Jt(e, t) {
|
|
3001
|
+
let n = `fpm-room-pattern-wood-1-${Gt++}`, r = `fpm-room-pattern-wood-2-${Gt++}`, i = Z("defs"), a = Z("pattern", {
|
|
3002
|
+
id: n,
|
|
3003
|
+
x: "0",
|
|
3004
|
+
y: "0",
|
|
3005
|
+
width: "12",
|
|
3006
|
+
height: "50",
|
|
3007
|
+
patternUnits: "userSpaceOnUse",
|
|
3008
|
+
patternTransform: "scale(50 50)"
|
|
3009
|
+
});
|
|
3010
|
+
a.appendChild(Z("rect", {
|
|
3011
|
+
x: "0",
|
|
3012
|
+
y: "0",
|
|
3013
|
+
width: "6",
|
|
3014
|
+
height: "50",
|
|
3015
|
+
fill: "none",
|
|
3016
|
+
stroke: "#4B4B57",
|
|
3017
|
+
"stroke-width": "0.5"
|
|
3018
|
+
}));
|
|
3019
|
+
let o = Z("pattern", {
|
|
3020
|
+
id: r,
|
|
3021
|
+
x: "6",
|
|
3022
|
+
y: "25",
|
|
3023
|
+
width: "12",
|
|
3024
|
+
height: "50",
|
|
3025
|
+
patternUnits: "userSpaceOnUse",
|
|
3026
|
+
patternTransform: "scale(50 50)"
|
|
3027
|
+
});
|
|
3028
|
+
o.appendChild(Z("rect", {
|
|
3029
|
+
x: "0",
|
|
3030
|
+
y: "0",
|
|
3031
|
+
width: "6",
|
|
3032
|
+
height: "50",
|
|
3033
|
+
fill: "none",
|
|
3034
|
+
stroke: "#4B4B57",
|
|
3035
|
+
"stroke-width": "0.5"
|
|
3036
|
+
})), i.appendChild(a), i.appendChild(o), e.appendChild(i), e.appendChild(Z("path", {
|
|
3037
|
+
d: t,
|
|
3038
|
+
fill: "#43434D"
|
|
3039
|
+
})), e.appendChild(Z("path", {
|
|
3040
|
+
d: t,
|
|
3041
|
+
fill: `url(#${n})`
|
|
3042
|
+
})), e.appendChild(Z("path", {
|
|
3043
|
+
d: t,
|
|
3044
|
+
fill: `url(#${r})`
|
|
3045
|
+
}));
|
|
3046
|
+
}
|
|
3047
|
+
function Yt(e) {
|
|
3048
|
+
let { vertical: t, horizontal: n } = e;
|
|
3049
|
+
if (!(!t || t.length < 2 || !n || n.length < 2)) return `${Y([
|
|
3050
|
+
{
|
|
3051
|
+
x: t[1].x,
|
|
3052
|
+
y: t[1].y + 53
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
x: t[1].x - 60,
|
|
3056
|
+
y: t[1].y + 124
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
x: t[1].x + 60,
|
|
3060
|
+
y: t[1].y + 124
|
|
303
3061
|
}
|
|
304
|
-
|
|
305
|
-
|
|
3062
|
+
], { needZ: !0 })} ${Y([
|
|
3063
|
+
{
|
|
3064
|
+
x: t[0].x,
|
|
3065
|
+
y: t[0].y - 53
|
|
3066
|
+
},
|
|
3067
|
+
{
|
|
3068
|
+
x: t[0].x - 60,
|
|
3069
|
+
y: t[0].y - 124
|
|
3070
|
+
},
|
|
3071
|
+
{
|
|
3072
|
+
x: t[0].x + 60,
|
|
3073
|
+
y: t[0].y - 124
|
|
3074
|
+
}
|
|
3075
|
+
], { needZ: !0 })} ${Y([
|
|
3076
|
+
{
|
|
3077
|
+
x: n[0].x + 53,
|
|
3078
|
+
y: n[0].y
|
|
3079
|
+
},
|
|
3080
|
+
{
|
|
3081
|
+
x: n[0].x + 124,
|
|
3082
|
+
y: n[0].y + 60
|
|
3083
|
+
},
|
|
3084
|
+
{
|
|
3085
|
+
x: n[0].x + 124,
|
|
3086
|
+
y: n[0].y - 60
|
|
3087
|
+
}
|
|
3088
|
+
], { needZ: !0 })} ${Y([
|
|
3089
|
+
{
|
|
3090
|
+
x: n[1].x - 53,
|
|
3091
|
+
y: n[1].y
|
|
3092
|
+
},
|
|
3093
|
+
{
|
|
3094
|
+
x: n[1].x - 124,
|
|
3095
|
+
y: n[1].y + 60
|
|
3096
|
+
},
|
|
3097
|
+
{
|
|
3098
|
+
x: n[1].x - 124,
|
|
3099
|
+
y: n[1].y - 60
|
|
3100
|
+
}
|
|
3101
|
+
], { needZ: !0 })}`;
|
|
3102
|
+
}
|
|
3103
|
+
function Xt(e, t, n) {
|
|
3104
|
+
let r = X("div", "floorplan-plugin__room-material"), { bounding: i } = t, a = i.max.x - i.min.x, o = i.max.y - i.min.y, s = n.roomLabelsEnable && n.roomDimensionEnable;
|
|
3105
|
+
for (let t of e.rooms) {
|
|
3106
|
+
let e = Y(t.path.map((e) => zt(e, i)), { needZ: !0 }), n = Z("svg", {
|
|
3107
|
+
width: "100%",
|
|
3108
|
+
height: "100%",
|
|
3109
|
+
viewBox: `0 0 ${a} ${o}`
|
|
3110
|
+
});
|
|
3111
|
+
if (t.floorType === 1 ? Kt(n, e) : t.floorType === 0 ? Jt(n, e) : qt(n, e), r.appendChild(n), s && t.dimension) {
|
|
3112
|
+
let e = Yt(t.dimension);
|
|
3113
|
+
if (e) {
|
|
3114
|
+
let t = Z("svg", {
|
|
3115
|
+
width: "100%",
|
|
3116
|
+
height: "100%",
|
|
3117
|
+
viewBox: `0 0 ${a} ${o}`
|
|
3118
|
+
});
|
|
3119
|
+
t.appendChild(Z("path", {
|
|
3120
|
+
d: e,
|
|
3121
|
+
fill: "#969696",
|
|
3122
|
+
stroke: "#969696",
|
|
3123
|
+
"stroke-width": "1",
|
|
3124
|
+
"fill-rule": "evenodd"
|
|
3125
|
+
})), r.appendChild(t);
|
|
3126
|
+
}
|
|
306
3127
|
}
|
|
307
3128
|
}
|
|
308
|
-
|
|
309
|
-
}
|
|
3129
|
+
return r;
|
|
3130
|
+
}
|
|
3131
|
+
function Zt(e, t, n) {
|
|
3132
|
+
let r = X("div", "floorplan-plugin__room-highlight"), { bounding: i } = t, a = Z("svg", {
|
|
3133
|
+
width: "100%",
|
|
3134
|
+
height: "100%",
|
|
3135
|
+
viewBox: `0 0 ${i.max.x - i.min.x} ${i.max.y - i.min.y}`
|
|
3136
|
+
});
|
|
3137
|
+
for (let t of e.rooms) {
|
|
3138
|
+
let e = Z("path", {
|
|
3139
|
+
d: Y(t.path, {
|
|
3140
|
+
needZ: !0,
|
|
3141
|
+
format: (e) => zt(e, i)
|
|
3142
|
+
}),
|
|
3143
|
+
id: `${n.floorIndex}_${t.id}`
|
|
3144
|
+
}), r = n.highlightData[`${n.floorIndex}_${t.id}`];
|
|
3145
|
+
r && (r.fill && (e.style.fill = r.fill), r.opacity !== void 0 && e.style.setProperty("--opacity", String(r.opacity)), e.style.pointerEvents = r.disabled ? "none" : "auto"), e.addEventListener("mouseenter", () => n.onRoomHover(t)), e.addEventListener("mouseleave", () => n.onRoomHover(null)), a.appendChild(e);
|
|
3146
|
+
}
|
|
3147
|
+
return r.appendChild(a), r;
|
|
3148
|
+
}
|
|
3149
|
+
function Qt(e, t) {
|
|
3150
|
+
let n = X("div", "floorplan-plugin__base-image"), r = e.outlines[t];
|
|
3151
|
+
if (r != null && r.svgContent) n.innerHTML = r.svgContent;
|
|
3152
|
+
else if (r != null && r.url) {
|
|
3153
|
+
let e = X("img");
|
|
3154
|
+
e.src = r.url, e.alt = "floorplan image", n.appendChild(e);
|
|
3155
|
+
}
|
|
3156
|
+
return n;
|
|
3157
|
+
}
|
|
3158
|
+
function $t(e) {
|
|
3159
|
+
var t;
|
|
3160
|
+
let n = X("div", "floorplan-plugin__items");
|
|
3161
|
+
for (let r of (t = e.items) == null ? [] : t) {
|
|
3162
|
+
let e = X("div", "floorplan-plugin__item");
|
|
3163
|
+
e.style.left = r.positionInImage.x * 100 + "%", e.style.top = r.positionInImage.y * 100 + "%", e.style.width = r.width * 100 + "%", e.style.height = r.height * 100 + "%";
|
|
3164
|
+
let t = X("img", "floorplan-plugin__item-img");
|
|
3165
|
+
if (t.src = r.src, t.alt = "", t.style.transform = `rotate(${r.rotateZ}deg) scaleX(${r.rotateX ? -1 : 1}) scaleY(${r.rotateY ? -1 : 1})`, e.appendChild(t), r.notes) {
|
|
3166
|
+
let t = X("span", "floorplan-plugin__item-notes");
|
|
3167
|
+
t.textContent = r.notes, e.appendChild(t);
|
|
3168
|
+
}
|
|
3169
|
+
n.appendChild(e);
|
|
3170
|
+
}
|
|
3171
|
+
return n;
|
|
3172
|
+
}
|
|
3173
|
+
function en(e, t, n, r) {
|
|
3174
|
+
var i, a;
|
|
3175
|
+
let o = X("div", "floorplan-plugin__room-label-item");
|
|
3176
|
+
o.style.left = e.roomLabel.positionInImage.x * 100 + "%", o.style.top = e.roomLabel.positionInImage.y * 100 + "%";
|
|
3177
|
+
let s = r === e.id, { bounding: c } = t, l = c.max.x - c.min.x;
|
|
3178
|
+
o.dataset.roomId = e.id, o.dataset.roomLabelX = String(e.roomLabel.position.x), o.dataset.roomLabelY = String(e.roomLabel.position.y), o.dataset.boundingWidth = String(l);
|
|
3179
|
+
let u = (i = n.getLabelElement) == null ? void 0 : i.call(n, e);
|
|
3180
|
+
if (u) return o.appendChild(u), o;
|
|
3181
|
+
let d = X("div", "floorplan-plugin__room-part1");
|
|
3182
|
+
if (n.roomNameEnable) {
|
|
3183
|
+
let t = X("span", "floorplan-plugin__room-name");
|
|
3184
|
+
t.textContent = n.roomNameOtherTypeEnable ? e.name : e.roomType === "100900000012" ? (a = e.customizedName) == null ? e.name : a : e.name, d.appendChild(t);
|
|
3185
|
+
}
|
|
3186
|
+
if (n.roomAreaEnable && e.size) {
|
|
3187
|
+
let t = X("span", "floorplan-plugin__room-area");
|
|
3188
|
+
t.textContent = n.getRoomAreaText(e.size), d.appendChild(t);
|
|
3189
|
+
}
|
|
3190
|
+
if (o.appendChild(d), n.roomDimensionEnable && e.dimension) {
|
|
3191
|
+
let t = X("span", "floorplan-plugin__room-size");
|
|
3192
|
+
t.textContent = n.getRoomDimensionText(e.dimension.width, e.dimension.height), o.appendChild(t);
|
|
3193
|
+
}
|
|
3194
|
+
return s && (o.style.opacity = "1", d.style.opacity = "1"), o;
|
|
3195
|
+
}
|
|
3196
|
+
function tn(e, t, n, r) {
|
|
3197
|
+
let i = X("div", "floorplan-plugin__room-labels");
|
|
3198
|
+
for (let a of e.rooms) i.appendChild(en(a, t, n, r));
|
|
3199
|
+
return i;
|
|
3200
|
+
}
|
|
3201
|
+
function nn(e, t, n, r) {
|
|
3202
|
+
let i = e.observers[t];
|
|
3203
|
+
if (!i) return;
|
|
3204
|
+
let a = X("div", "floorplan-plugin__camera-position");
|
|
3205
|
+
a.style.left = i.positionInImage.x * 100 + "%", a.style.top = i.positionInImage.y * 100 + "%";
|
|
3206
|
+
let o = X("div", "floorplan-plugin__camera-rotate"), s = document.body.clientWidth, c = document.body.clientHeight, l = `${(s < 500 || c < 500 ? 17 : 37) / 16}rem`;
|
|
3207
|
+
return o.style.width = l, o.style.height = l, o.style.left = "-" + l, o.style.top = "-" + l, o.style.transform = `rotate(${-Ut(n) + 45}deg)`, o.style.transformOrigin = `${l} ${l}`, o.style.backgroundImage = `url(${r || "data:image/png;base64,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"})`, a.appendChild(o), a;
|
|
3208
|
+
}
|
|
3209
|
+
var Q = 1e3, $ = 180;
|
|
3210
|
+
function rn(e, t, n, r) {
|
|
3211
|
+
let i = e === "top" || e === "bottom", a = n.max.x - n.min.x - (Q - $) * 2, o = n.max.y - n.min.y - (Q - $) * 2, s = t.map(([e, t]) => i ? [e.x, t.x] : [e.y, t.y]).flat().sort((e, t) => e - t).filter((e, t, n) => t === 0 || e !== n[t - 1]), c = s.map((e) => ({
|
|
3212
|
+
left: i ? (e - n.min.x - Q + $) / a : 0,
|
|
3213
|
+
bottom: i ? 0 : (e - n.min.y - Q + $) / o
|
|
3214
|
+
}));
|
|
3215
|
+
c.unshift({
|
|
3216
|
+
left: 0,
|
|
3217
|
+
bottom: 0
|
|
3218
|
+
}), c.push(i ? {
|
|
3219
|
+
left: 1,
|
|
3220
|
+
bottom: 0
|
|
3221
|
+
} : {
|
|
3222
|
+
left: 0,
|
|
3223
|
+
bottom: 1
|
|
3224
|
+
});
|
|
3225
|
+
let l = s.length ? s[s.length - 1] - s[0] : 0, u = s.map((e, t, r) => {
|
|
3226
|
+
let s = t === 0 ? 0 : e - r[t - 1], c = t === 0 ? 0 : (e + r[t - 1]) / 2;
|
|
3227
|
+
return {
|
|
3228
|
+
left: i ? (c - n.min.x - Q + $) / a : 0,
|
|
3229
|
+
bottom: i ? 0 : (c - n.min.y - Q + $) / o,
|
|
3230
|
+
distance: s
|
|
3231
|
+
};
|
|
3232
|
+
}).filter(({ distance: e }) => l ? e / l > .1 : !1), d = X("div", `floorplan-plugin__rule-labels floorplan-plugin__rule-labels--${e}${i ? " is-row" : ""}`);
|
|
3233
|
+
d.style.width = i ? "100%" : "0.0625rem", d.style.height = i ? "0.0625rem" : "100%", d.appendChild(X("div", "floorplan-plugin__rule-line"));
|
|
3234
|
+
let f = X("div", `floorplan-plugin__rule-scale-wrapper${i ? " is-row" : ""}`);
|
|
3235
|
+
for (let { left: e, bottom: t } of c) {
|
|
3236
|
+
let n = X("div", "floorplan-plugin__rule-scale");
|
|
3237
|
+
n.style.left = e * 100 + "%", n.style.bottom = t * 100 + "%", f.appendChild(n);
|
|
3238
|
+
}
|
|
3239
|
+
d.appendChild(f);
|
|
3240
|
+
let p = X("div", "floorplan-plugin__rule-text-wrapper");
|
|
3241
|
+
for (let { left: e, bottom: t, distance: n } of u) {
|
|
3242
|
+
let a = X("div", "floorplan-plugin__rule-text-item");
|
|
3243
|
+
a.style.left = e * 100 + "%", a.style.bottom = t * 100 + "%";
|
|
3244
|
+
let o = X("div", `floorplan-plugin__rule-text${i ? " is-row" : ""}`);
|
|
3245
|
+
o.textContent = r(n), a.appendChild(o), p.appendChild(a);
|
|
3246
|
+
}
|
|
3247
|
+
return d.appendChild(p), d;
|
|
3248
|
+
}
|
|
3249
|
+
function an(e, t, n) {
|
|
3250
|
+
let r = t.bounding, i = r.max.x - r.min.x, a = r.max.y - r.min.y, o = i - (Q - $) * 2, s = a - (Q - $) * 2, c = X("div", "floorplan-plugin__rule-labels-wrapper");
|
|
3251
|
+
c.style.width = o / i * 100 + "%", c.style.height = s / a * 100 + "%";
|
|
3252
|
+
let l = e.rules;
|
|
3253
|
+
for (let e of [
|
|
3254
|
+
"top",
|
|
3255
|
+
"right",
|
|
3256
|
+
"bottom",
|
|
3257
|
+
"left"
|
|
3258
|
+
]) {
|
|
3259
|
+
let t = l[e];
|
|
3260
|
+
!t || t.length === 0 || c.appendChild(rn(e, t, r, n.getRuleDistanceText));
|
|
3261
|
+
}
|
|
3262
|
+
return c;
|
|
3263
|
+
}
|
|
3264
|
+
function on(e, t) {
|
|
3265
|
+
var n;
|
|
3266
|
+
let r = (n = e.entrance) == null ? void 0 : n.northRad;
|
|
3267
|
+
if (typeof r != "number") return;
|
|
3268
|
+
let i = X("div", "floorplan-plugin__compass"), a = Ut(r);
|
|
3269
|
+
i.style.transform = `translateX(-50%) translateZ(10px) rotate(${-a + 90}deg)`;
|
|
3270
|
+
let o = X("div", "floorplan-plugin__compass-image");
|
|
3271
|
+
o.style.backgroundImage = `url(${Ht})`, i.appendChild(o);
|
|
3272
|
+
let s = X("span", "floorplan-plugin__compass-text");
|
|
3273
|
+
return s.textContent = t, i.appendChild(s), i;
|
|
3274
|
+
}
|
|
3275
|
+
function sn(e) {
|
|
3276
|
+
var t, n;
|
|
3277
|
+
let { floorplanData: r, floorIndex: i, config: a } = e, o = r.floorDatas[i], s = X("div", "floorplan-plugin__floor");
|
|
3278
|
+
if (!(o.rooms.length > 0 || o.is_has_wall)) return s.appendChild(Wt(a)), s;
|
|
3279
|
+
if (s.appendChild(Xt(o, r, a)), (a.highlightEnable || a.hoverEnable) && s.appendChild(Zt(o, r, e)), s.appendChild(Qt(r, i)), s.appendChild($t(o)), a.roomLabelsEnable && s.appendChild(tn(o, r, a, (n = (t = e.store.roomOnMouse) == null ? void 0 : t.id) == null ? null : n)), a.ruleLabelsEnable && s.appendChild(an(o, r, a)), a.cameraEnable) {
|
|
3280
|
+
let t = nn(r, e.panoIndex, e.lastPanoramaLongitude, a.cameraImageUrl);
|
|
3281
|
+
t && s.appendChild(t);
|
|
3282
|
+
}
|
|
3283
|
+
if (a.compassEnable) {
|
|
3284
|
+
let e = on(r, a.northDesc);
|
|
3285
|
+
e && s.appendChild(e);
|
|
3286
|
+
}
|
|
3287
|
+
return s;
|
|
3288
|
+
}
|
|
3289
|
+
function cn(e, t, n, r) {
|
|
3290
|
+
let i = e.querySelector(".floorplan-plugin__room-labels");
|
|
3291
|
+
if (!i) return;
|
|
3292
|
+
let a = i.clientWidth;
|
|
3293
|
+
if (!a) return;
|
|
3294
|
+
let o = t.floorDatas[n], s = new Map(o.rooms.map((e) => [e.id, e])), { max: c, min: l } = t.bounding, u = a / (c.x - l.x);
|
|
3295
|
+
i.querySelectorAll(".floorplan-plugin__room-label-item").forEach((e) => {
|
|
3296
|
+
if (!r) {
|
|
3297
|
+
e.style.opacity = "1";
|
|
3298
|
+
return;
|
|
3299
|
+
}
|
|
3300
|
+
let t = e.dataset.roomId, n = t ? s.get(t) : void 0;
|
|
3301
|
+
if (!n) return;
|
|
3302
|
+
let i = e.querySelector(".floorplan-plugin__room-part1"), a = e.querySelector(".floorplan-plugin__room-size"), o = Vt(n, {
|
|
3303
|
+
width: e.clientWidth,
|
|
3304
|
+
height: e.clientHeight
|
|
3305
|
+
}, u), c = i ? Vt(n, {
|
|
3306
|
+
width: i.clientWidth,
|
|
3307
|
+
height: i.clientHeight
|
|
3308
|
+
}, u) : o;
|
|
3309
|
+
e.style.opacity = o || c ? "1" : "0", i && (i.style.opacity = c ? "1" : "0"), a && (a.style.opacity = o ? "0.6" : "0");
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
310
3312
|
//#endregion
|
|
311
|
-
//#region build/plugins/
|
|
312
|
-
var
|
|
3313
|
+
//#region build/plugins/FloorplanPlugin/render/index.js
|
|
3314
|
+
var ln = class {
|
|
3315
|
+
constructor() {
|
|
3316
|
+
this.floorElements = /* @__PURE__ */ new Map(), this.currentFloorIndex = -1, this.isVisible = !1, this.rootElement = document.createElement("div"), this.rootElement.className = "floorplan-plugin__main";
|
|
3317
|
+
}
|
|
3318
|
+
render(e) {
|
|
3319
|
+
let { floorplanData: t, config: n } = e;
|
|
3320
|
+
this.rootElement.style.transitionDuration = e.duration + "ms", e.visible !== this.isVisible && (this.isVisible = e.visible, e.visible ? (this.rootElement.classList.remove("floorplan-plugin__main--visible"), requestAnimationFrame(() => {
|
|
3321
|
+
this.rootElement.classList.add("floorplan-plugin__main--visible");
|
|
3322
|
+
})) : this.rootElement.classList.remove("floorplan-plugin__main--visible"));
|
|
3323
|
+
let r = new Set(t.floorDatas.map((e) => e.floorIndex));
|
|
3324
|
+
for (let [e, t] of this.floorElements) r.has(e) || (t.remove(), this.floorElements.delete(e));
|
|
3325
|
+
for (let r of t.floorDatas) {
|
|
3326
|
+
let i = sn({
|
|
3327
|
+
floorplanData: t,
|
|
3328
|
+
floorIndex: r.floorIndex,
|
|
3329
|
+
panoIndex: e.panoIndex,
|
|
3330
|
+
lastPanoramaLongitude: e.lastPanoramaLongitude,
|
|
3331
|
+
config: n,
|
|
3332
|
+
highlightData: e.highlightData,
|
|
3333
|
+
store: e.store,
|
|
3334
|
+
onRoomHover: e.onRoomHover
|
|
3335
|
+
}), a = this.floorElements.get(r.floorIndex);
|
|
3336
|
+
a ? this.rootElement.replaceChild(i, a) : this.rootElement.appendChild(i), this.floorElements.set(r.floorIndex, i);
|
|
3337
|
+
}
|
|
3338
|
+
this.currentFloorIndex !== e.floorIndex && (this.currentFloorIndex = e.floorIndex);
|
|
3339
|
+
for (let [t, n] of this.floorElements) n.classList.toggle("floorplan-plugin__floor--is-current", t === e.floorIndex);
|
|
3340
|
+
let i = this.floorElements.get(e.floorIndex);
|
|
3341
|
+
i && requestAnimationFrame(() => {
|
|
3342
|
+
cn(i, t, e.floorIndex, n.adaptiveRoomLabelVisibleEnable);
|
|
3343
|
+
});
|
|
3344
|
+
}
|
|
3345
|
+
updateLabelsVisibility(e, t, n) {
|
|
3346
|
+
let r = this.floorElements.get(t);
|
|
3347
|
+
r && cn(r, e, t, n);
|
|
3348
|
+
}
|
|
3349
|
+
dispose() {
|
|
3350
|
+
this.rootElement.remove(), this.floorElements.clear();
|
|
3351
|
+
}
|
|
3352
|
+
}, un = ".floorplan-plugin__main {\n position: absolute;\n pointer-events: none;\n opacity: 0;\n transition-property: opacity;\n transition-timing-function: linear;\n}\n\n.floorplan-plugin__main--visible {\n opacity: 1;\n}\n\n.floorplan-plugin__floor {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n pointer-events: none;\n}\n\n.floorplan-plugin__floor--is-current {\n opacity: 1;\n pointer-events: auto;\n}\n\n/* ============ missing floor ============ */\n.floorplan-plugin__missing-floor {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n.floorplan-plugin__missing-floor-text {\n margin-top: 12px;\n color: #fff;\n opacity: 0.3;\n white-space: nowrap;\n}\n\n/* ============ room material ============ */\n.floorplan-plugin__room-material {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n}\n.floorplan-plugin__room-material svg {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: visible;\n}\n\n/* ============ room highlight ============ */\n.floorplan-plugin__room-highlight {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n.floorplan-plugin__room-highlight svg {\n width: 100%;\n height: 100%;\n overflow: visible;\n}\n.floorplan-plugin__room-highlight path {\n --opacity: 0;\n opacity: var(--opacity);\n fill: #fff;\n pointer-events: auto;\n}\n.floorplan-plugin__room-highlight path:hover {\n opacity: calc(var(--opacity) + 0.1);\n}\n/* main 未展示时,子元素显式设置的 pointer-events:auto 会覆盖父级 none,这里强制统一关闭交互 */\n.floorplan-plugin__main:not(.floorplan-plugin__main--visible) * {\n pointer-events: none !important;\n}\n\n/* ============ base image ============ */\n.floorplan-plugin__base-image {\n position: absolute;\n z-index: 10;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.floorplan-plugin__base-image img {\n width: 100%;\n height: 100%;\n}\n.floorplan-plugin__base-image svg [type='lineGroup'] path {\n fill: #ffffff;\n stroke: #ffffff;\n}\n.floorplan-plugin__base-image svg [type='lineItemGroup'] g g g g {\n stroke: #ffffff;\n}\n\n/* ============ items ============ */\n.floorplan-plugin__items {\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 20;\n pointer-events: none;\n}\n.floorplan-plugin__item {\n position: absolute;\n display: flex;\n flex-flow: column;\n align-items: center;\n line-height: 1;\n color: #fff;\n transform: translate(-50%, -50%);\n white-space: nowrap;\n transition: opacity 300ms;\n}\n.floorplan-plugin__item-img {\n width: 100%;\n height: 100%;\n}\n.floorplan-plugin__item-notes {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n padding: 4px;\n line-height: 1;\n border-radius: 4px;\n color: #fff;\n background: rgba(0, 0, 0, 0.6);\n font-size: 12px;\n}\n\n/* ============ room labels ============ */\n.floorplan-plugin__room-labels {\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 20;\n pointer-events: none;\n}\n.floorplan-plugin__room-label-item {\n position: absolute;\n display: flex;\n flex-flow: column;\n align-items: center;\n line-height: 1;\n color: #fff;\n transform: translate(-50%, -50%);\n white-space: nowrap;\n transition: opacity 300ms;\n font-size: 12px;\n}\n.floorplan-plugin__room-part1 {\n display: flex;\n flex-flow: column;\n align-items: center;\n color: #fff;\n white-space: nowrap;\n transition: opacity 300ms;\n}\n.floorplan-plugin__room-name {\n font-size: 12px;\n}\n.floorplan-plugin__room-area {\n opacity: 0.6;\n line-height: 1.25;\n margin-top: 2px;\n font-size: 10px;\n}\n.floorplan-plugin__room-size {\n font-size: 10px;\n transition: opacity 300ms;\n}\n\n/* ============ camera ============ */\n.floorplan-plugin__camera-position {\n pointer-events: none;\n position: absolute;\n width: 0;\n height: 0;\n}\n.floorplan-plugin__camera-rotate {\n position: absolute;\n background-repeat: no-repeat;\n background-size: 100%;\n}\n\n/* ============ rule labels ============ */\n.floorplan-plugin__rule-labels-wrapper {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n.floorplan-plugin__rule-labels {\n position: absolute;\n display: flex;\n}\n.floorplan-plugin__rule-labels--top {\n left: 0;\n top: -1.25rem;\n}\n.floorplan-plugin__rule-labels--bottom {\n left: 0;\n bottom: -1.25rem;\n}\n.floorplan-plugin__rule-labels--left {\n top: 0;\n left: -1.25rem;\n}\n.floorplan-plugin__rule-labels--right {\n top: 0;\n right: -1.25rem;\n}\n.floorplan-plugin__rule-line {\n background: #fff;\n opacity: 0.2;\n width: 100%;\n height: 100%;\n}\n.floorplan-plugin__rule-scale-wrapper {\n position: absolute;\n width: 0.3125rem;\n height: 100%;\n left: 50%;\n top: 0;\n transform: translateX(-50%);\n}\n.floorplan-plugin__rule-labels.is-row .floorplan-plugin__rule-scale-wrapper {\n width: 100%;\n height: 0.3125rem;\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n}\n.floorplan-plugin__rule-scale {\n position: absolute;\n background: #fff;\n opacity: 0.2;\n width: 100%;\n height: 0.0625rem;\n}\n.floorplan-plugin__rule-labels.is-row .floorplan-plugin__rule-scale {\n width: 0.0625rem;\n height: 100%;\n}\n.floorplan-plugin__rule-text-wrapper {\n position: absolute;\n}\n.floorplan-plugin__rule-labels--top .floorplan-plugin__rule-text-wrapper {\n width: 100%;\n height: 0;\n top: 0.625rem;\n}\n.floorplan-plugin__rule-labels--bottom .floorplan-plugin__rule-text-wrapper {\n width: 100%;\n height: 0;\n bottom: 0.625rem;\n}\n.floorplan-plugin__rule-labels--left .floorplan-plugin__rule-text-wrapper {\n width: 0;\n height: 100%;\n left: 0.625rem;\n}\n.floorplan-plugin__rule-labels--right .floorplan-plugin__rule-text-wrapper {\n width: 0;\n height: 100%;\n right: 0.625rem;\n}\n.floorplan-plugin__rule-text-item {\n width: 0;\n height: 0;\n position: absolute;\n transform: rotate(90deg);\n}\n.floorplan-plugin__rule-labels.is-row .floorplan-plugin__rule-text-item {\n transform: rotate(0);\n}\n.floorplan-plugin__rule-text {\n width: max-content;\n transform: translate(-50%, -50%);\n font-size: 0.625rem;\n color: #fff;\n opacity: 0.35;\n}\n\n/* ============ compass ============ */\n.floorplan-plugin__compass {\n position: absolute;\n left: 50%;\n top: -46px;\n width: 231px;\n height: 41px;\n transform-origin: center 184px;\n}\n.floorplan-plugin__compass-image {\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n opacity: 0.1;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n}\n.floorplan-plugin__compass-text {\n position: absolute;\n left: 50%;\n top: 15px;\n transform: translateX(-50%);\n opacity: 0.2;\n font-weight: bold;\n font-size: 10px;\n color: #fff;\n}\n", dn = 500, fn = .01;
|
|
3353
|
+
function pn(e) {
|
|
3354
|
+
let { latitude: t, longitude: n } = e, r = Math.abs(t - Math.PI / 2) > 5 * Math.PI / 180, i = n > Math.PI / 180 * 5 && n < Math.PI / 180 * 355;
|
|
3355
|
+
return r || i;
|
|
3356
|
+
}
|
|
3357
|
+
function mn(e) {
|
|
3358
|
+
let { latitude: t, longitude: n } = e, r = Math.abs(t - Math.PI / 2) < 10 * Math.PI / 180, i = n < Math.PI / 180 * 30 || n > Math.PI / 180 * 330;
|
|
3359
|
+
return r && i;
|
|
3360
|
+
}
|
|
3361
|
+
var hn = class extends w.Controller {
|
|
3362
|
+
constructor(e, t) {
|
|
3363
|
+
var n, r, i;
|
|
3364
|
+
super(e), this.name = "FloorplanPlugin", this.renderer = new ln(), this.styleSheet = new CSSStyleSheet(), this.panoIndex = 0, this.floorIndex = 0, this.lastPanoramaLongitude = 0, this.size = {
|
|
3365
|
+
width: 0,
|
|
3366
|
+
height: 0
|
|
3367
|
+
}, this.hasAddedEventListener = !1, this.isHiddenByHideFunc = !1, this.highlightData = {}, this.store = { roomOnMouse: null }, this.dispose = () => {
|
|
3368
|
+
var e, t;
|
|
3369
|
+
this.removeEventListener(), (e = this.resizeObserver) == null || e.disconnect(), (t = this.removeExtraElement) == null || t.call(this), this.removeExtraElement = void 0, this.pendingCameraUpdateFrame !== void 0 && cancelAnimationFrame(this.pendingCameraUpdateFrame), this.pendingResizeFrame !== void 0 && cancelAnimationFrame(this.pendingResizeFrame), this.renderer.dispose(), this.wrapper = void 0, this.data = void 0, this.hooks.emit("dispose");
|
|
3370
|
+
}, this.show = (...e) => S(this, [...e], void 0, function* (e = {}) {
|
|
3371
|
+
var t;
|
|
3372
|
+
if (!this.state.enabled || !this.showPromise && this.state.visible) return;
|
|
3373
|
+
let n = (t = e.userAction) == null ? !0 : t;
|
|
3374
|
+
return this.updateState({ visible: !0 }, n), this._show(e);
|
|
3375
|
+
}), this.hide = (...e) => S(this, [...e], void 0, function* (e = {}) {
|
|
3376
|
+
var t;
|
|
3377
|
+
this.state.enabled && (this.isHiddenByHideFunc = !0, this.state.visible !== !1 && (this.updateState({ visible: !1 }, (t = e.userAction) == null ? !0 : t), this._hide(e)));
|
|
3378
|
+
}), this.highlight = (e) => {
|
|
3379
|
+
this.state.config.highlightEnable && (this.highlightData = e, this.renderCurrent());
|
|
3380
|
+
}, this.unhighlight = () => {
|
|
3381
|
+
this.highlightData = {}, this.renderCurrent();
|
|
3382
|
+
}, this.updateShowState = (e) => {
|
|
3383
|
+
this.showState = Object.assign(Object.assign({}, this.showState), e);
|
|
3384
|
+
}, this.onRoomHover = (e) => {
|
|
3385
|
+
this.store.roomOnMouse = e;
|
|
3386
|
+
}, this.handleClick = () => {
|
|
3387
|
+
if (this.state.visible && this.hooks.emit("click", this.store.roomOnMouse)) return !1;
|
|
3388
|
+
}, this.onFiveModelLoaded = () => {
|
|
3389
|
+
var e, t, n;
|
|
3390
|
+
this.state.enabled !== !1 && (this.floorIndex = (n = (t = (e = this.five.work) == null ? void 0 : e.observers[this.panoIndex]) == null ? void 0 : t.floorIndex) == null ? 0 : n, this.renderCurrent());
|
|
3391
|
+
}, this.onFiveModeChange = (e) => {
|
|
3392
|
+
e !== this.showState.mode && (this.updateState({ visible: !1 }, !1), this._hide({ userAction: !1 }));
|
|
3393
|
+
}, this.onFiveInertiaPan = (e, t) => {
|
|
3394
|
+
t && (this.state.visible || this.state.config.autoShowEnable !== !1 && (this.isHiddenByHideFunc || this.five.currentMode === this.showState.mode && mn(this.getRelativePose(this.five.getCurrentState())) && (this.updateState({ visible: !0 }, !0), this._show({ isAutoShow: !0 }))));
|
|
3395
|
+
}, this.onFivePanoArrived = (e) => {
|
|
3396
|
+
var t, n;
|
|
3397
|
+
this.five.work && (this.panoIndex = e, this.floorIndex = (n = (t = this.five.work.observers[e]) == null ? void 0 : t.floorIndex) == null ? this.floorIndex : n);
|
|
3398
|
+
}, this.onFiveCameraUpdate = (e, t) => {
|
|
3399
|
+
this.state.visible && (this.showPromise || (this.scheduleCameraUpdate(), pn(this.getRelativePose(this.five.getCurrentState())) && (this.updateState({ visible: !1 }, t), this._hide({ userAction: t }))));
|
|
3400
|
+
}, this.onFiveWantsPanGesture = (e, t) => {
|
|
3401
|
+
if (this.five.currentMode === this.showState.mode && this.state.config.autoShowEnable !== !1 && t && this.state.visible) return this.five.updateCamera(St(this.showState, ["mode", "offset"]), 0), !1;
|
|
3402
|
+
}, this.onFiveWantsTapGesture = () => this.handleClick(), this.onFiveWantsChangeMode = (e, t) => {
|
|
3403
|
+
t === "Panorama" && e === this.showState.mode && (this.lastPanoramaLongitude = this.five.getCurrentState().longitude);
|
|
3404
|
+
}, this.onModelShownFloorChange = (e) => {
|
|
3405
|
+
var t, n, r;
|
|
3406
|
+
if (this.floorIndex !== e) {
|
|
3407
|
+
if (e === null) {
|
|
3408
|
+
this.floorIndex = (r = (n = (t = this.five.work) == null ? void 0 : t.observers[this.panoIndex]) == null ? void 0 : n.floorIndex) == null ? this.floorIndex : r;
|
|
3409
|
+
return;
|
|
3410
|
+
}
|
|
3411
|
+
this.floorIndex = e, this.updateSize(), this.renderCurrent();
|
|
3412
|
+
}
|
|
3413
|
+
}, this._show = (e) => S(this, void 0, void 0, function* () {
|
|
3414
|
+
var t;
|
|
3415
|
+
if (!this.state.enabled) return;
|
|
3416
|
+
if (!((t = this.five.model) != null && t.loaded)) throw Error("ModelNotLoaded");
|
|
3417
|
+
if (!this.data) throw Error("DataNotLoaded");
|
|
3418
|
+
if (this.showPromise) return this.showPromise;
|
|
3419
|
+
let n = Object.assign({
|
|
3420
|
+
floorIndex: this.floorIndex,
|
|
3421
|
+
modelOpacity: this.state.config.modelOpacity,
|
|
3422
|
+
immediately: !1,
|
|
3423
|
+
isAutoShow: !1,
|
|
3424
|
+
userAction: !0
|
|
3425
|
+
}, e), r = () => S(this, void 0, void 0, function* () {
|
|
3426
|
+
var e;
|
|
3427
|
+
this.hooks.emit("show", {
|
|
3428
|
+
userAction: n.userAction,
|
|
3429
|
+
auto: n.isAutoShow
|
|
3430
|
+
});
|
|
3431
|
+
let t = !1, r;
|
|
3432
|
+
this.showRejection = (e) => {
|
|
3433
|
+
t = !0, r = e;
|
|
3434
|
+
};
|
|
3435
|
+
let [i] = yield K(wt(this.five, this.showState, n.userAction));
|
|
3436
|
+
if (i) throw i;
|
|
3437
|
+
if (t) throw Error(r || "UnknownError");
|
|
3438
|
+
if (!this.updateSize()) throw Error("UpdateSizeError");
|
|
3439
|
+
this.updatePosition(), this.floorIndex = n.floorIndex, (e = this.five.model) == null || e.show(this.floorIndex);
|
|
3440
|
+
});
|
|
3441
|
+
return this.isHiddenByHideFunc = !1, this.showPromise = r().then(() => {
|
|
3442
|
+
this.showPromise = void 0, this.showRejection = void 0;
|
|
3443
|
+
let e = n.immediately ? 0 : dn;
|
|
3444
|
+
Tt(this.five, n.modelOpacity, e), this.renderWithDuration(e), this.hooks.emit("showAnimationEnded", {
|
|
3445
|
+
auto: n.isAutoShow,
|
|
3446
|
+
userAction: n.userAction
|
|
3447
|
+
});
|
|
3448
|
+
}).catch((e) => {
|
|
3449
|
+
if (this.showPromise = void 0, this.showRejection = void 0, this.updateState({ visible: !1 }, n.userAction), !n.isAutoShow) throw e;
|
|
3450
|
+
}), this.showPromise;
|
|
3451
|
+
}), this._hide = (e) => {
|
|
3452
|
+
var t;
|
|
3453
|
+
(t = this.showRejection) == null || t.call(this, "BreakOffByHide"), this.showPromise = void 0;
|
|
3454
|
+
let n = Object.assign({
|
|
3455
|
+
userAction: !0,
|
|
3456
|
+
isAutoHide: !1
|
|
3457
|
+
}, e);
|
|
3458
|
+
Tt(this.five, 1, 0), this.hooks.emit("hide", {
|
|
3459
|
+
auto: n.isAutoHide,
|
|
3460
|
+
userAction: n.userAction
|
|
3461
|
+
}), this.renderCurrent();
|
|
3462
|
+
}, this.five = e, this.styleSheet.replaceSync(un), typeof document < "u" && document.adoptedStyleSheets.push(this.styleSheet), this.showState = Object.assign({
|
|
3463
|
+
mode: "Mapview",
|
|
3464
|
+
longitude: 0,
|
|
3465
|
+
latitude: Math.PI / 2,
|
|
3466
|
+
fov: 80
|
|
3467
|
+
}, t == null ? void 0 : t.showState);
|
|
3468
|
+
let a = {
|
|
3469
|
+
northDesc: "北",
|
|
3470
|
+
modelOpacity: fn,
|
|
3471
|
+
cameraEnable: !0,
|
|
3472
|
+
highlightEnable: !1,
|
|
3473
|
+
hoverEnable: !0,
|
|
3474
|
+
compassEnable: !0,
|
|
3475
|
+
autoShowEnable: !0,
|
|
3476
|
+
ruleLabelsEnable: !0,
|
|
3477
|
+
roomLabelsEnable: !0,
|
|
3478
|
+
roomAreaEnable: !0,
|
|
3479
|
+
roomNameEnable: !0,
|
|
3480
|
+
roomNameOtherTypeEnable: !0,
|
|
3481
|
+
roomDimensionEnable: !0,
|
|
3482
|
+
cameraImageUrl: void 0,
|
|
3483
|
+
attachedTo: 3,
|
|
3484
|
+
getLabelElement: void 0,
|
|
3485
|
+
adaptiveRoomLabelVisibleEnable: !0,
|
|
3486
|
+
missingFloorConfig: {
|
|
3487
|
+
imageWidth: 200,
|
|
3488
|
+
imageHeight: 120,
|
|
3489
|
+
text: "暂无平面图",
|
|
3490
|
+
textFontSize: 14
|
|
3491
|
+
},
|
|
3492
|
+
i18n: (e) => e,
|
|
3493
|
+
getRoomAreaText: (e) => (e / 1e6).toFixed(1) + "㎡",
|
|
3494
|
+
getRoomDimensionText: (e, t) => (e / 1e3).toFixed(1) + "m × " + (t / 1e3).toFixed(1) + "m",
|
|
3495
|
+
getRuleDistanceText: (e) => e.toString()
|
|
3496
|
+
}, o = Object.assign(Object.assign(Object.assign({}, a), t == null ? void 0 : t.config), { missingFloorConfig: Object.assign(Object.assign({}, a.missingFloorConfig), (n = t == null ? void 0 : t.config) == null ? void 0 : n.missingFloorConfig) });
|
|
3497
|
+
this.state = {
|
|
3498
|
+
enabled: !0,
|
|
3499
|
+
visible: !1,
|
|
3500
|
+
config: o
|
|
3501
|
+
}, Object.assign(this.state, St((r = t == null ? void 0 : t.initialState) == null ? {} : r, ["config"])), this.panoIndex = (i = e.state.panoIndex) == null ? 0 : i, this.initContainer(), jt(e).then(this.onFiveModelLoaded), e.once("dispose", this.dispose), this.state.enabled ? this.addEventListener() : this.styleSheet.disabled = !0;
|
|
3502
|
+
}
|
|
3503
|
+
load(e, t) {
|
|
3504
|
+
return S(this, arguments, void 0, function* (e, t, n = !0) {
|
|
3505
|
+
let r = "data" in e ? e.data : e, i = this.data;
|
|
3506
|
+
this.data = yield gt(r), this.hooks.emit("dataLoaded", this.data), this.hooks.emit("dataChange", this.data, i), t && this.updateState(t, n), this.updateSize(), this.updatePosition(), this.renderCurrent();
|
|
3507
|
+
});
|
|
3508
|
+
}
|
|
3509
|
+
loadItems(e) {
|
|
3510
|
+
this.data && (this.data.floorDatas.forEach((t, n) => {
|
|
3511
|
+
t.items = e[n];
|
|
3512
|
+
}), this.renderCurrent());
|
|
3513
|
+
}
|
|
3514
|
+
appendTo(e) {
|
|
3515
|
+
this.wrapper = e, this.state.enabled && (e.appendChild(this.renderer.rootElement), this.observeResize(e), this.registerExtraElement(), this.updateSize(), this.updatePosition(), this.renderCurrent());
|
|
3516
|
+
}
|
|
3517
|
+
enable(e = {}) {
|
|
3518
|
+
var t;
|
|
3519
|
+
if (this.state.enabled) return;
|
|
3520
|
+
let n = (t = e.userAction) == null ? !0 : t;
|
|
3521
|
+
this.updateState({ enabled: !0 }, n), this._enable({ userAction: n });
|
|
3522
|
+
}
|
|
3523
|
+
disable(e = {}) {
|
|
3524
|
+
var t;
|
|
3525
|
+
if (!this.state.enabled) return;
|
|
3526
|
+
let n = (t = e.userAction) == null ? !0 : t;
|
|
3527
|
+
this.updateState({ enabled: !1 }, n), this._disable({ userAction: n });
|
|
3528
|
+
}
|
|
3529
|
+
setState(e, t = {}) {
|
|
3530
|
+
var n;
|
|
3531
|
+
let r = this.state, i = (n = t.userAction) == null ? !0 : n;
|
|
3532
|
+
this.updateState(e, i), e.enabled !== void 0 && r.enabled !== e.enabled && (e.enabled ? this._enable({ userAction: i }) : this._disable({ userAction: i })), e.visible !== void 0 && r.visible !== e.visible && (e.visible ? this._show({ userAction: i }) : this._hide({ userAction: i }));
|
|
3533
|
+
}
|
|
3534
|
+
changeConfigs(e, t = !0) {
|
|
3535
|
+
this.updateState({ config: Object.assign(Object.assign({}, this.state.config), e) }, t), this.renderCurrent();
|
|
3536
|
+
}
|
|
3537
|
+
updateSize() {
|
|
3538
|
+
if (!this.data || !this.wrapper) return !1;
|
|
3539
|
+
let { min: e, max: t } = this.data.bounding, n = t.x - e.x, r = t.y - e.y, i = this.getPxmmWithRotation(), a = Math.ceil(n * i), o = Math.ceil(r * i);
|
|
3540
|
+
return this.size.width === a && this.size.height === o ? !0 : (this.renderer.rootElement.style.width = a + "px", this.renderer.rootElement.style.height = o + "px", this.size = {
|
|
3541
|
+
width: a,
|
|
3542
|
+
height: o
|
|
3543
|
+
}, !0);
|
|
3544
|
+
}
|
|
3545
|
+
updatePosition() {
|
|
3546
|
+
if (!this.wrapper) return;
|
|
3547
|
+
let e = Dt(this.five, this.floorIndex, this.state.config.attachedTo), t = this.five.modelScene.boundingBox.getCenter(new a.Vector3());
|
|
3548
|
+
t.y = e;
|
|
3549
|
+
let n = t.clone().project(this.five.camera), r = (n.x + 1) / 2, i = -(n.y - 1) / 2;
|
|
3550
|
+
this.renderer.rootElement.style.position = "absolute", this.renderer.rootElement.style.left = r * 100 + "%", this.renderer.rootElement.style.top = i * 100 + "%", this.renderer.rootElement.style.transform = "translate(-50%, -50%)";
|
|
3551
|
+
}
|
|
3552
|
+
getPxmmWithRotation() {
|
|
3553
|
+
if (!this.wrapper) return 0;
|
|
3554
|
+
let e = { attachedTo: this.state.config.attachedTo };
|
|
3555
|
+
return Ot(this.five, this.wrapper, this.floorIndex, e);
|
|
3556
|
+
}
|
|
3557
|
+
updateState(e, t) {
|
|
3558
|
+
let n = this.state, r = e.config ? Object.assign(Object.assign({}, n.config), e.config) : n.config;
|
|
3559
|
+
this.state = Object.assign(Object.assign(Object.assign({}, this.state), e), { config: r }), !Rt(this.state, n, { deep: !0 }) && this.hooks.emit("stateChange", {
|
|
3560
|
+
state: this.state,
|
|
3561
|
+
prevState: n,
|
|
3562
|
+
userAction: t
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
initContainer() {
|
|
3566
|
+
this.renderer.rootElement.classList.add("floorplan-plugin");
|
|
3567
|
+
}
|
|
3568
|
+
registerExtraElement() {
|
|
3569
|
+
var e;
|
|
3570
|
+
(e = this.removeExtraElement) == null || e.call(this), this.removeExtraElement = this.five.addExtraElement(this.renderer.rootElement);
|
|
3571
|
+
}
|
|
3572
|
+
observeResize(e) {
|
|
3573
|
+
var t;
|
|
3574
|
+
(t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = new ResizeObserver(() => {
|
|
3575
|
+
this.scheduleResizeUpdate();
|
|
3576
|
+
}), this.resizeObserver.observe(e);
|
|
3577
|
+
}
|
|
3578
|
+
scheduleResizeUpdate() {
|
|
3579
|
+
this.pendingResizeFrame === void 0 && (this.pendingResizeFrame = requestAnimationFrame(() => {
|
|
3580
|
+
this.pendingResizeFrame = void 0, this.updateSize(), this.updatePosition(), this.data && this.renderer.updateLabelsVisibility(this.data, this.floorIndex, this.state.config.adaptiveRoomLabelVisibleEnable);
|
|
3581
|
+
}));
|
|
3582
|
+
}
|
|
3583
|
+
renderCurrent() {
|
|
3584
|
+
this.data && this.renderer.render({
|
|
3585
|
+
visible: this.state.visible,
|
|
3586
|
+
duration: 0,
|
|
3587
|
+
panoIndex: this.panoIndex,
|
|
3588
|
+
floorIndex: this.floorIndex,
|
|
3589
|
+
floorplanData: this.data,
|
|
3590
|
+
lastPanoramaLongitude: this.lastPanoramaLongitude,
|
|
3591
|
+
config: this.state.config,
|
|
3592
|
+
highlightData: this.highlightData,
|
|
3593
|
+
store: this.store,
|
|
3594
|
+
onRoomHover: this.onRoomHover
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
addEventListener() {
|
|
3598
|
+
if (!this.state.enabled || this.hasAddedEventListener) return;
|
|
3599
|
+
this.hasAddedEventListener = !0;
|
|
3600
|
+
let e = this.five;
|
|
3601
|
+
e.on("modeChange", this.onFiveModeChange), e.on("interiaPan", this.onFiveInertiaPan), e.on("panoArrived", this.onFivePanoArrived), e.on("cameraUpdate", this.onFiveCameraUpdate), e.on("wantsPanGesture", this.onFiveWantsPanGesture), e.on("wantsTapGesture", this.onFiveWantsTapGesture), e.on("wantsChangeMode", this.onFiveWantsChangeMode), e.on("modelShownFloorChange", this.onModelShownFloorChange);
|
|
3602
|
+
}
|
|
3603
|
+
removeEventListener() {
|
|
3604
|
+
this.hasAddedEventListener = !1;
|
|
3605
|
+
let e = this.five;
|
|
3606
|
+
e.off("modeChange", this.onFiveModeChange), e.off("interiaPan", this.onFiveInertiaPan), e.off("panoArrived", this.onFivePanoArrived), e.off("cameraUpdate", this.onFiveCameraUpdate), e.off("wantsPanGesture", this.onFiveWantsPanGesture), e.off("wantsTapGesture", this.onFiveWantsTapGesture), e.off("wantsChangeMode", this.onFiveWantsChangeMode), e.off("modelShownFloorChange", this.onModelShownFloorChange);
|
|
3607
|
+
}
|
|
3608
|
+
scheduleCameraUpdate() {
|
|
3609
|
+
this.pendingCameraUpdateFrame === void 0 && (this.pendingCameraUpdateFrame = requestAnimationFrame(() => {
|
|
3610
|
+
this.pendingCameraUpdateFrame = void 0, this.updatePosition(), this.updateSize();
|
|
3611
|
+
}));
|
|
3612
|
+
}
|
|
3613
|
+
getRelativePose(e) {
|
|
3614
|
+
let t = this.showState.longitude || 0, n = ((e.longitude - t) % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
|
|
3615
|
+
return {
|
|
3616
|
+
latitude: e.latitude,
|
|
3617
|
+
longitude: n
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
_enable(e) {
|
|
3621
|
+
this.styleSheet.disabled = !1, this.addEventListener(), this.wrapper && (this.wrapper.appendChild(this.renderer.rootElement), this.registerExtraElement()), this.hooks.emit("enable", { userAction: e.userAction }), this.state.visible && this._show({ userAction: e.userAction });
|
|
3622
|
+
}
|
|
3623
|
+
_disable(e) {
|
|
3624
|
+
var t, n;
|
|
3625
|
+
this.styleSheet.disabled = !0, (t = this.showRejection) == null || t.call(this, "BreakOffByDisable"), this.showPromise = void 0, this.renderer.rootElement.remove(), (n = this.removeExtraElement) == null || n.call(this), this.removeExtraElement = void 0, this.removeEventListener(), this.hooks.emit("disable", { userAction: e.userAction });
|
|
3626
|
+
}
|
|
3627
|
+
renderWithDuration(e) {
|
|
3628
|
+
this.data && this.renderer.render({
|
|
3629
|
+
visible: this.state.visible,
|
|
3630
|
+
duration: e,
|
|
3631
|
+
panoIndex: this.panoIndex,
|
|
3632
|
+
floorIndex: this.floorIndex,
|
|
3633
|
+
floorplanData: this.data,
|
|
3634
|
+
lastPanoramaLongitude: this.lastPanoramaLongitude,
|
|
3635
|
+
config: this.state.config,
|
|
3636
|
+
highlightData: this.highlightData,
|
|
3637
|
+
store: this.store,
|
|
3638
|
+
onRoomHover: this.onRoomHover
|
|
3639
|
+
});
|
|
3640
|
+
}
|
|
3641
|
+
}, gn = (e, t) => new hn(e, t), _n = class {
|
|
313
3642
|
constructor(e, t, n, r, i) {
|
|
314
3643
|
this.R = e, this.Q = t, this.A = n, this.B = r, this.C = i, this.cov = NaN, this.x = NaN;
|
|
315
3644
|
}
|
|
@@ -321,7 +3650,7 @@ var l = class {
|
|
|
321
3650
|
}
|
|
322
3651
|
return this.x;
|
|
323
3652
|
}
|
|
324
|
-
},
|
|
3653
|
+
}, vn = class extends w.Controller {
|
|
325
3654
|
updateState(e, t) {
|
|
326
3655
|
let n = this.state;
|
|
327
3656
|
this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
|
|
@@ -338,7 +3667,7 @@ var l = class {
|
|
|
338
3667
|
}, this.duration = (n = t == null ? void 0 : t.duration) == null ? 5e3 : n, this.curveHeight = (r = t == null ? void 0 : t.curveHeight) == null ? 1.5 : r, this.pointDuration = (i = t == null ? void 0 : t.pointDuration) == null ? 3e3 : i;
|
|
339
3668
|
}
|
|
340
3669
|
load() {
|
|
341
|
-
return
|
|
3670
|
+
return S(this, void 0, void 0, function* () {});
|
|
342
3671
|
}
|
|
343
3672
|
enable(e) {
|
|
344
3673
|
var t;
|
|
@@ -362,38 +3691,38 @@ var l = class {
|
|
|
362
3691
|
extractKeyframes(e) {
|
|
363
3692
|
let t = [];
|
|
364
3693
|
if (!e.content.data) throw Error("轨迹数据未加载");
|
|
365
|
-
let n = e.content.data.positionArray, r = n.length / 3,
|
|
366
|
-
for (let e = 0; e < r; e++) if (e === 0)
|
|
3694
|
+
let n = e.content.data.positionArray, r = n.length / 3, i = .01, o = .1, s = new _n(i, o, 1, 0, 1), c = new _n(i, o, 1, 0, 1), l = new _n(i, o, 1, 0, 1), u = new Float32Array(r);
|
|
3695
|
+
for (let e = 0; e < r; e++) if (e === 0) u[e] = 0;
|
|
367
3696
|
else {
|
|
368
|
-
let t = new
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
for (let
|
|
372
|
-
let o = new
|
|
373
|
-
for (let e =
|
|
374
|
-
o.divideScalar(
|
|
375
|
-
let f = s.filter(o.x), p = c.filter(o.y), m =
|
|
3697
|
+
let t = new a.Vector3(n[(e - 1) * 3], n[(e - 1) * 3 + 1], n[(e - 1) * 3 + 2]);
|
|
3698
|
+
u[e] = new a.Vector3(n[e * 3], n[e * 3 + 1], n[e * 3 + 2]).distanceTo(t) + u[e - 1];
|
|
3699
|
+
}
|
|
3700
|
+
for (let i = 0; i < r; i++) {
|
|
3701
|
+
let o = new a.Vector3(0, 0, 0), d = 0;
|
|
3702
|
+
for (let e = i - 5; e < i + 6; e++) e >= 0 && e < r && (o.add(new a.Vector3(n[e * 3], n[e * 3 + 1], n[e * 3 + 2])), d++);
|
|
3703
|
+
o.divideScalar(d).applyMatrix4(e.transform);
|
|
3704
|
+
let f = s.filter(o.x), p = c.filter(o.y), m = l.filter(o.z);
|
|
376
3705
|
t.push({
|
|
377
|
-
position: new
|
|
378
|
-
location:
|
|
3706
|
+
position: new a.Vector3(f, p, m),
|
|
3707
|
+
location: u[i]
|
|
379
3708
|
});
|
|
380
3709
|
}
|
|
381
3710
|
return t;
|
|
382
3711
|
}
|
|
383
3712
|
computeAABB2D(e) {
|
|
384
|
-
let t = Infinity, n = -Infinity, r = Infinity,
|
|
385
|
-
for (let
|
|
3713
|
+
let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
|
|
3714
|
+
for (let a of e) a.position.x < t && (t = a.position.x), a.position.x > n && (n = a.position.x), a.position.z < r && (r = a.position.z), a.position.z > i && (i = a.position.z);
|
|
386
3715
|
return {
|
|
387
|
-
min: new
|
|
388
|
-
max: new
|
|
3716
|
+
min: new a.Vector2(t, r),
|
|
3717
|
+
max: new a.Vector2(n, i)
|
|
389
3718
|
};
|
|
390
3719
|
}
|
|
391
3720
|
findClosestKeyframeToRay(e, t) {
|
|
392
|
-
let n = Infinity, r = t[0].position.clone(),
|
|
393
|
-
for (let
|
|
394
|
-
e.closestPointToPoint(
|
|
395
|
-
let t =
|
|
396
|
-
t < n && (n = t, r =
|
|
3721
|
+
let n = Infinity, r = t[0].position.clone(), i = new a.Vector3();
|
|
3722
|
+
for (let a of t) {
|
|
3723
|
+
e.closestPointToPoint(a.position, i);
|
|
3724
|
+
let t = i.distanceTo(a.position);
|
|
3725
|
+
t < n && (n = t, r = a.position.clone());
|
|
397
3726
|
}
|
|
398
3727
|
return r;
|
|
399
3728
|
}
|
|
@@ -407,10 +3736,10 @@ var l = class {
|
|
|
407
3736
|
return e;
|
|
408
3737
|
}
|
|
409
3738
|
loadTrajectoryDataIfNeeded(t) {
|
|
410
|
-
return
|
|
411
|
-
var n,
|
|
3739
|
+
return S(this, void 0, void 0, function* () {
|
|
3740
|
+
var n, r, a, o, s, c, l, u;
|
|
412
3741
|
if ((n = t.content) != null && n.data) return;
|
|
413
|
-
if (((
|
|
3742
|
+
if (((r = t.content) == null ? void 0 : r.loadState) === "LOADING") {
|
|
414
3743
|
yield new Promise((n) => {
|
|
415
3744
|
let r = e.shared.add(() => {
|
|
416
3745
|
var e;
|
|
@@ -425,14 +3754,14 @@ var l = class {
|
|
|
425
3754
|
let h = p ? m.includes("?") ? `${m}&${p.replace(/^\?/, "")}` : `${m}${p.startsWith("?") ? p : `?${p}`}` : m;
|
|
426
3755
|
t.content.loadState = "LOADING";
|
|
427
3756
|
try {
|
|
428
|
-
let e = yield
|
|
3757
|
+
let e = yield i(h, {
|
|
429
3758
|
type: "geometry",
|
|
430
3759
|
customPropertyMapping: { time: {
|
|
431
3760
|
itemType: "uint32",
|
|
432
3761
|
itemNames: ["time_milisec"]
|
|
433
3762
|
} },
|
|
434
3763
|
fetcher: f
|
|
435
|
-
}), n = e.scene,
|
|
3764
|
+
}), n = e.scene, r = n.getAttribute("position"), a = n.getAttribute("time"), o = (s = r == null ? void 0 : r.array) == null ? /* @__PURE__ */ new Float32Array() : s, d = (c = a == null ? void 0 : a.array) == null ? /* @__PURE__ */ new Uint32Array() : c;
|
|
436
3765
|
t.content.data = {
|
|
437
3766
|
uri: h,
|
|
438
3767
|
byteLength: (l = e.byteLength) == null ? 0 : l,
|
|
@@ -447,28 +3776,28 @@ var l = class {
|
|
|
447
3776
|
});
|
|
448
3777
|
}
|
|
449
3778
|
computeGSSceneBounds() {
|
|
450
|
-
let e = new
|
|
3779
|
+
let e = new a.Box3(), t = new a.Box3();
|
|
451
3780
|
return this.five.scene.traverse((n) => {
|
|
452
3781
|
let r = n;
|
|
453
|
-
(r == null ? void 0 : r.boundingBox) instanceof
|
|
3782
|
+
(r == null ? void 0 : r.boundingBox) instanceof a.Box3 && !r.boundingBox.isEmpty() && (t.copy(r.boundingBox), r.matrixWorld && t.applyMatrix4(r.matrixWorld), e.union(t));
|
|
454
3783
|
}), e.isEmpty() ? null : e;
|
|
455
3784
|
}
|
|
456
3785
|
getCameraCurve() {
|
|
457
|
-
return
|
|
458
|
-
var e, t, n, r,
|
|
459
|
-
let d = (r = (n = (t = (e = this.five.model.viewLayers) == null ? void 0 : e[0]) == null ? void 0 : t.trajectories) == null ? void 0 : n[0]) == null ? (c = (s = (o = (
|
|
3786
|
+
return S(this, void 0, void 0, function* () {
|
|
3787
|
+
var e, t, n, r, i, o, s, c, l, u;
|
|
3788
|
+
let d = (r = (n = (t = (e = this.five.model.viewLayers) == null ? void 0 : e[0]) == null ? void 0 : t.trajectories) == null ? void 0 : n[0]) == null ? (c = (s = (o = (i = this.five.model.viewLayers) == null ? void 0 : i[0]) == null ? void 0 : o.scene) == null ? void 0 : s.trajectories) == null ? void 0 : c[0] : r, f = null, p = null;
|
|
460
3789
|
if (d && (yield this.loadTrajectoryDataIfNeeded(d), (l = d.content) != null && l.data && ((u = d.content.data.positionArray) == null ? void 0 : u.length) >= 6 && (f = this.extractKeyframes(d), f.length >= 2 ? p = this.computeAABB2D(f) : f = null)), !f || !p) {
|
|
461
3790
|
let e = this.computeGSSceneBounds();
|
|
462
3791
|
if (!e) throw Error("未找到可用于计算入场曲线的 3DGS 边界或轨迹");
|
|
463
3792
|
p = {
|
|
464
|
-
min: new
|
|
465
|
-
max: new
|
|
3793
|
+
min: new a.Vector2(e.min.x, e.min.z),
|
|
3794
|
+
max: new a.Vector2(e.max.x, e.max.z)
|
|
466
3795
|
};
|
|
467
|
-
let t = (p.min.x + p.max.x) / 2, n = (p.min.y + p.max.y) / 2, r = (e.min.y + e.max.y) / 2,
|
|
3796
|
+
let t = (p.min.x + p.max.x) / 2, n = (p.min.y + p.max.y) / 2, r = (e.min.y + e.max.y) / 2, i = Math.max(p.max.x - p.min.x, p.max.y - p.min.y) * .5;
|
|
468
3797
|
f = [];
|
|
469
3798
|
let o = 0, s = null;
|
|
470
3799
|
for (let e = 0; e < 16; e++) {
|
|
471
|
-
let c = e / 16 * Math.PI * 2, l = new
|
|
3800
|
+
let c = e / 16 * Math.PI * 2, l = new a.Vector3(t + Math.cos(c) * i, r, n + Math.sin(c) * i);
|
|
472
3801
|
s && (o += l.distanceTo(s)), f.push({
|
|
473
3802
|
position: l,
|
|
474
3803
|
location: o
|
|
@@ -476,14 +3805,14 @@ var l = class {
|
|
|
476
3805
|
}
|
|
477
3806
|
}
|
|
478
3807
|
this.keyframes = f, this.boundingAABB = p;
|
|
479
|
-
let m = this.curveHeight, h = new
|
|
480
|
-
let t = new
|
|
3808
|
+
let m = this.curveHeight, h = new a.Vector3((p.min.x + p.max.x) / 2, m, (p.min.y + p.max.y) / 2), g = (p.max.x - p.min.x) / 2, _ = (p.max.y - p.min.y) / 2, v = Math.sqrt(g * g + _ * _), y = (e) => {
|
|
3809
|
+
let t = new a.Vector3().subVectors(e, h);
|
|
481
3810
|
return t.length() < .001 && t.set(1, 0, 0), h.clone().add(t.normalize().multiplyScalar(v));
|
|
482
|
-
}, b = new
|
|
483
|
-
return new
|
|
3811
|
+
}, b = new a.Vector3(f[0].position.x, m, f[0].position.z), x = y(b), S = new a.Vector3().subVectors(h, b).normalize(), C = new a.Ray(b, S), ee = new a.Vector3(-S.z, 0, S.x).normalize(), w = new a.Ray(h, ee), T = this.findClosestKeyframeToRay(w, f), E = y(new a.Vector3(T.x, m, T.z)), D = this.findClosestKeyframeToRay(C, f), te = y(new a.Vector3(D.x, m, D.z));
|
|
3812
|
+
return new a.CatmullRomCurve3([
|
|
484
3813
|
x,
|
|
485
|
-
|
|
486
|
-
|
|
3814
|
+
E,
|
|
3815
|
+
te
|
|
487
3816
|
], !1, "centripetal", .5);
|
|
488
3817
|
});
|
|
489
3818
|
}
|
|
@@ -493,7 +3822,7 @@ var l = class {
|
|
|
493
3822
|
}
|
|
494
3823
|
setBounds() {
|
|
495
3824
|
if (!this.boundingAABB) throw Error("请先调用 getCameraCurve 计算轨迹边界");
|
|
496
|
-
let e = this.boundingAABB, t = this.findRenderMesh(), n = new
|
|
3825
|
+
let e = this.boundingAABB, t = this.findRenderMesh(), n = new a.Vector3(e.min.x, 0, e.min.y), r = new a.Vector3(e.max.x, 3, e.max.y);
|
|
497
3826
|
t.material.aggregationBoundsMin.copy(n), t.material.aggregationBoundsMax.copy(r), this.boundsSet = !0;
|
|
498
3827
|
}
|
|
499
3828
|
normalizedPointDuration() {
|
|
@@ -501,7 +3830,7 @@ var l = class {
|
|
|
501
3830
|
return e <= 0 ? .01 : Math.min(e <= 1 ? e : e / this.duration, 1);
|
|
502
3831
|
}
|
|
503
3832
|
resetToPointCloud() {
|
|
504
|
-
return
|
|
3833
|
+
return S(this, void 0, void 0, function* () {
|
|
505
3834
|
this.boundingAABB || (yield this.getCameraCurve()), this.setBounds();
|
|
506
3835
|
let e = this.findRenderMesh().material;
|
|
507
3836
|
e.aggregationEnabled = !0, e.aggregationProgress = 0, e.aggregationPointDuration = this.normalizedPointDuration(), this.five.needsRender = !0, this.five.modelSceneNeedsRender = !0;
|
|
@@ -518,22 +3847,22 @@ var l = class {
|
|
|
518
3847
|
});
|
|
519
3848
|
}
|
|
520
3849
|
playEntrance() {
|
|
521
|
-
return
|
|
522
|
-
let n = yield this.getCameraCurve(), r = this.boundingAABB,
|
|
523
|
-
s.position.copy(o), s.lookAt(
|
|
3850
|
+
return S(this, void 0, void 0, function* () {
|
|
3851
|
+
let n = yield this.getCameraCurve(), r = this.boundingAABB, i = new a.Vector3((r.min.x + r.max.x) / 2, this.curveHeight, (r.min.y + r.max.y) / 2), o = n.getPointAt(0), s = new t(90).copy(this.five.camera);
|
|
3852
|
+
s.position.copy(o), s.lookAt(i), s.computePose(0), this.five.setState(Object.assign({}, s.pose)), this.setBounds();
|
|
524
3853
|
let c = this.findRenderMesh().material;
|
|
525
3854
|
c.aggregationEnabled = !0, c.aggregationProgress = 0, c.aggregationPointDuration = this.normalizedPointDuration(), this.five.needsRender = !0;
|
|
526
3855
|
let l = this.duration, u = performance.now();
|
|
527
3856
|
return new Promise((t) => {
|
|
528
3857
|
this.cancelAnimation = e.shared.add(() => {
|
|
529
|
-
let e = performance.now() - u, r = Math.min(e / l, 1),
|
|
530
|
-
c.aggregationProgress =
|
|
531
|
-
let o = n.getPointAt(
|
|
532
|
-
s.position.copy(o), s.lookAt(
|
|
3858
|
+
let e = performance.now() - u, r = Math.min(e / l, 1), a = r * r * (3 - 2 * r);
|
|
3859
|
+
c.aggregationProgress = a, this.five.modelSceneNeedsRender = !0;
|
|
3860
|
+
let o = n.getPointAt(a);
|
|
3861
|
+
s.position.copy(o), s.lookAt(i), s.computePose(0), this.five.setState(Object.assign({}, s.pose)), this.five.needsRender = !0, r >= 1 && (c.aggregationEnabled = !1, c.aggregationProgress = 1, this.cancelAnimation && (this.cancelAnimation(), this.cancelAnimation = null), t());
|
|
533
3862
|
});
|
|
534
3863
|
});
|
|
535
3864
|
});
|
|
536
3865
|
}
|
|
537
|
-
},
|
|
3866
|
+
}, yn = (e, t) => new vn(e, t);
|
|
538
3867
|
//#endregion
|
|
539
|
-
export {
|
|
3868
|
+
export { E as BackgroundPlugin, w as BasePlugin, rt as CSS2DPlugin, ut as CSS3DPlugin, gn as FloorplanPlugin, yn as GaussianSplattingEntranceAnimationPlugin, Re as Object3DHelperController, ze as Object3DHelperPlugin, Ke as PanoAnimePlugin };
|