@anov/3d-ability 0.0.140 → 0.0.142
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/dist/business/Animation/motion/index.js +35 -56
- package/dist/business/Animation/motion/index.js.map +1 -1
- package/dist/business/Animation/type.js +2 -2
- package/dist/business/Area/Fence/FenceBase.js +146 -187
- package/dist/business/Area/Fence/FenceBase.js.map +1 -1
- package/dist/business/Area/Fence/fence_base_01.js +120 -112
- package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
- package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_roll_01.js +140 -130
- package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
- package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
- package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
- package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
- package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
- package/dist/business/Area/index.js +267 -483
- package/dist/business/Area/index.js.map +1 -1
- package/dist/business/Area/tool.js +14 -26
- package/dist/business/Area/tool.js.map +1 -1
- package/dist/business/Base/ObjectLayer.js +21 -46
- package/dist/business/Base/ObjectLayer.js.map +1 -1
- package/dist/business/Batch/index.js +189 -234
- package/dist/business/Batch/index.js.map +1 -1
- package/dist/business/Box/index.js +52 -81
- package/dist/business/Box/index.js.map +1 -1
- package/dist/business/Cylinder/index.js +51 -79
- package/dist/business/Cylinder/index.js.map +1 -1
- package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
- package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
- package/dist/business/Flyline/bubble/index.js +7 -21
- package/dist/business/Flyline/bubble/index.js.map +1 -1
- package/dist/business/Flyline/index.js +96 -162
- package/dist/business/Flyline/index.js.map +1 -1
- package/dist/business/Flyline/line/ArcLine.js +208 -291
- package/dist/business/Flyline/line/ArcLine.js.map +1 -1
- package/dist/business/Flyline/line/index.js +8 -22
- package/dist/business/Flyline/line/index.js.map +1 -1
- package/dist/business/HeatMap/HeatMap.js +380 -467
- package/dist/business/HeatMap/HeatMap.js.map +1 -1
- package/dist/business/HeatMap/core.js +405 -525
- package/dist/business/HeatMap/core.js.map +1 -1
- package/dist/business/HeatMap/shader.js +69 -3
- package/dist/business/HeatMap/shader.js.map +1 -1
- package/dist/business/InfoPanel/index.js +201 -242
- package/dist/business/InfoPanel/index.js.map +1 -1
- package/dist/business/Line/index.js +55 -88
- package/dist/business/Line/index.js.map +1 -1
- package/dist/business/Mark/KeyframeAnimation.js +145 -176
- package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
- package/dist/business/Mark/index.js +196 -294
- package/dist/business/Mark/index.js.map +1 -1
- package/dist/business/Mark/shader/tanhao.js +36 -3
- package/dist/business/Mark/shader/tanhao.js.map +1 -1
- package/dist/business/Mark/type.js +1 -1
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +377 -551
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
- package/dist/business/MaterialSwitch/inject.js +92 -58
- package/dist/business/MaterialSwitch/inject.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
- package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/ground.js +95 -16
- package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
- package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
- package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
- package/dist/business/Plane/index.js +51 -78
- package/dist/business/Plane/index.js.map +1 -1
- package/dist/business/Poi/index.d.ts +5 -0
- package/dist/business/Poi/index.js +256 -295
- package/dist/business/Poi/index.js.map +1 -1
- package/dist/business/Poi/link/Cylinder.js +56 -89
- package/dist/business/Poi/link/Cylinder.js.map +1 -1
- package/dist/business/Poi/link/Pyramid.js +104 -165
- package/dist/business/Poi/link/Pyramid.js.map +1 -1
- package/dist/business/Poi/link/index.d.ts +1 -1
- package/dist/business/Poi/link/index.js +54 -114
- package/dist/business/Poi/link/index.js.map +1 -1
- package/dist/business/Poi/panel/index.d.ts +124 -0
- package/dist/business/Poi/panel/index.js +474 -0
- package/dist/business/Poi/panel/index.js.map +1 -0
- package/dist/business/Poi/panel/interfaces.d.ts +67 -0
- package/dist/business/Poi/panel/interfaces.js +2 -0
- package/dist/business/Poi/panel/interfaces.js.map +1 -0
- package/dist/business/Poi/panel/utils.d.ts +72 -0
- package/dist/business/Poi/panel/utils.js +126 -0
- package/dist/business/Poi/panel/utils.js.map +1 -0
- package/dist/business/Poi/particle/DoubleCircle.js +71 -107
- package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
- package/dist/business/Poi/particle/DynamicCircle.js +75 -111
- package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
- package/dist/business/Poi/particle/SingleCircle.js +62 -98
- package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
- package/dist/business/Poi/particle/index.js +49 -117
- package/dist/business/Poi/particle/index.js.map +1 -1
- package/dist/business/Poi/shader/circle.js +31 -3
- package/dist/business/Poi/shader/circle.js.map +1 -1
- package/dist/business/Poi/shader/cylinder.js +37 -3
- package/dist/business/Poi/shader/cylinder.js.map +1 -1
- package/dist/business/Poi/shader/doubleCircle.js +55 -3
- package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
- package/dist/business/Poi/shader/dynamicCircle.js +67 -3
- package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
- package/dist/business/Poi/title/Border.js +7 -27
- package/dist/business/Poi/title/Border.js.map +1 -1
- package/dist/business/Poi/title/Ellipse.js +7 -27
- package/dist/business/Poi/title/Ellipse.js.map +1 -1
- package/dist/business/Poi/title/index.js +208 -292
- package/dist/business/Poi/title/index.js.map +1 -1
- package/dist/business/Poi/tools.js +22 -19
- package/dist/business/Poi/tools.js.map +1 -1
- package/dist/business/Poi/types.d.ts +3 -0
- package/dist/business/Poi/types.js.map +1 -1
- package/dist/business/Sphere/index.js +47 -72
- package/dist/business/Sphere/index.js.map +1 -1
- package/dist/business/Spline/index.js +190 -245
- package/dist/business/Spline/index.js.map +1 -1
- package/dist/business/SplitBuilding/index.js +327 -536
- package/dist/business/SplitBuilding/index.js.map +1 -1
- package/dist/business/SplitBuilding/type.js +2 -2
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
- package/dist/business/TrafficComponents/base.js +32 -55
- package/dist/business/TrafficComponents/base.js.map +1 -1
- package/dist/business/TrafficComponents/utils.d.ts +1 -1
- package/dist/business/TrafficComponents/utils.js +26 -25
- package/dist/business/TrafficComponents/utils.js.map +1 -1
- package/dist/business/Utils/Curve.js +40 -56
- package/dist/business/Utils/Curve.js.map +1 -1
- package/dist/business/Utils/constant.js +1 -1
- package/dist/business/Utils/constant.js.map +1 -1
- package/dist/business/Utils/defineProps.js +13 -14
- package/dist/business/Utils/defineProps.js.map +1 -1
- package/dist/business/Utils/round-curve.js +127 -153
- package/dist/business/Utils/round-curve.js.map +1 -1
- package/dist/business/VideoPanel/index.js +258 -319
- package/dist/business/VideoPanel/index.js.map +1 -1
- package/dist/business/Water/index.js +78 -108
- package/dist/business/Water/index.js.map +1 -1
- package/dist/business/Water/types.js +1 -1
- package/dist/business/Water/types.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
- package/dist/core/Controls/FirstViewControl/index.js +84 -96
- package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
- package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/index.js +19 -28
- package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
- package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
- package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
- package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player.js +66 -91
- package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
- package/dist/core/Controls/base.js +14 -30
- package/dist/core/Controls/base.js.map +1 -1
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
- package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
- package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
- package/dist/core/Light/PointLight/PointLightExt.js +4 -21
- package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
- package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
- package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
- package/dist/core/Material/SurfaceMaterial/index.js +76 -172
- package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
- package/dist/core/Material/decorators.js +6 -11
- package/dist/core/Material/decorators.js.map +1 -1
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
- package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
- package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
- package/dist/core/PostEffects/bloomPass.js +17 -10
- package/dist/core/PostEffects/bloomPass.js.map +1 -1
- package/dist/core/PostEffects/bloomSelect.js +60 -43
- package/dist/core/PostEffects/bloomSelect.js.map +1 -1
- package/dist/core/PostEffects/colorifyPass.js +17 -13
- package/dist/core/PostEffects/colorifyPass.js.map +1 -1
- package/dist/core/PostEffects/index.js +28 -22
- package/dist/core/PostEffects/index.js.map +1 -1
- package/dist/core/PostEffects/outlinePass.js +37 -50
- package/dist/core/PostEffects/outlinePass.js.map +1 -1
- package/dist/core/PostEffects/postprocessing.js +14 -12
- package/dist/core/PostEffects/postprocessing.js.map +1 -1
- package/dist/core/PostEffects/saoPass.js +15 -10
- package/dist/core/PostEffects/saoPass.js.map +1 -1
- package/dist/core/PostEffects/shader/colorify.js +22 -3
- package/dist/core/PostEffects/shader/colorify.js.map +1 -1
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
- package/dist/core/PostEffects/shader/mapping.js +66 -3
- package/dist/core/PostEffects/shader/mapping.js.map +1 -1
- package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
- package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
- package/dist/core/SceneEffect/grow/grow.js +85 -101
- package/dist/core/SceneEffect/grow/grow.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_down.js +60 -77
- package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_up.js +64 -81
- package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
- package/dist/core/SceneEffect/grow/type.js +2 -2
- package/dist/core/SceneEffect/grow/type.js.map +1 -1
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
- package/dist/core/WeatherSystem/hdr/index.js +69 -105
- package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
- package/dist/core/WeatherSystem/index.js +77 -124
- package/dist/core/WeatherSystem/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
- package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
- package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
- package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
- package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
- package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
- package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
- package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
- package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
- package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/fog.js +103 -3
- package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/rain.js +206 -7
- package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/sky.js +87 -3
- package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
- package/dist/core/WeatherSystem/sky/index.js +104 -135
- package/dist/core/WeatherSystem/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/utils/constant.js +44 -38
- package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
- package/dist/core/WeatherSystem/utils/math.js +18 -25
- package/dist/core/WeatherSystem/utils/math.js.map +1 -1
- package/dist/core/WeatherSystem/utils/type.js +1 -1
- package/dist/core/WeatherSystem/utils/type.js.map +1 -1
- package/dist/core/WeatherSystem/weather/index.js +96 -141
- package/dist/core/WeatherSystem/weather/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
19
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
20
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
25
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
8
|
import { Box3, Group, Vector3, use } from '@anov/3d-core';
|
|
27
9
|
import _ from 'lodash';
|
|
28
10
|
import ObjectLayer from "../Base/ObjectLayer";
|
|
@@ -30,7 +12,8 @@ import { lookAtOnYAxis } from "./tools";
|
|
|
30
12
|
import { StrategyManage as LinkStrategy } from "./link";
|
|
31
13
|
import { StrategyManage as ParticleStrategy } from "./particle";
|
|
32
14
|
import { StrategyManage as TitleStrategy } from "./title";
|
|
33
|
-
|
|
15
|
+
import InfoPanel from "./panel";
|
|
16
|
+
const DEFAULT_OPTION = {
|
|
34
17
|
style: 'poi_border_01',
|
|
35
18
|
facingCamera: true,
|
|
36
19
|
autoScale: true,
|
|
@@ -55,291 +38,269 @@ var DEFAULT_OPTION = {
|
|
|
55
38
|
color: '#FFFFFF'
|
|
56
39
|
}
|
|
57
40
|
};
|
|
58
|
-
|
|
41
|
+
const STYLE_DATA = {
|
|
59
42
|
poi_border_01: ['border', 'pyramid', 'circle'],
|
|
60
43
|
poi_ellipse_01: ['ellipse', 'cylinder', 'circle']
|
|
61
44
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_defineProperty(
|
|
71
|
-
_defineProperty(
|
|
72
|
-
_defineProperty(
|
|
73
|
-
_defineProperty(
|
|
74
|
-
_defineProperty(
|
|
75
|
-
_defineProperty(
|
|
76
|
-
_defineProperty(
|
|
77
|
-
_defineProperty(
|
|
78
|
-
_defineProperty(
|
|
79
|
-
_defineProperty(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return this._style;
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "autoScale",
|
|
110
|
-
get: function get() {
|
|
111
|
-
return this._autoScale;
|
|
112
|
-
},
|
|
113
|
-
set: function set(newValue) {
|
|
114
|
-
this._autoScale = newValue;
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "facingCamera",
|
|
118
|
-
get: function get() {
|
|
119
|
-
return this._facingCamera;
|
|
120
|
-
},
|
|
121
|
-
set: function set(newValue) {
|
|
122
|
-
this._facingCamera = newValue;
|
|
123
|
-
}
|
|
124
|
-
}, {
|
|
125
|
-
key: "text",
|
|
126
|
-
get: function get() {
|
|
127
|
-
return this._text;
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
key: "model",
|
|
131
|
-
get: function get() {
|
|
132
|
-
return this._model;
|
|
133
|
-
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "particle",
|
|
136
|
-
get: function get() {
|
|
137
|
-
return this._particle;
|
|
45
|
+
const MAX_DISTANCE = 500;
|
|
46
|
+
class Poi extends ObjectLayer {
|
|
47
|
+
constructor(option) {
|
|
48
|
+
super();
|
|
49
|
+
_defineProperty(this, "_mesh", void 0);
|
|
50
|
+
_defineProperty(this, "_titleMesh", void 0);
|
|
51
|
+
_defineProperty(this, "_linkMesh", void 0);
|
|
52
|
+
_defineProperty(this, "_particleMesh", void 0);
|
|
53
|
+
_defineProperty(this, "_panel", void 0);
|
|
54
|
+
_defineProperty(this, "_disposeCallbacks", []);
|
|
55
|
+
_defineProperty(this, "_style", void 0);
|
|
56
|
+
_defineProperty(this, "_autoScale", void 0);
|
|
57
|
+
_defineProperty(this, "_facingCamera", void 0);
|
|
58
|
+
_defineProperty(this, "_text", void 0);
|
|
59
|
+
_defineProperty(this, "_model", void 0);
|
|
60
|
+
_defineProperty(this, "_particle", void 0);
|
|
61
|
+
_defineProperty(this, "_content", void 0);
|
|
62
|
+
_defineProperty(this, "type", 'Group');
|
|
63
|
+
const param = _.mergeWith(_.cloneDeep(DEFAULT_OPTION), option, this.arrayMergeCustomizer);
|
|
64
|
+
const {
|
|
65
|
+
style,
|
|
66
|
+
text,
|
|
67
|
+
model,
|
|
68
|
+
particle,
|
|
69
|
+
autoScale,
|
|
70
|
+
facingCamera,
|
|
71
|
+
content
|
|
72
|
+
} = param;
|
|
73
|
+
this._style = style;
|
|
74
|
+
this._text = text;
|
|
75
|
+
this._model = model;
|
|
76
|
+
this._particle = particle;
|
|
77
|
+
this._autoScale = autoScale;
|
|
78
|
+
this._facingCamera = facingCamera;
|
|
79
|
+
this._content = content;
|
|
80
|
+
switch (this.style) {
|
|
81
|
+
case 'poi_border_01':
|
|
82
|
+
case 'poi_ellipse_01':
|
|
83
|
+
case 'poi_custom':
|
|
84
|
+
this.init();
|
|
85
|
+
break;
|
|
86
|
+
case 'poi_card_01':
|
|
87
|
+
this.initCard(param);
|
|
88
|
+
break;
|
|
138
89
|
}
|
|
90
|
+
}
|
|
91
|
+
get content() {
|
|
92
|
+
return this._content;
|
|
93
|
+
}
|
|
94
|
+
get mesh() {
|
|
95
|
+
return this._mesh;
|
|
96
|
+
}
|
|
97
|
+
get style() {
|
|
98
|
+
return this._style;
|
|
99
|
+
}
|
|
100
|
+
get autoScale() {
|
|
101
|
+
return this._autoScale;
|
|
102
|
+
}
|
|
103
|
+
set autoScale(newValue) {
|
|
104
|
+
this._autoScale = newValue;
|
|
105
|
+
}
|
|
106
|
+
get facingCamera() {
|
|
107
|
+
return this._facingCamera;
|
|
108
|
+
}
|
|
109
|
+
set facingCamera(newValue) {
|
|
110
|
+
this._facingCamera = newValue;
|
|
111
|
+
}
|
|
112
|
+
get text() {
|
|
113
|
+
return this._text;
|
|
114
|
+
}
|
|
115
|
+
get model() {
|
|
116
|
+
return this._model;
|
|
117
|
+
}
|
|
118
|
+
get particle() {
|
|
119
|
+
return this._particle;
|
|
120
|
+
}
|
|
139
121
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
value: function () {
|
|
153
|
-
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
154
|
-
var _this$text,
|
|
155
|
-
_this2 = this,
|
|
156
|
-
_this$_linkMesh;
|
|
157
|
-
var group, _STYLE_DATA$this$styl, titleStyle, linkStyle, particleStyle, strategies, loadTasks;
|
|
158
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
159
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
160
|
-
case 0:
|
|
161
|
-
group = new Group();
|
|
162
|
-
_STYLE_DATA$this$styl = _slicedToArray(STYLE_DATA[this.style], 3), titleStyle = _STYLE_DATA$this$styl[0], linkStyle = _STYLE_DATA$this$styl[1], particleStyle = _STYLE_DATA$this$styl[2]; // 仅加载需要的资源
|
|
163
|
-
strategies = {
|
|
164
|
-
_titleMesh: {
|
|
165
|
-
strategy: TitleStrategy[titleStyle],
|
|
166
|
-
config: this.text,
|
|
167
|
-
condition: ((_this$text = this.text) === null || _this$text === void 0 ? void 0 : _this$text.visible) !== false
|
|
168
|
-
},
|
|
169
|
-
_linkMesh: {
|
|
170
|
-
strategy: LinkStrategy[linkStyle],
|
|
171
|
-
config: this.model,
|
|
172
|
-
condition: !this.model || this.model.visible !== false
|
|
173
|
-
},
|
|
174
|
-
_particleMesh: {
|
|
175
|
-
strategy: ParticleStrategy[particleStyle],
|
|
176
|
-
config: this.particle,
|
|
177
|
-
condition: !this.particle || this.particle.visible !== false
|
|
178
|
-
}
|
|
179
|
-
}; // 过滤掉不需要加载的组件,并发加载
|
|
180
|
-
loadTasks = Object.entries(strategies).filter(function (_ref) {
|
|
181
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
182
|
-
condition = _ref2[1].condition;
|
|
183
|
-
return condition;
|
|
184
|
-
}).map( /*#__PURE__*/function () {
|
|
185
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref3) {
|
|
186
|
-
var _ref5, key, _ref5$, strategy, config, ClassRef;
|
|
187
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
188
|
-
while (1) switch (_context.prev = _context.next) {
|
|
189
|
-
case 0:
|
|
190
|
-
_ref5 = _slicedToArray(_ref3, 2), key = _ref5[0], _ref5$ = _ref5[1], strategy = _ref5$.strategy, config = _ref5$.config;
|
|
191
|
-
if (strategy) {
|
|
192
|
-
_context.next = 3;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
return _context.abrupt("return");
|
|
196
|
-
case 3:
|
|
197
|
-
_context.next = 5;
|
|
198
|
-
return strategy();
|
|
199
|
-
case 5:
|
|
200
|
-
ClassRef = _context.sent;
|
|
201
|
-
_this2[key] = new ClassRef(_objectSpread({}, config));
|
|
202
|
-
_context.next = 9;
|
|
203
|
-
return _this2[key].ready;
|
|
204
|
-
case 9:
|
|
205
|
-
group.add(_this2[key]);
|
|
206
|
-
case 10:
|
|
207
|
-
case "end":
|
|
208
|
-
return _context.stop();
|
|
209
|
-
}
|
|
210
|
-
}, _callee);
|
|
211
|
-
}));
|
|
212
|
-
return function (_x) {
|
|
213
|
-
return _ref4.apply(this, arguments);
|
|
214
|
-
};
|
|
215
|
-
}()); // 等待所有组件加载完成
|
|
216
|
-
_context2.next = 6;
|
|
217
|
-
return Promise.all(loadTasks);
|
|
218
|
-
case 6:
|
|
219
|
-
this._mesh = group;
|
|
220
|
-
// 布局计算
|
|
221
|
-
this.calculateLayout();
|
|
222
|
-
// 边界盒处理
|
|
223
|
-
this.setupBoundingBox(group);
|
|
224
|
-
// 统一更新矩阵
|
|
225
|
-
group.updateWorldMatrix(true, true);
|
|
226
|
-
// 动画和事件
|
|
227
|
-
(_this$_linkMesh = this._linkMesh) === null || _this$_linkMesh === void 0 || _this$_linkMesh.setupAnimation();
|
|
228
|
-
this.add(group);
|
|
122
|
+
// 销毁
|
|
123
|
+
destroy() {
|
|
124
|
+
this._disposeCallbacks.forEach(fn => fn());
|
|
125
|
+
this._disposeCallbacks = [];
|
|
126
|
+
this.remove(this._mesh);
|
|
127
|
+
}
|
|
128
|
+
init() {
|
|
129
|
+
var _this = this;
|
|
130
|
+
return _asyncToGenerator(function* () {
|
|
131
|
+
var _this$text, _this$_linkMesh;
|
|
132
|
+
const group = new Group();
|
|
133
|
+
const [titleStyle, linkStyle, particleStyle] = STYLE_DATA[_this.style];
|
|
229
134
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
key: "calculateLayout",
|
|
248
|
-
value: function calculateLayout() {
|
|
249
|
-
var _this$_linkMesh2, _this$_linkMesh3, _this$_particleMesh;
|
|
250
|
-
var titleSize = this._titleMesh ? this.getBoxSize(this._titleMesh) : {
|
|
251
|
-
height: 0
|
|
252
|
-
};
|
|
253
|
-
var linkSize = this._linkMesh ? this.getBoxSize(this._linkMesh) : {
|
|
254
|
-
height: 0
|
|
135
|
+
// 仅加载需要的资源
|
|
136
|
+
const strategies = {
|
|
137
|
+
_titleMesh: {
|
|
138
|
+
strategy: TitleStrategy[titleStyle],
|
|
139
|
+
config: _this.text,
|
|
140
|
+
condition: ((_this$text = _this.text) === null || _this$text === void 0 ? void 0 : _this$text.visible) !== false
|
|
141
|
+
},
|
|
142
|
+
_linkMesh: {
|
|
143
|
+
strategy: LinkStrategy[linkStyle],
|
|
144
|
+
config: _this.model,
|
|
145
|
+
condition: !_this.model || _this.model.visible !== false
|
|
146
|
+
},
|
|
147
|
+
_particleMesh: {
|
|
148
|
+
strategy: ParticleStrategy[particleStyle],
|
|
149
|
+
config: _this.particle,
|
|
150
|
+
condition: !_this.particle || _this.particle.visible !== false
|
|
151
|
+
}
|
|
255
152
|
};
|
|
256
153
|
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
}, {
|
|
278
|
-
key: "setupBoundingBox",
|
|
279
|
-
value: function setupBoundingBox(mesh) {
|
|
280
|
-
// 计算Group的边界盒
|
|
281
|
-
var box = new Box3().setFromObject(mesh);
|
|
282
|
-
var size = new Vector3();
|
|
283
|
-
var center = new Vector3();
|
|
284
|
-
box.getSize(size);
|
|
285
|
-
box.getCenter(center);
|
|
154
|
+
// 过滤掉不需要加载的组件,并发加载
|
|
155
|
+
const loadTasks = Object.entries(strategies).filter(([, {
|
|
156
|
+
condition
|
|
157
|
+
}]) => condition).map( /*#__PURE__*/function () {
|
|
158
|
+
var _ref = _asyncToGenerator(function* ([key, {
|
|
159
|
+
strategy,
|
|
160
|
+
config
|
|
161
|
+
}]) {
|
|
162
|
+
if (!strategy) return;
|
|
163
|
+
const ClassRef = yield strategy();
|
|
164
|
+
_this[key] = new ClassRef(_objectSpread({}, config));
|
|
165
|
+
yield _this[key].ready;
|
|
166
|
+
group.add(_this[key]);
|
|
167
|
+
});
|
|
168
|
+
return function (_x) {
|
|
169
|
+
return _ref.apply(this, arguments);
|
|
170
|
+
};
|
|
171
|
+
}());
|
|
286
172
|
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// camera && this._mesh.quaternion.copy(camera.quaternion)
|
|
300
|
-
// this._mesh.rotation.y = camera.rotation.y
|
|
173
|
+
// 等待所有组件加载完成
|
|
174
|
+
yield Promise.all(loadTasks);
|
|
175
|
+
_this._mesh = group;
|
|
176
|
+
// 布局计算
|
|
177
|
+
_this.calculateLayout();
|
|
178
|
+
// 边界盒处理
|
|
179
|
+
_this.setupBoundingBox(group);
|
|
180
|
+
// 统一更新矩阵
|
|
181
|
+
group.updateWorldMatrix(true, true);
|
|
182
|
+
// 动画和事件
|
|
183
|
+
(_this$_linkMesh = _this._linkMesh) === null || _this$_linkMesh === void 0 || _this$_linkMesh.setupAnimation();
|
|
184
|
+
_this.add(group);
|
|
301
185
|
|
|
302
|
-
|
|
303
|
-
|
|
186
|
+
// 代理
|
|
187
|
+
_this._text = _this.createProxy(_this._text, _this._titleMesh);
|
|
188
|
+
_this._model = _this.createProxy(_this._model, _this._linkMesh);
|
|
189
|
+
_this._particle = _this.createProxy(_this._particle, _this._particleMesh);
|
|
190
|
+
_this.addEventListeners();
|
|
191
|
+
})();
|
|
192
|
+
}
|
|
193
|
+
/** 初始化卡片样式 */
|
|
194
|
+
initCard(param) {
|
|
195
|
+
const group = new Group();
|
|
196
|
+
this._mesh = group;
|
|
197
|
+
const panel = new InfoPanel(param);
|
|
198
|
+
this._panel = panel;
|
|
199
|
+
group.add(panel);
|
|
200
|
+
// CSS3D 信息面板默认不随距离缩放,保持屏幕像素尺寸稳定
|
|
201
|
+
this._autoScale = false;
|
|
202
|
+
this.add(group);
|
|
203
|
+
this.addEventListeners();
|
|
204
|
+
}
|
|
205
|
+
/** 布局计算 */
|
|
206
|
+
calculateLayout() {
|
|
207
|
+
var _this$_linkMesh2, _this$_linkMesh3, _this$_particleMesh;
|
|
208
|
+
const titleSize = this._titleMesh ? this.getBoxSize(this._titleMesh) : {
|
|
209
|
+
height: 0
|
|
210
|
+
};
|
|
211
|
+
const linkSize = this._linkMesh ? this.getBoxSize(this._linkMesh) : {
|
|
212
|
+
height: 0
|
|
213
|
+
};
|
|
304
214
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
215
|
+
// 计算基础 Y 轴偏移
|
|
216
|
+
let baseY = -titleSize.height / 2;
|
|
217
|
+
const linkHeight = linkSize.height;
|
|
218
|
+
const linkVSpace = ((_this$_linkMesh2 = this._linkMesh) === null || _this$_linkMesh2 === void 0 || (_this$_linkMesh2 = _this$_linkMesh2.vspace) === null || _this$_linkMesh2 === void 0 ? void 0 : _this$_linkMesh2[0]) || 0;
|
|
219
|
+
baseY -= linkVSpace;
|
|
220
|
+
(_this$_linkMesh3 = this._linkMesh) === null || _this$_linkMesh3 === void 0 || _this$_linkMesh3.position.setY(baseY - linkHeight / 2);
|
|
221
|
+
(_this$_particleMesh = this._particleMesh) === null || _this$_particleMesh === void 0 || _this$_particleMesh.position.setY(baseY - linkHeight);
|
|
222
|
+
}
|
|
223
|
+
getBoxSize(mesh) {
|
|
224
|
+
// mesh.updateWorldMatrix(true, true)
|
|
225
|
+
const {
|
|
226
|
+
max,
|
|
227
|
+
min
|
|
228
|
+
} = new Box3().setFromObject(mesh);
|
|
229
|
+
return {
|
|
230
|
+
width: max.x - min.x,
|
|
231
|
+
height: max.y - min.y
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
setupBoundingBox(mesh) {
|
|
235
|
+
// 计算Group的边界盒
|
|
236
|
+
const box = new Box3().setFromObject(mesh);
|
|
237
|
+
const size = new Vector3();
|
|
238
|
+
const center = new Vector3();
|
|
239
|
+
box.getSize(size);
|
|
240
|
+
box.getCenter(center);
|
|
241
|
+
|
|
242
|
+
// 计算底部中心位置
|
|
243
|
+
const bottomCenter = new Vector3(center.x, box.min.y, center.z);
|
|
244
|
+
// 平移所有Mesh,使底部中心对齐到控制点
|
|
245
|
+
mesh.children.forEach(mesh => {
|
|
246
|
+
mesh.position.sub(bottomCenter);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
updateViewDirection() {
|
|
250
|
+
const {
|
|
251
|
+
camera
|
|
252
|
+
} = use.useScene();
|
|
253
|
+
// camera && this._mesh.quaternion.copy(camera.quaternion)
|
|
254
|
+
// this._mesh.rotation.y = camera.rotation.y
|
|
255
|
+
|
|
256
|
+
lookAtOnYAxis(this._mesh, camera.position);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/// <summary>
|
|
260
|
+
/// 按照距离缩放,距离越远,缩放越大
|
|
261
|
+
/// </summary>
|
|
262
|
+
updateScale() {
|
|
263
|
+
const {
|
|
264
|
+
camera
|
|
265
|
+
} = use.useScene();
|
|
266
|
+
// Make the signboard face the camera
|
|
267
|
+
// this._mesh.lookAt(camera.position);
|
|
268
|
+
// 计算相机和物体之间的距离
|
|
269
|
+
const distance = camera === null || camera === void 0 ? void 0 : camera.position.distanceTo(this._mesh.position);
|
|
270
|
+
if (distance >= MAX_DISTANCE) return;
|
|
271
|
+
const scale = distance / 20 || 1;
|
|
272
|
+
this._mesh.scale.set(scale, scale, scale);
|
|
273
|
+
}
|
|
274
|
+
addEventListeners() {
|
|
275
|
+
var _scene$orbitControls;
|
|
276
|
+
const updateTransform = () => {
|
|
277
|
+
const {
|
|
278
|
+
camera
|
|
279
|
+
} = use.useScene();
|
|
280
|
+
// 普通 POI:依旧使用面向相机和距离缩放
|
|
281
|
+
this._facingCamera !== false && this.updateViewDirection();
|
|
282
|
+
this._autoScale === true && this.updateScale();
|
|
283
|
+
// CSS3D 面板:使用动态像素→米缩放,并处理面板面向相机
|
|
284
|
+
if (this._panel && camera) {
|
|
285
|
+
this._panel.updateFacing(camera);
|
|
286
|
+
this._panel.updateDynamicScale(camera);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
const scene = use.useScene();
|
|
290
|
+
const callback = () => updateTransform();
|
|
291
|
+
updateTransform();
|
|
292
|
+
(_scene$orbitControls = scene.orbitControls) === null || _scene$orbitControls === void 0 || _scene$orbitControls.addEventListener('change', callback);
|
|
293
|
+
this._disposeCallbacks.push(() => {
|
|
294
|
+
var _scene$orbitControls2;
|
|
295
|
+
(_scene$orbitControls2 = scene.orbitControls) === null || _scene$orbitControls2 === void 0 || _scene$orbitControls2.removeEventListener('change', callback);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// 每帧跟随更新,确保场景缩放/组变换也能驱动面板更新
|
|
299
|
+
const cancelFrame = use.useframe(() => {
|
|
334
300
|
updateTransform();
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}]);
|
|
342
|
-
return Poi;
|
|
343
|
-
}(ObjectLayer);
|
|
301
|
+
});
|
|
302
|
+
this._disposeCallbacks.push(() => cancelFrame());
|
|
303
|
+
}
|
|
304
|
+
}
|
|
344
305
|
export { Poi };
|
|
345
306
|
//# sourceMappingURL=index.js.map
|