@anov/3d-ability 0.0.142 → 0.0.144
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 +56 -35
- 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 +187 -146
- package/dist/business/Area/Fence/FenceBase.js.map +1 -1
- package/dist/business/Area/Fence/fence_base_01.js +112 -120
- package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_feeting_01.js +130 -218
- package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_roll_01.js +130 -140
- package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
- package/dist/business/Area/FillArea/FillAreaBase.js +126 -87
- package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_face_01.js +98 -72
- package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_line_01.js +94 -66
- package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
- package/dist/business/Area/index.js +483 -267
- package/dist/business/Area/index.js.map +1 -1
- package/dist/business/Area/tool.js +26 -14
- package/dist/business/Area/tool.js.map +1 -1
- package/dist/business/Base/ObjectLayer.js +46 -21
- package/dist/business/Base/ObjectLayer.js.map +1 -1
- package/dist/business/Batch/index.js +234 -189
- package/dist/business/Batch/index.js.map +1 -1
- package/dist/business/Box/index.js +81 -52
- package/dist/business/Box/index.js.map +1 -1
- package/dist/business/Cylinder/index.js +79 -51
- package/dist/business/Cylinder/index.js.map +1 -1
- package/dist/business/Flyline/bubble/CircleBubble.js +9 -1
- package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
- package/dist/business/Flyline/bubble/index.js +21 -7
- package/dist/business/Flyline/bubble/index.js.map +1 -1
- package/dist/business/Flyline/index.js +162 -96
- package/dist/business/Flyline/index.js.map +1 -1
- package/dist/business/Flyline/line/ArcLine.js +291 -208
- package/dist/business/Flyline/line/ArcLine.js.map +1 -1
- package/dist/business/Flyline/line/index.js +22 -8
- package/dist/business/Flyline/line/index.js.map +1 -1
- package/dist/business/HeatMap/HeatMap.js +467 -380
- package/dist/business/HeatMap/HeatMap.js.map +1 -1
- package/dist/business/HeatMap/core.js +525 -405
- package/dist/business/HeatMap/core.js.map +1 -1
- package/dist/business/HeatMap/shader.js +3 -69
- package/dist/business/HeatMap/shader.js.map +1 -1
- package/dist/business/InfoPanel/index.js +242 -201
- package/dist/business/InfoPanel/index.js.map +1 -1
- package/dist/business/Line/index.js +88 -55
- package/dist/business/Line/index.js.map +1 -1
- package/dist/business/Mark/KeyframeAnimation.js +176 -145
- package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
- package/dist/business/Mark/index.js +294 -196
- package/dist/business/Mark/index.js.map +1 -1
- package/dist/business/Mark/shader/tanhao.js +3 -36
- package/dist/business/Mark/shader/tanhao.js.map +1 -1
- package/dist/business/Mark/type.js +1 -1
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +551 -377
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
- package/dist/business/MaterialSwitch/inject.js +58 -92
- package/dist/business/MaterialSwitch/inject.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/finalFade.js +2 -74
- package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/ground.js +16 -95
- package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/groundBase64.js +3 -9
- package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/realFade.js +9 -48
- package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
- package/dist/business/Plane/index.js +78 -51
- package/dist/business/Plane/index.js.map +1 -1
- package/dist/business/Poi/index.js +336 -248
- package/dist/business/Poi/index.js.map +1 -1
- package/dist/business/Poi/link/Cylinder.js +89 -56
- package/dist/business/Poi/link/Cylinder.js.map +1 -1
- package/dist/business/Poi/link/Pyramid.js +165 -104
- 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 +114 -54
- package/dist/business/Poi/link/index.js.map +1 -1
- package/dist/business/Poi/panel/index.js +373 -315
- package/dist/business/Poi/panel/index.js.map +1 -1
- package/dist/business/Poi/panel/utils.js +10 -5
- package/dist/business/Poi/panel/utils.js.map +1 -1
- package/dist/business/Poi/particle/DoubleCircle.js +107 -71
- package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
- package/dist/business/Poi/particle/DynamicCircle.js +111 -75
- package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
- package/dist/business/Poi/particle/SingleCircle.js +98 -62
- package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
- package/dist/business/Poi/particle/index.js +117 -49
- package/dist/business/Poi/particle/index.js.map +1 -1
- package/dist/business/Poi/shader/circle.js +3 -31
- package/dist/business/Poi/shader/circle.js.map +1 -1
- package/dist/business/Poi/shader/cylinder.js +3 -37
- package/dist/business/Poi/shader/cylinder.js.map +1 -1
- package/dist/business/Poi/shader/doubleCircle.js +3 -55
- package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
- package/dist/business/Poi/shader/dynamicCircle.js +3 -67
- package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
- package/dist/business/Poi/title/Border.js +27 -7
- package/dist/business/Poi/title/Border.js.map +1 -1
- package/dist/business/Poi/title/Ellipse.js +27 -7
- package/dist/business/Poi/title/Ellipse.js.map +1 -1
- package/dist/business/Poi/title/index.js +292 -208
- package/dist/business/Poi/title/index.js.map +1 -1
- package/dist/business/Poi/tools.js +17 -18
- package/dist/business/Poi/tools.js.map +1 -1
- package/dist/business/Sphere/index.js +72 -47
- package/dist/business/Sphere/index.js.map +1 -1
- package/dist/business/Spline/index.js +245 -190
- package/dist/business/Spline/index.js.map +1 -1
- package/dist/business/SplitBuilding/index.js +536 -327
- package/dist/business/SplitBuilding/index.js.map +1 -1
- package/dist/business/SplitBuilding/type.js +2 -2
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +275 -218
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +177 -132
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +1 -51
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +1 -6
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
- package/dist/business/TrafficComponents/base.js +55 -32
- package/dist/business/TrafficComponents/base.js.map +1 -1
- package/dist/business/TrafficComponents/utils.js +24 -25
- package/dist/business/TrafficComponents/utils.js.map +1 -1
- package/dist/business/Utils/Curve.js +56 -40
- 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 +14 -13
- package/dist/business/Utils/defineProps.js.map +1 -1
- package/dist/business/Utils/round-curve.js +153 -127
- package/dist/business/Utils/round-curve.js.map +1 -1
- package/dist/business/VideoPanel/index.js +319 -258
- package/dist/business/VideoPanel/index.js.map +1 -1
- package/dist/business/Water/index.js +108 -78
- 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 +449 -383
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +142 -107
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
- package/dist/core/Controls/FirstViewControl/index.js +96 -84
- package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/action/input.js +98 -77
- 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 +28 -19
- package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/animation.js +155 -126
- package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/camera.js +63 -47
- package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/control.js +49 -39
- package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player.js +91 -66
- package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
- package/dist/core/Controls/base.js +30 -14
- package/dist/core/Controls/base.js.map +1 -1
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +131 -92
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
- package/dist/core/Debug/PerformanceInfo/Performance.js +47 -22
- package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
- package/dist/core/Light/PointLight/PointLightExt.js +21 -4
- package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
- package/dist/core/Material/FinirMaterial/FinirMaterial.js +57 -37
- package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +153 -116
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js +1 -95
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js +1 -26
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
- package/dist/core/Material/SurfaceMaterial/index.js +172 -76
- package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
- package/dist/core/Material/decorators.js +11 -6
- package/dist/core/Material/decorators.js.map +1 -1
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +12 -16
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
- package/dist/core/PostEffects/addBrightnessContrastPass.js +13 -17
- package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
- package/dist/core/PostEffects/bloomPass.js +10 -17
- package/dist/core/PostEffects/bloomPass.js.map +1 -1
- package/dist/core/PostEffects/bloomSelect.js +43 -60
- package/dist/core/PostEffects/bloomSelect.js.map +1 -1
- package/dist/core/PostEffects/colorifyPass.js +13 -17
- package/dist/core/PostEffects/colorifyPass.js.map +1 -1
- package/dist/core/PostEffects/index.js +22 -28
- package/dist/core/PostEffects/index.js.map +1 -1
- package/dist/core/PostEffects/outlinePass.js +50 -37
- package/dist/core/PostEffects/outlinePass.js.map +1 -1
- package/dist/core/PostEffects/postprocessing.js +12 -14
- package/dist/core/PostEffects/postprocessing.js.map +1 -1
- package/dist/core/PostEffects/saoPass.js +10 -15
- package/dist/core/PostEffects/saoPass.js.map +1 -1
- package/dist/core/PostEffects/shader/colorify.js +3 -22
- package/dist/core/PostEffects/shader/colorify.js.map +1 -1
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js +3 -27
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
- package/dist/core/PostEffects/shader/mapping.js +3 -66
- package/dist/core/PostEffects/shader/mapping.js.map +1 -1
- package/dist/core/PostEffects/shader/thermalMaging.js +3 -28
- package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
- package/dist/core/SceneEffect/grow/grow.js +101 -85
- package/dist/core/SceneEffect/grow/grow.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_down.js +77 -60
- package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_up.js +81 -64
- 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 +76 -51
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
- package/dist/core/WeatherSystem/hdr/index.js +105 -69
- package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
- package/dist/core/WeatherSystem/index.js +124 -77
- package/dist/core/WeatherSystem/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/fog/index.js +80 -52
- package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/index.js +84 -72
- package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/lineRain.js +118 -88
- package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/plane.js +146 -116
- package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/point.js +148 -100
- package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/cloud.js +104 -71
- package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/index.js +84 -66
- package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/outline.js +45 -25
- package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/cloud.js +3 -74
- package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/fog.js +3 -103
- package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/rain.js +7 -206
- package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/sky.js +3 -87
- package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
- package/dist/core/WeatherSystem/sky/index.js +135 -104
- package/dist/core/WeatherSystem/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/utils/constant.js +38 -44
- package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
- package/dist/core/WeatherSystem/utils/math.js +25 -18
- 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 +141 -96
- 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,6 +1,23 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
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); }
|
|
12
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
13
|
+
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); }; }
|
|
14
|
+
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); }
|
|
15
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1
18
|
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; }
|
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
3
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
20
|
+
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); }
|
|
4
21
|
/*
|
|
5
22
|
* @Descripttion:
|
|
6
23
|
* @version:
|
|
@@ -34,7 +51,7 @@ import { clampAlign, parseWeight, parseStyle, num, color, sanitizeUrl, arr2, arr
|
|
|
34
51
|
* - billboard: 看板模式('none'|'yaw'|'full')
|
|
35
52
|
* - anchor: 面板锚点('top'|'center'|'bottom')
|
|
36
53
|
*/
|
|
37
|
-
|
|
54
|
+
var defaults = {
|
|
38
55
|
text: {
|
|
39
56
|
value: '',
|
|
40
57
|
fontSize: 16,
|
|
@@ -100,13 +117,18 @@ const defaults = {
|
|
|
100
117
|
* });
|
|
101
118
|
* panel.updateDynamicScale(camera);
|
|
102
119
|
*/
|
|
103
|
-
|
|
120
|
+
var InfoPanel = /*#__PURE__*/function (_ObjectLayer) {
|
|
121
|
+
_inherits(InfoPanel, _ObjectLayer);
|
|
122
|
+
var _super = _createSuper(InfoPanel);
|
|
104
123
|
/**
|
|
105
124
|
* 构造函数
|
|
106
125
|
* @param cfg 外部配置对象;仅识别本组件支持的字段,其他字段会忽略
|
|
107
126
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
function InfoPanel() {
|
|
128
|
+
var _this;
|
|
129
|
+
var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
130
|
+
_classCallCheck(this, InfoPanel);
|
|
131
|
+
_this = _super.call(this);
|
|
110
132
|
// 新增字段声明,修复类型报错
|
|
111
133
|
/**
|
|
112
134
|
* 内部状态与元素引用
|
|
@@ -117,37 +139,38 @@ export default class InfoPanel extends ObjectLayer {
|
|
|
117
139
|
* - innerWrap: 内部包裹,用于实现锚点与偏移
|
|
118
140
|
* - _cssObject: three.js CSS3DObject(加入到 scene graph)
|
|
119
141
|
*/
|
|
120
|
-
_defineProperty(
|
|
121
|
-
_defineProperty(
|
|
122
|
-
_defineProperty(
|
|
123
|
-
_defineProperty(
|
|
124
|
-
_defineProperty(
|
|
125
|
-
_defineProperty(
|
|
142
|
+
_defineProperty(_assertThisInitialized(_this), "config", void 0);
|
|
143
|
+
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
|
144
|
+
_defineProperty(_assertThisInitialized(_this), "titleEl", void 0);
|
|
145
|
+
_defineProperty(_assertThisInitialized(_this), "contentEl", void 0);
|
|
146
|
+
_defineProperty(_assertThisInitialized(_this), "innerWrap", void 0);
|
|
147
|
+
_defineProperty(_assertThisInitialized(_this), "_cssObject", void 0);
|
|
126
148
|
// 复用的临时向量,避免频繁创建对象
|
|
127
|
-
_defineProperty(
|
|
128
|
-
_defineProperty(
|
|
129
|
-
_defineProperty(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
149
|
+
_defineProperty(_assertThisInitialized(_this), "_tmpObjPos", new Vector3());
|
|
150
|
+
_defineProperty(_assertThisInitialized(_this), "_tmpCamPos", new Vector3());
|
|
151
|
+
_defineProperty(_assertThisInitialized(_this), "_tmpCamDir", new Vector3());
|
|
152
|
+
_this.config = JSON.parse(JSON.stringify(defaults));
|
|
153
|
+
_this.updateConfig(cfg);
|
|
154
|
+
_this.container = document.createElement('div');
|
|
155
|
+
_this.titleEl = document.createElement('div');
|
|
156
|
+
_this.contentEl = document.createElement('div');
|
|
157
|
+
_this.innerWrap = document.createElement('div');
|
|
136
158
|
// 内层包裹用于布局,默认采用容器左上角为参考点
|
|
137
|
-
setStyles(
|
|
159
|
+
setStyles(_this.innerWrap, {
|
|
138
160
|
position: 'relative',
|
|
139
161
|
left: '0',
|
|
140
162
|
top: '0',
|
|
141
163
|
transform: 'none',
|
|
142
164
|
pointerEvents: 'auto'
|
|
143
165
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
166
|
+
_this.innerWrap.appendChild(_this.titleEl);
|
|
167
|
+
_this.innerWrap.appendChild(_this.contentEl);
|
|
168
|
+
_this.container.appendChild(_this.innerWrap);
|
|
147
169
|
// 将 CSS3DObject 作为子节点添加,而非赋值到 this.object3D
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
170
|
+
_this._cssObject = new CSS3DObject(_this.container);
|
|
171
|
+
_this.add(_this._cssObject);
|
|
172
|
+
_this.applyStyle();
|
|
173
|
+
return _this;
|
|
151
174
|
}
|
|
152
175
|
|
|
153
176
|
/**
|
|
@@ -158,188 +181,215 @@ export default class InfoPanel extends ObjectLayer {
|
|
|
158
181
|
* - `anchor`: 面板锚点。
|
|
159
182
|
* @param cfg 配置对象
|
|
160
183
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
184
|
+
_createClass(InfoPanel, [{
|
|
185
|
+
key: "updateConfig",
|
|
186
|
+
value: function updateConfig() {
|
|
187
|
+
var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
188
|
+
var t = cfg.text || {};
|
|
189
|
+
var c = cfg.content || {};
|
|
190
|
+
this.config.text.value = typeof t.value === 'string' ? t.value : this.config.text.value;
|
|
191
|
+
this.config.text.fontSize = num(t.fontSize, this.config.text.fontSize);
|
|
192
|
+
this.config.text.color = color(t.color, this.config.text.color);
|
|
193
|
+
this.config.text.fontWeight = parseWeight(t.fontWeight || this.config.text.fontWeight);
|
|
194
|
+
this.config.text.fontStyle = parseStyle(t.fontStyle || this.config.text.fontStyle);
|
|
195
|
+
this.config.text.offset = arr2(t.offset, this.config.text.offset);
|
|
196
|
+
this.config.text.align = clampAlign(t.align || this.config.text.align);
|
|
197
|
+
this.config.text.spacing = num(t.spacing, this.config.text.spacing);
|
|
198
|
+
this.config.text.bgUrl = typeof t.bgUrl === 'string' ? sanitizeUrl(t.bgUrl) : this.config.text.bgUrl;
|
|
199
|
+
this.config.text.hsl = arr3(t.hsl, this.config.text.hsl).slice(0, 3);
|
|
200
|
+
var ns = t.bgNineSlice || {};
|
|
201
|
+
this.config.text.bgNineSlice.enabled = typeof ns.enabled === 'boolean' ? ns.enabled : this.config.text.bgNineSlice.enabled;
|
|
202
|
+
this.config.text.bgNineSlice.slice = arr4(ns.slice || t.bgSlice, this.config.text.bgNineSlice.slice);
|
|
203
|
+
this.config.text.bgNineSlice.width = arr4(ns.width || t.bgSlice, this.config.text.bgNineSlice.width);
|
|
204
|
+
this.config.text.bgNineSlice.repeat = rep(ns.repeat || this.config.text.bgNineSlice.repeat);
|
|
205
|
+
this.config.text.bgNineSlice.fill = typeof ns.fill === 'boolean' ? ns.fill : this.config.text.bgNineSlice.fill;
|
|
206
|
+
this.config.text.bgNineSlice.radius = num(ns.radius, this.config.text.bgNineSlice.radius);
|
|
207
|
+
this.config.content.visible = typeof c.visible === 'boolean' ? c.visible : this.config.content.visible;
|
|
208
|
+
this.config.content.value = typeof c.value === 'string' ? c.value : this.config.content.value;
|
|
209
|
+
this.config.content.fontSize = num(c.fontSize, this.config.content.fontSize);
|
|
210
|
+
this.config.content.color = color(c.color, this.config.content.color);
|
|
211
|
+
this.config.content.fontWeight = parseWeight(c.fontWeight || this.config.content.fontWeight);
|
|
212
|
+
this.config.content.fontStyle = parseStyle(c.fontStyle || this.config.content.fontStyle);
|
|
213
|
+
this.config.content.align = clampAlign(c.align || this.config.content.align);
|
|
214
|
+
this.config.content.offset = arr2(c.offset, this.config.content.offset);
|
|
215
|
+
this.config.content.spacing = num(c.spacing, this.config.content.spacing);
|
|
216
|
+
// 支持数值或数组。数值作为统一倍数,数组作为非均匀倍数
|
|
217
|
+
if (Array.isArray(cfg.scale) && cfg.scale.length === 3) {
|
|
218
|
+
var sx = num(cfg.scale[0], this.config.userScale3[0]);
|
|
219
|
+
var sy = num(cfg.scale[1], this.config.userScale3[1]);
|
|
220
|
+
var sz = num(cfg.scale[2], this.config.userScale3[2]);
|
|
221
|
+
this.config.userScale3 = [sx, sy, sz];
|
|
222
|
+
} else {
|
|
223
|
+
var s = num(cfg.scale, this.config.scale);
|
|
224
|
+
// 用户缩放因子:仅作为乘数,不参与单位换算
|
|
225
|
+
this.config.scale = s > 0 ? s : this.config.scale;
|
|
226
|
+
}
|
|
227
|
+
var bb = cfg.billboard || this.config.billboard;
|
|
228
|
+
this.config.billboard = bb === 'yaw' || bb === 'full' ? bb : 'none';
|
|
229
|
+
// 面板尺寸可通过 cfg.size 指定,否则使用默认尺寸
|
|
230
|
+
this.config.size = arr2(cfg.size, this.config.size);
|
|
231
|
+
// 屏幕像素锁定
|
|
232
|
+
this.config.pixelLock = !!(typeof cfg.pixelLock === 'boolean' ? cfg.pixelLock : this.config.pixelLock);
|
|
233
|
+
// 面板锚点
|
|
234
|
+
var ac = cfg.anchor || this.config.anchor;
|
|
235
|
+
this.config.anchor = ac === 'top' || ac === 'center' || ac === 'bottom' ? ac : 'bottom';
|
|
200
236
|
}
|
|
201
|
-
const bb = cfg.billboard || this.config.billboard;
|
|
202
|
-
this.config.billboard = bb === 'yaw' || bb === 'full' ? bb : 'none';
|
|
203
|
-
// 面板尺寸可通过 cfg.size 指定,否则使用默认尺寸
|
|
204
|
-
this.config.size = arr2(cfg.size, this.config.size);
|
|
205
|
-
// 屏幕像素锁定
|
|
206
|
-
this.config.pixelLock = !!(typeof cfg.pixelLock === 'boolean' ? cfg.pixelLock : this.config.pixelLock);
|
|
207
|
-
// 面板锚点
|
|
208
|
-
const ac = cfg.anchor || this.config.anchor;
|
|
209
|
-
this.config.anchor = ac === 'top' || ac === 'center' || ac === 'bottom' ? ac : 'bottom';
|
|
210
|
-
}
|
|
211
237
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
* 设置面板世界旋转(欧拉角,单位:弧度)。
|
|
221
|
-
*/
|
|
222
|
-
setRotation(x, y, z) {
|
|
223
|
-
this._cssObject.rotation.set(x, y, z);
|
|
224
|
-
}
|
|
238
|
+
/**
|
|
239
|
+
* 设置面板世界坐标(应用到 CSS3DObject)。
|
|
240
|
+
*/
|
|
241
|
+
}, {
|
|
242
|
+
key: "setPosition",
|
|
243
|
+
value: function setPosition(x, y, z) {
|
|
244
|
+
this._cssObject.position.set(x, y, z);
|
|
245
|
+
}
|
|
225
246
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
247
|
+
/**
|
|
248
|
+
* 设置面板世界旋转(欧拉角,单位:弧度)。
|
|
249
|
+
*/
|
|
250
|
+
}, {
|
|
251
|
+
key: "setRotation",
|
|
252
|
+
value: function setRotation(x, y, z) {
|
|
253
|
+
this._cssObject.rotation.set(x, y, z);
|
|
254
|
+
}
|
|
233
255
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
256
|
+
/**
|
|
257
|
+
* 设置统一缩放因子(立即应用到 CSS3DObject)。
|
|
258
|
+
* 注意:若使用 `updateDynamicScale`,每帧会覆盖此值。
|
|
259
|
+
*/
|
|
260
|
+
}, {
|
|
261
|
+
key: "setScale",
|
|
262
|
+
value: function setScale(s) {
|
|
263
|
+
this._cssObject.scale.setScalar(s);
|
|
264
|
+
}
|
|
242
265
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
266
|
+
/**
|
|
267
|
+
* 设置看板模式。
|
|
268
|
+
* @param mode 'none' | 'yaw' | 'full'
|
|
269
|
+
*/
|
|
270
|
+
}, {
|
|
271
|
+
key: "setBillboard",
|
|
272
|
+
value: function setBillboard(mode) {
|
|
273
|
+
var m = mode === 'yaw' || mode === 'full' ? mode : 'none';
|
|
274
|
+
this.config.billboard = m;
|
|
275
|
+
}
|
|
250
276
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
setStyles(this.container, {
|
|
260
|
-
display: 'inline-block',
|
|
261
|
-
boxSizing: 'border-box',
|
|
262
|
-
transformOrigin: 'center center',
|
|
263
|
-
backgroundRepeat: 'no-repeat',
|
|
264
|
-
backgroundPosition: 'center',
|
|
265
|
-
backfaceVisibility: 'hidden',
|
|
266
|
-
padding: '8px'
|
|
267
|
-
});
|
|
268
|
-
// 最小像素尺寸(默认 320x180,可通过 cfg.size 覆盖),容器尺寸随内容自适应
|
|
269
|
-
const [pxW, pxH] = this.config.size;
|
|
270
|
-
setStyles(this.container, {
|
|
271
|
-
width: '',
|
|
272
|
-
height: '',
|
|
273
|
-
minWidth: `${pxW}px`,
|
|
274
|
-
minHeight: `${pxH}px`
|
|
275
|
-
});
|
|
276
|
-
// 根据锚点设置内部包裹的定位与偏移(默认 top:以左上角为参考)
|
|
277
|
-
if (this.config.anchor === 'top') {
|
|
278
|
-
this.innerWrap.style.left = '0';
|
|
279
|
-
this.innerWrap.style.top = '0';
|
|
280
|
-
this.innerWrap.style.bottom = 'auto';
|
|
281
|
-
this.innerWrap.style.transform = 'none';
|
|
282
|
-
} else if (this.config.anchor === 'center') {
|
|
283
|
-
this.innerWrap.style.left = '50%';
|
|
284
|
-
this.innerWrap.style.top = '50%';
|
|
285
|
-
this.innerWrap.style.bottom = 'auto';
|
|
286
|
-
this.innerWrap.style.transform = 'translate(-50%, -50%)';
|
|
287
|
-
} else {
|
|
288
|
-
// bottom
|
|
289
|
-
this.innerWrap.style.left = '0';
|
|
290
|
-
this.innerWrap.style.top = 'auto';
|
|
291
|
-
this.innerWrap.style.bottom = '0';
|
|
292
|
-
this.innerWrap.style.transform = 'none';
|
|
277
|
+
/**
|
|
278
|
+
* 设置可见性。
|
|
279
|
+
* @param v 是否可见
|
|
280
|
+
*/
|
|
281
|
+
}, {
|
|
282
|
+
key: "setVisible",
|
|
283
|
+
value: function setVisible(v) {
|
|
284
|
+
this._cssObject.visible = !!v;
|
|
293
285
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* 应用所有样式与文本到 DOM。
|
|
289
|
+
* 仅影响面板的排版与外观,不涉及 3D 变换。
|
|
290
|
+
*/
|
|
291
|
+
}, {
|
|
292
|
+
key: "applyStyle",
|
|
293
|
+
value: function applyStyle() {
|
|
294
|
+
var t = this.config.text;
|
|
295
|
+
var c = this.config.content;
|
|
296
|
+
// 基础容器样式,确保可见尺寸与居中锚点
|
|
297
|
+
setStyles(this.container, {
|
|
298
|
+
display: 'inline-block',
|
|
299
|
+
boxSizing: 'border-box',
|
|
300
|
+
transformOrigin: 'center center',
|
|
301
|
+
backgroundRepeat: 'no-repeat',
|
|
302
|
+
backgroundPosition: 'center',
|
|
303
|
+
backfaceVisibility: 'hidden',
|
|
304
|
+
padding: '8px'
|
|
305
|
+
});
|
|
306
|
+
// 最小像素尺寸(默认 320x180,可通过 cfg.size 覆盖),容器尺寸随内容自适应
|
|
307
|
+
var _this$config$size = _slicedToArray(this.config.size, 2),
|
|
308
|
+
pxW = _this$config$size[0],
|
|
309
|
+
pxH = _this$config$size[1];
|
|
310
|
+
setStyles(this.container, {
|
|
311
|
+
width: '',
|
|
312
|
+
height: '',
|
|
313
|
+
minWidth: "".concat(pxW, "px"),
|
|
314
|
+
minHeight: "".concat(pxH, "px")
|
|
315
|
+
});
|
|
316
|
+
// 根据锚点设置内部包裹的定位与偏移(默认 top:以左上角为参考)
|
|
317
|
+
if (this.config.anchor === 'top') {
|
|
318
|
+
this.innerWrap.style.left = '0';
|
|
319
|
+
this.innerWrap.style.top = '0';
|
|
320
|
+
this.innerWrap.style.bottom = 'auto';
|
|
321
|
+
this.innerWrap.style.transform = 'none';
|
|
322
|
+
} else if (this.config.anchor === 'center') {
|
|
323
|
+
this.innerWrap.style.left = '50%';
|
|
324
|
+
this.innerWrap.style.top = '50%';
|
|
325
|
+
this.innerWrap.style.bottom = 'auto';
|
|
326
|
+
this.innerWrap.style.transform = 'translate(-50%, -50%)';
|
|
327
|
+
} else {
|
|
328
|
+
// bottom
|
|
329
|
+
this.innerWrap.style.left = '0';
|
|
330
|
+
this.innerWrap.style.top = 'auto';
|
|
331
|
+
this.innerWrap.style.bottom = '0';
|
|
332
|
+
this.innerWrap.style.transform = 'none';
|
|
333
|
+
}
|
|
334
|
+
this.titleEl.textContent = t.value || '';
|
|
335
|
+
setStyles(this.titleEl, {
|
|
336
|
+
fontSize: "".concat(t.fontSize, "px"),
|
|
337
|
+
color: t.color,
|
|
338
|
+
fontWeight: t.fontWeight,
|
|
339
|
+
fontStyle: t.fontStyle,
|
|
340
|
+
textAlign: t.align,
|
|
341
|
+
letterSpacing: "".concat(num(t.spacing), "px"),
|
|
342
|
+
whiteSpace: 'nowrap',
|
|
343
|
+
overflow: 'hidden',
|
|
344
|
+
textOverflow: 'ellipsis',
|
|
345
|
+
marginLeft: "".concat(num(t.offset[0]), "px"),
|
|
346
|
+
marginTop: "".concat(num(t.offset[1]), "px")
|
|
347
|
+
});
|
|
348
|
+
this.contentEl.style.display = c.visible ? 'block' : 'none';
|
|
349
|
+
this.contentEl.textContent = c.value || '';
|
|
350
|
+
setStyles(this.contentEl, {
|
|
351
|
+
fontSize: "".concat(c.fontSize, "px"),
|
|
352
|
+
color: c.color,
|
|
353
|
+
fontWeight: c.fontWeight,
|
|
354
|
+
fontStyle: c.fontStyle,
|
|
355
|
+
textAlign: c.align,
|
|
356
|
+
letterSpacing: "".concat(num(c.spacing), "px"),
|
|
357
|
+
whiteSpace: 'pre-wrap',
|
|
358
|
+
wordBreak: 'break-word',
|
|
359
|
+
overflow: 'visible',
|
|
360
|
+
textOverflow: 'clip',
|
|
361
|
+
marginLeft: "".concat(num(c.offset[0]), "px"),
|
|
362
|
+
marginTop: "".concat(num(c.offset[1]), "px")
|
|
363
|
+
});
|
|
364
|
+
var hasBgUrl = typeof t.bgUrl === 'string' && t.bgUrl.length > 0;
|
|
365
|
+
if (hasBgUrl) {
|
|
366
|
+
if (t.bgNineSlice && t.bgNineSlice.enabled) {
|
|
367
|
+
var s = t.bgNineSlice.slice;
|
|
368
|
+
var w = t.bgNineSlice.width;
|
|
369
|
+
// 厚度限制,避免边框厚度超过容器尺寸导致异常视觉放大
|
|
370
|
+
var wClamped = [Math.min(w[0], pxH * 0.5), Math.min(w[1], pxW * 0.5), Math.min(w[2], pxH * 0.5), Math.min(w[3], pxW * 0.5)];
|
|
371
|
+
setStyles(this.container, {
|
|
372
|
+
borderStyle: 'solid',
|
|
373
|
+
borderWidth: "".concat(wClamped[0], "px ").concat(wClamped[1], "px ").concat(wClamped[2], "px ").concat(wClamped[3], "px"),
|
|
374
|
+
borderImageSource: "url(".concat(t.bgUrl, ")"),
|
|
375
|
+
borderImageSlice: "".concat(s[0], " ").concat(s[1], " ").concat(s[2], " ").concat(s[3]).concat(t.bgNineSlice.fill ? ' fill' : ''),
|
|
376
|
+
borderImageRepeat: t.bgNineSlice.repeat,
|
|
377
|
+
backgroundImage: 'none',
|
|
378
|
+
borderRadius: "".concat(num(t.bgNineSlice.radius, 0), "px")
|
|
379
|
+
});
|
|
380
|
+
} else {
|
|
381
|
+
setStyles(this.container, {
|
|
382
|
+
backgroundImage: "url(".concat(t.bgUrl, ")"),
|
|
383
|
+
borderImageSource: 'none',
|
|
384
|
+
borderImageSlice: '',
|
|
385
|
+
borderImageRepeat: '',
|
|
386
|
+
borderStyle: 'none',
|
|
387
|
+
borderWidth: '0px'
|
|
388
|
+
});
|
|
389
|
+
}
|
|
340
390
|
} else {
|
|
341
391
|
setStyles(this.container, {
|
|
342
|
-
backgroundImage:
|
|
392
|
+
backgroundImage: 'none',
|
|
343
393
|
borderImageSource: 'none',
|
|
344
394
|
borderImageSlice: '',
|
|
345
395
|
borderImageRepeat: '',
|
|
@@ -347,128 +397,136 @@ export default class InfoPanel extends ObjectLayer {
|
|
|
347
397
|
borderWidth: '0px'
|
|
348
398
|
});
|
|
349
399
|
}
|
|
350
|
-
|
|
400
|
+
// 背景填充整个容器尺寸
|
|
351
401
|
setStyles(this.container, {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
borderStyle: 'none',
|
|
357
|
-
borderWidth: '0px'
|
|
402
|
+
backgroundSize: '100% 100%',
|
|
403
|
+
textAlign: t.align,
|
|
404
|
+
pointerEvents: 'auto',
|
|
405
|
+
filter: "hue-rotate(".concat(num(t.hsl[0], 0), "deg) saturate(").concat(num(t.hsl[1], 0), "%) brightness(").concat(num(t.hsl[2], 0), "%)")
|
|
358
406
|
});
|
|
359
407
|
}
|
|
360
|
-
// 背景填充整个容器尺寸
|
|
361
|
-
setStyles(this.container, {
|
|
362
|
-
backgroundSize: '100% 100%',
|
|
363
|
-
textAlign: t.align,
|
|
364
|
-
pointerEvents: 'auto',
|
|
365
|
-
filter: `hue-rotate(${num(t.hsl[0], 0)}deg) saturate(${num(t.hsl[1], 0)}%) brightness(${num(t.hsl[2], 0)}%)`
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
408
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
409
|
+
/**
|
|
410
|
+
* 更新配置并立即重新应用到 DOM。
|
|
411
|
+
* @param cfg 新配置
|
|
412
|
+
*/
|
|
413
|
+
}, {
|
|
414
|
+
key: "update",
|
|
415
|
+
value: function update() {
|
|
416
|
+
var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
417
|
+
this.updateConfig(cfg);
|
|
418
|
+
this.applyStyle();
|
|
419
|
+
}
|
|
377
420
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
421
|
+
/**
|
|
422
|
+
* 根据看板模式使面板朝向相机。
|
|
423
|
+
* - 'full':使用 `lookAt` 全方位朝向相机。
|
|
424
|
+
* - 'yaw':仅绕 Y 轴旋转,保持水平面朝向相机。
|
|
425
|
+
* - 'none':不处理朝向。
|
|
426
|
+
* @param camera three.js 相机
|
|
427
|
+
*/
|
|
428
|
+
}, {
|
|
429
|
+
key: "updateFacing",
|
|
430
|
+
value: function updateFacing(camera) {
|
|
431
|
+
var mode = this.config.billboard;
|
|
432
|
+
if (mode === 'none') return;
|
|
433
|
+
var objPos = this._tmpObjPos;
|
|
434
|
+
var camPos = this._tmpCamPos;
|
|
435
|
+
this._cssObject.getWorldPosition(objPos);
|
|
436
|
+
camera.getWorldPosition(camPos);
|
|
437
|
+
if (mode === 'full') {
|
|
438
|
+
this._cssObject.lookAt(camPos);
|
|
439
|
+
} else if (mode === 'yaw') {
|
|
440
|
+
var dx = camPos.x - objPos.x;
|
|
441
|
+
var dz = camPos.z - objPos.z;
|
|
442
|
+
var yaw = Math.atan2(dx, dz);
|
|
443
|
+
this._cssObject.rotation.set(0, yaw, 0);
|
|
444
|
+
}
|
|
399
445
|
}
|
|
400
|
-
}
|
|
401
446
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
447
|
+
/**
|
|
448
|
+
* 动态缩放:根据相机 FOV、沿相机前向的距离 d、视口尺寸,
|
|
449
|
+
* 计算“每像素对应的世界单位”,并结合用户缩放得到最终缩放。
|
|
450
|
+
* - pixelLock: s = worldPerPixelX * userScale
|
|
451
|
+
* - 非锁定: s = userScale
|
|
452
|
+
* - 最终各轴缩放: [sx, sy, sz] = s * userScale3
|
|
453
|
+
*/
|
|
454
|
+
}, {
|
|
455
|
+
key: "updateDynamicScale",
|
|
456
|
+
value: function updateDynamicScale(camera) {
|
|
457
|
+
var viewportWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.innerWidth;
|
|
458
|
+
var viewportHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.innerHeight;
|
|
459
|
+
if (!camera) return;
|
|
460
|
+
var objPos = this._tmpObjPos;
|
|
461
|
+
var camPos = this._tmpCamPos;
|
|
462
|
+
var camDir = this._tmpCamDir;
|
|
463
|
+
this._cssObject.getWorldPosition(objPos);
|
|
464
|
+
camera.getWorldPosition(camPos);
|
|
465
|
+
camera.getWorldDirection(camDir);
|
|
466
|
+
var d = objPos.clone().sub(camPos).dot(camDir);
|
|
467
|
+
var fovRad = MathUtils.degToRad(camera.fov);
|
|
468
|
+
var worldPerPixelY = 2 * d * Math.tan(fovRad / 2) / viewportHeight;
|
|
469
|
+
var worldPerPixelX = worldPerPixelY * camera.aspect;
|
|
470
|
+
var userScale = this.config.scale;
|
|
471
|
+
var userScale3 = this.config.userScale3 || [1, 1, 1];
|
|
472
|
+
// pixel-lock:保持屏幕像素尺寸恒定;非锁定:使用统一用户系数
|
|
473
|
+
var s = this.config.pixelLock ? worldPerPixelX * (userScale > 0 ? userScale : 1) : userScale > 0 ? userScale : 1;
|
|
474
|
+
if (!Number.isFinite(s) || s <= 0) return;
|
|
475
|
+
// 简单限幅,避免极端相机参数造成缩放异常
|
|
476
|
+
var MAX_S = 1e3;
|
|
477
|
+
var MIN_S = 1e-6;
|
|
478
|
+
s = Math.max(Math.min(s, MAX_S), MIN_S);
|
|
479
|
+
var sx = s * (userScale3[0] || 1);
|
|
480
|
+
var sy = s * (userScale3[1] || 1);
|
|
481
|
+
var sz = s * (userScale3[2] || 1);
|
|
482
|
+
this._cssObject.scale.set(sx, sy, sz);
|
|
483
|
+
}
|
|
435
484
|
|
|
436
|
-
|
|
485
|
+
// 移除父级缩放抵消,面板可响应外部实体缩放(含非均匀)
|
|
437
486
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
487
|
+
/**
|
|
488
|
+
* 释放面板:从场景移除 CSS3DObject,并清理 DOM。
|
|
489
|
+
*/
|
|
490
|
+
}, {
|
|
491
|
+
key: "dispose",
|
|
492
|
+
value: function dispose() {
|
|
493
|
+
if (this._cssObject.parent) this._cssObject.parent.remove(this._cssObject);
|
|
494
|
+
this.container.remove();
|
|
495
|
+
}
|
|
445
496
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
497
|
+
/**
|
|
498
|
+
* 获取当前面板在世界坐标中的宽高(单位:世界单位)。
|
|
499
|
+
* 注意:结果受相机参数、面板到相机的距离以及当前 `_cssObject.scale` 影响。
|
|
500
|
+
* @param camera three.js 相机
|
|
501
|
+
* @param viewportWidth 视口宽度(像素)
|
|
502
|
+
* @param viewportHeight 视口高度(像素)
|
|
503
|
+
* @returns `{ width, height }` 世界单位
|
|
504
|
+
*/
|
|
505
|
+
}, {
|
|
506
|
+
key: "getWorldSize",
|
|
507
|
+
value: function getWorldSize(camera) {
|
|
508
|
+
var viewportWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.innerWidth;
|
|
509
|
+
var viewportHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.innerHeight;
|
|
510
|
+
var objPos = this._tmpObjPos;
|
|
511
|
+
var camPos = this._tmpCamPos;
|
|
512
|
+
var camDir = this._tmpCamDir;
|
|
513
|
+
this._cssObject.getWorldPosition(objPos);
|
|
514
|
+
camera.getWorldPosition(camPos);
|
|
515
|
+
camera.getWorldDirection(camDir);
|
|
516
|
+
var d = objPos.clone().sub(camPos).dot(camDir);
|
|
517
|
+
var fovRad = MathUtils.degToRad(camera.fov);
|
|
518
|
+
var worldPerPixelY = 2 * d * Math.tan(fovRad / 2) / viewportHeight;
|
|
519
|
+
var worldPerPixelX = worldPerPixelY * camera.aspect;
|
|
520
|
+
var wpx = this.container.offsetWidth || 0;
|
|
521
|
+
var hpx = this.container.offsetHeight || 0;
|
|
522
|
+
var s = this._cssObject.scale.x;
|
|
523
|
+
return {
|
|
524
|
+
width: wpx * worldPerPixelX * s,
|
|
525
|
+
height: hpx * worldPerPixelY * s
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}]);
|
|
529
|
+
return InfoPanel;
|
|
530
|
+
}(ObjectLayer);
|
|
531
|
+
export { InfoPanel as default };
|
|
474
532
|
//# sourceMappingURL=index.js.map
|