@anov/3d-ability 0.0.139 → 0.0.141

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.
Files changed (265) hide show
  1. package/dist/business/Animation/motion/index.js +35 -56
  2. package/dist/business/Animation/motion/index.js.map +1 -1
  3. package/dist/business/Animation/type.js +2 -2
  4. package/dist/business/Area/Fence/FenceBase.js +146 -187
  5. package/dist/business/Area/Fence/FenceBase.js.map +1 -1
  6. package/dist/business/Area/Fence/fence_base_01.js +120 -112
  7. package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
  8. package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
  9. package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
  10. package/dist/business/Area/Fence/fence_roll_01.js +140 -130
  11. package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
  12. package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
  13. package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
  14. package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
  15. package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
  16. package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
  17. package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
  18. package/dist/business/Area/index.js +267 -483
  19. package/dist/business/Area/index.js.map +1 -1
  20. package/dist/business/Area/tool.js +14 -26
  21. package/dist/business/Area/tool.js.map +1 -1
  22. package/dist/business/Base/ObjectLayer.js +21 -46
  23. package/dist/business/Base/ObjectLayer.js.map +1 -1
  24. package/dist/business/Batch/index.js +189 -234
  25. package/dist/business/Batch/index.js.map +1 -1
  26. package/dist/business/Box/index.js +52 -81
  27. package/dist/business/Box/index.js.map +1 -1
  28. package/dist/business/Cylinder/index.js +51 -79
  29. package/dist/business/Cylinder/index.js.map +1 -1
  30. package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
  31. package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
  32. package/dist/business/Flyline/bubble/index.js +7 -21
  33. package/dist/business/Flyline/bubble/index.js.map +1 -1
  34. package/dist/business/Flyline/index.js +96 -162
  35. package/dist/business/Flyline/index.js.map +1 -1
  36. package/dist/business/Flyline/line/ArcLine.js +208 -291
  37. package/dist/business/Flyline/line/ArcLine.js.map +1 -1
  38. package/dist/business/Flyline/line/index.js +8 -22
  39. package/dist/business/Flyline/line/index.js.map +1 -1
  40. package/dist/business/HeatMap/HeatMap.js +380 -467
  41. package/dist/business/HeatMap/HeatMap.js.map +1 -1
  42. package/dist/business/HeatMap/core.js +405 -525
  43. package/dist/business/HeatMap/core.js.map +1 -1
  44. package/dist/business/HeatMap/shader.js +69 -3
  45. package/dist/business/HeatMap/shader.js.map +1 -1
  46. package/dist/business/InfoPanel/index.js +201 -242
  47. package/dist/business/InfoPanel/index.js.map +1 -1
  48. package/dist/business/Line/index.js +55 -88
  49. package/dist/business/Line/index.js.map +1 -1
  50. package/dist/business/Mark/KeyframeAnimation.js +145 -176
  51. package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
  52. package/dist/business/Mark/index.js +196 -294
  53. package/dist/business/Mark/index.js.map +1 -1
  54. package/dist/business/Mark/shader/tanhao.js +36 -3
  55. package/dist/business/Mark/shader/tanhao.js.map +1 -1
  56. package/dist/business/Mark/type.js +1 -1
  57. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +377 -551
  58. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
  59. package/dist/business/MaterialSwitch/inject.js +92 -58
  60. package/dist/business/MaterialSwitch/inject.js.map +1 -1
  61. package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
  62. package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
  63. package/dist/business/MaterialSwitch/shader/ground.js +95 -16
  64. package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
  65. package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
  66. package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
  67. package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
  68. package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
  69. package/dist/business/Plane/index.js +51 -78
  70. package/dist/business/Plane/index.js.map +1 -1
  71. package/dist/business/Poi/index.d.ts +5 -0
  72. package/dist/business/Poi/index.js +256 -295
  73. package/dist/business/Poi/index.js.map +1 -1
  74. package/dist/business/Poi/link/Cylinder.js +56 -89
  75. package/dist/business/Poi/link/Cylinder.js.map +1 -1
  76. package/dist/business/Poi/link/Pyramid.js +104 -165
  77. package/dist/business/Poi/link/Pyramid.js.map +1 -1
  78. package/dist/business/Poi/link/index.d.ts +1 -1
  79. package/dist/business/Poi/link/index.js +54 -114
  80. package/dist/business/Poi/link/index.js.map +1 -1
  81. package/dist/business/Poi/panel/index.d.ts +124 -0
  82. package/dist/business/Poi/panel/index.js +474 -0
  83. package/dist/business/Poi/panel/index.js.map +1 -0
  84. package/dist/business/Poi/panel/interfaces.d.ts +67 -0
  85. package/dist/business/Poi/panel/interfaces.js +2 -0
  86. package/dist/business/Poi/panel/interfaces.js.map +1 -0
  87. package/dist/business/Poi/panel/utils.d.ts +72 -0
  88. package/dist/business/Poi/panel/utils.js +126 -0
  89. package/dist/business/Poi/panel/utils.js.map +1 -0
  90. package/dist/business/Poi/particle/DoubleCircle.js +71 -107
  91. package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
  92. package/dist/business/Poi/particle/DynamicCircle.js +75 -111
  93. package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
  94. package/dist/business/Poi/particle/SingleCircle.js +62 -98
  95. package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
  96. package/dist/business/Poi/particle/index.js +49 -117
  97. package/dist/business/Poi/particle/index.js.map +1 -1
  98. package/dist/business/Poi/shader/circle.js +31 -3
  99. package/dist/business/Poi/shader/circle.js.map +1 -1
  100. package/dist/business/Poi/shader/cylinder.js +37 -3
  101. package/dist/business/Poi/shader/cylinder.js.map +1 -1
  102. package/dist/business/Poi/shader/doubleCircle.js +55 -3
  103. package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
  104. package/dist/business/Poi/shader/dynamicCircle.js +67 -3
  105. package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
  106. package/dist/business/Poi/title/Border.js +7 -27
  107. package/dist/business/Poi/title/Border.js.map +1 -1
  108. package/dist/business/Poi/title/Ellipse.js +7 -27
  109. package/dist/business/Poi/title/Ellipse.js.map +1 -1
  110. package/dist/business/Poi/title/index.js +208 -292
  111. package/dist/business/Poi/title/index.js.map +1 -1
  112. package/dist/business/Poi/tools.js +22 -19
  113. package/dist/business/Poi/tools.js.map +1 -1
  114. package/dist/business/Poi/types.d.ts +3 -0
  115. package/dist/business/Poi/types.js.map +1 -1
  116. package/dist/business/Sphere/index.js +47 -72
  117. package/dist/business/Sphere/index.js.map +1 -1
  118. package/dist/business/Spline/index.js +190 -245
  119. package/dist/business/Spline/index.js.map +1 -1
  120. package/dist/business/SplitBuilding/index.js +327 -536
  121. package/dist/business/SplitBuilding/index.js.map +1 -1
  122. package/dist/business/SplitBuilding/type.js +2 -2
  123. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
  124. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
  125. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
  126. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
  127. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
  128. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
  129. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
  130. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
  131. package/dist/business/TrafficComponents/base.js +32 -55
  132. package/dist/business/TrafficComponents/base.js.map +1 -1
  133. package/dist/business/TrafficComponents/utils.js +25 -24
  134. package/dist/business/TrafficComponents/utils.js.map +1 -1
  135. package/dist/business/Utils/Curve.js +40 -56
  136. package/dist/business/Utils/Curve.js.map +1 -1
  137. package/dist/business/Utils/constant.js +1 -1
  138. package/dist/business/Utils/constant.js.map +1 -1
  139. package/dist/business/Utils/defineProps.js +13 -14
  140. package/dist/business/Utils/defineProps.js.map +1 -1
  141. package/dist/business/Utils/round-curve.js +127 -153
  142. package/dist/business/Utils/round-curve.js.map +1 -1
  143. package/dist/business/VideoPanel/index.js +258 -319
  144. package/dist/business/VideoPanel/index.js.map +1 -1
  145. package/dist/business/Water/index.js +78 -108
  146. package/dist/business/Water/index.js.map +1 -1
  147. package/dist/business/Water/types.js +1 -1
  148. package/dist/business/Water/types.js.map +1 -1
  149. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
  150. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
  151. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
  152. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
  153. package/dist/core/Controls/FirstViewControl/index.js +84 -96
  154. package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
  155. package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
  156. package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
  157. package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
  158. package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
  159. package/dist/core/Controls/ThirdViewControl/index.js +19 -28
  160. package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
  161. package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
  162. package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
  163. package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
  164. package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
  165. package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
  166. package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
  167. package/dist/core/Controls/ThirdViewControl/player.js +66 -91
  168. package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
  169. package/dist/core/Controls/base.js +14 -30
  170. package/dist/core/Controls/base.js.map +1 -1
  171. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
  172. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
  173. package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
  174. package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
  175. package/dist/core/Light/PointLight/PointLightExt.js +4 -21
  176. package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
  177. package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
  178. package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
  179. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
  180. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
  181. package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
  182. package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
  183. package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
  184. package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
  185. package/dist/core/Material/SurfaceMaterial/index.js +76 -172
  186. package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
  187. package/dist/core/Material/decorators.js +6 -11
  188. package/dist/core/Material/decorators.js.map +1 -1
  189. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
  190. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
  191. package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
  192. package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
  193. package/dist/core/PostEffects/bloomPass.js +17 -10
  194. package/dist/core/PostEffects/bloomPass.js.map +1 -1
  195. package/dist/core/PostEffects/bloomSelect.js +60 -43
  196. package/dist/core/PostEffects/bloomSelect.js.map +1 -1
  197. package/dist/core/PostEffects/colorifyPass.js +17 -13
  198. package/dist/core/PostEffects/colorifyPass.js.map +1 -1
  199. package/dist/core/PostEffects/index.js +28 -22
  200. package/dist/core/PostEffects/index.js.map +1 -1
  201. package/dist/core/PostEffects/outlinePass.js +37 -50
  202. package/dist/core/PostEffects/outlinePass.js.map +1 -1
  203. package/dist/core/PostEffects/postprocessing.js +14 -12
  204. package/dist/core/PostEffects/postprocessing.js.map +1 -1
  205. package/dist/core/PostEffects/saoPass.js +15 -10
  206. package/dist/core/PostEffects/saoPass.js.map +1 -1
  207. package/dist/core/PostEffects/shader/colorify.js +22 -3
  208. package/dist/core/PostEffects/shader/colorify.js.map +1 -1
  209. package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
  210. package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
  211. package/dist/core/PostEffects/shader/mapping.js +66 -3
  212. package/dist/core/PostEffects/shader/mapping.js.map +1 -1
  213. package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
  214. package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
  215. package/dist/core/SceneEffect/grow/grow.js +85 -101
  216. package/dist/core/SceneEffect/grow/grow.js.map +1 -1
  217. package/dist/core/SceneEffect/grow/style_down.js +60 -77
  218. package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
  219. package/dist/core/SceneEffect/grow/style_up.js +64 -81
  220. package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
  221. package/dist/core/SceneEffect/grow/type.js +2 -2
  222. package/dist/core/SceneEffect/grow/type.js.map +1 -1
  223. package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
  224. package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
  225. package/dist/core/WeatherSystem/hdr/index.js +69 -105
  226. package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
  227. package/dist/core/WeatherSystem/index.js +77 -124
  228. package/dist/core/WeatherSystem/index.js.map +1 -1
  229. package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
  230. package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
  231. package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
  232. package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
  233. package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
  234. package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
  235. package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
  236. package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
  237. package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
  238. package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
  239. package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
  240. package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
  241. package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
  242. package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
  243. package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
  244. package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
  245. package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
  246. package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
  247. package/dist/core/WeatherSystem/shaders/fog.js +103 -3
  248. package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
  249. package/dist/core/WeatherSystem/shaders/rain.js +206 -7
  250. package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
  251. package/dist/core/WeatherSystem/shaders/sky.js +87 -3
  252. package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
  253. package/dist/core/WeatherSystem/sky/index.js +104 -135
  254. package/dist/core/WeatherSystem/sky/index.js.map +1 -1
  255. package/dist/core/WeatherSystem/utils/constant.js +44 -38
  256. package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
  257. package/dist/core/WeatherSystem/utils/math.js +18 -25
  258. package/dist/core/WeatherSystem/utils/math.js.map +1 -1
  259. package/dist/core/WeatherSystem/utils/type.js +1 -1
  260. package/dist/core/WeatherSystem/utils/type.js.map +1 -1
  261. package/dist/core/WeatherSystem/weather/index.js +96 -141
  262. package/dist/core/WeatherSystem/weather/index.js.map +1 -1
  263. package/dist/utils/index.js +1 -1
  264. package/dist/utils/index.js.map +1 -1
  265. package/package.json +3 -3
@@ -1,593 +1,384 @@
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
- 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); }
4
- 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; }
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
- 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); } }
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
- 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); }
9
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
- 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); }; }
11
- 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); }
12
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
- 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; } }
14
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
1
  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; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
- 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); }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
+ 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); }
18
4
  import { Vector3 } from '@anov/3d-core';
19
5
  import ObjectLayer from "../Base/ObjectLayer";
20
6
  import { EBuildingSplitType, EDirection } from "./type";
21
- var BuildingSplit = /*#__PURE__*/function (_ObjectLayer) {
22
- _inherits(BuildingSplit, _ObjectLayer);
23
- var _super = _createSuper(BuildingSplit);
24
- function BuildingSplit(building) {
25
- var _this;
26
- _classCallCheck(this, BuildingSplit);
27
- _this = _super.call(this);
28
- _defineProperty(_assertThisInitialized(_this), "floorGroups", new Map());
29
- _defineProperty(_assertThisInitialized(_this), "sortedFloorLevels", []);
30
- _defineProperty(_assertThisInitialized(_this), "aboveGroundFloorCount", 0);
31
- _defineProperty(_assertThisInitialized(_this), "undergroundFloorCount", 0);
32
- _defineProperty(_assertThisInitialized(_this), "hasRoof", false);
33
- _defineProperty(_assertThisInitialized(_this), "currentAnimation", {
7
+ class BuildingSplit extends ObjectLayer {
8
+ constructor(building) {
9
+ super();
10
+ _defineProperty(this, "floorGroups", new Map());
11
+ _defineProperty(this, "sortedFloorLevels", []);
12
+ _defineProperty(this, "aboveGroundFloorCount", 0);
13
+ _defineProperty(this, "undergroundFloorCount", 0);
14
+ _defineProperty(this, "hasRoof", false);
15
+ _defineProperty(this, "currentAnimation", {
34
16
  timer: null
35
17
  });
36
- _defineProperty(_assertThisInitialized(_this), "_building", void 0);
37
- _this._building = building;
38
- _this.init();
39
- return _this;
18
+ _defineProperty(this, "_building", void 0);
19
+ this._building = building;
20
+ this.init();
21
+ }
22
+ get building() {
23
+ return this._building;
40
24
  }
41
- _createClass(BuildingSplit, [{
42
- key: "building",
43
- get: function get() {
44
- return this._building;
45
- }
46
25
 
47
- /**
48
- * 初始化建筑拆分器
49
- * @param building 建筑模型
50
- */
51
- }, {
52
- key: "init",
53
- value: function init() {
54
- this.floorGroups = new Map();
55
- this.sortedFloorLevels = [];
56
- this.aboveGroundFloorCount = 0;
57
- this.undergroundFloorCount = 0;
58
- this.hasRoof = false;
26
+ /**
27
+ * 初始化建筑拆分器
28
+ * @param building 建筑模型
29
+ */
30
+ init() {
31
+ this.floorGroups = new Map();
32
+ this.sortedFloorLevels = [];
33
+ this.aboveGroundFloorCount = 0;
34
+ this.undergroundFloorCount = 0;
35
+ this.hasRoof = false;
59
36
 
60
- // 解析所有楼层
61
- this.parseFloors();
37
+ // 解析所有楼层
38
+ this.parseFloors();
62
39
 
63
- // 排序楼层编号从低到高
64
- this.sortedFloorLevels = Array.from(this.floorGroups.values()).map(function (group) {
65
- return group.level;
66
- }).sort(function (a, b) {
67
- return a - b;
68
- });
69
- }
40
+ // 排序楼层编号从低到高
41
+ this.sortedFloorLevels = Array.from(this.floorGroups.values()).map(group => group.level).sort((a, b) => a - b);
42
+ }
70
43
 
71
- /**
72
- * 解析建筑模型中的楼层
73
- */
74
- }, {
75
- key: "parseFloors",
76
- value: function parseFloors() {
77
- var _this2 = this;
78
- this.building.traverse(function (object) {
79
- if (object.type === 'Mesh' || object.type === 'Group') {
80
- var name = object.name;
81
- // 检查是否为屋顶
82
- if (name.startsWith('Roof')) {
83
- _this2.addToFloorGroup('Roof', {
84
- mesh: object,
85
- originalPosition: object.position.clone(),
86
- originalVisibility: object.visible
87
- });
88
- _this2.hasRoof = true;
89
- return;
90
- }
44
+ /**
45
+ * 解析建筑模型中的楼层
46
+ */
47
+ parseFloors() {
48
+ this.building.traverse(object => {
49
+ if (object.type === 'Mesh' || object.type === 'Group') {
50
+ const name = object.name;
51
+ // 检查是否为屋顶
52
+ if (name.startsWith('Roof')) {
53
+ this.addToFloorGroup('Roof', {
54
+ mesh: object,
55
+ originalPosition: object.position.clone(),
56
+ originalVisibility: object.visible
57
+ });
58
+ this.hasRoof = true;
59
+ return;
60
+ }
91
61
 
92
- // 提取楼层前缀
93
- var prefix = null;
94
- var level = 0;
95
- var isUnderground = false;
96
- if (name.startsWith('F') && name.length >= 3) {
97
- // 地上楼层
98
- var floorNum = parseInt(name.substring(1, 3));
99
- if (!isNaN(floorNum)) {
100
- prefix = "F".concat(name.substring(1, 3));
101
- level = floorNum;
102
- isUnderground = false;
103
- _this2.aboveGroundFloorCount = Math.max(_this2.aboveGroundFloorCount, floorNum);
104
- }
105
- } else if (name.startsWith('B') && name.length >= 3) {
106
- // 地下楼层
107
- var _floorNum = parseInt(name.substring(1, 3));
108
- if (!isNaN(_floorNum)) {
109
- prefix = "B".concat(name.substring(1, 3));
110
- level = -_floorNum;
111
- isUnderground = true;
112
- _this2.undergroundFloorCount = Math.max(_this2.undergroundFloorCount, _floorNum);
113
- }
62
+ // 提取楼层前缀
63
+ let prefix = null;
64
+ let level = 0;
65
+ let isUnderground = false;
66
+ if (name.startsWith('F') && name.length >= 3) {
67
+ // 地上楼层
68
+ const floorNum = parseInt(name.substring(1, 3));
69
+ if (!isNaN(floorNum)) {
70
+ prefix = `F${name.substring(1, 3)}`;
71
+ level = floorNum;
72
+ isUnderground = false;
73
+ this.aboveGroundFloorCount = Math.max(this.aboveGroundFloorCount, floorNum);
114
74
  }
115
- if (prefix) {
116
- _this2.addToFloorGroup(prefix, {
117
- mesh: object,
118
- originalPosition: object.position.clone(),
119
- originalVisibility: object.visible
120
- }, level, isUnderground);
75
+ } else if (name.startsWith('B') && name.length >= 3) {
76
+ // 地下楼层
77
+ const floorNum = parseInt(name.substring(1, 3));
78
+ if (!isNaN(floorNum)) {
79
+ prefix = `B${name.substring(1, 3)}`;
80
+ level = -floorNum;
81
+ isUnderground = true;
82
+ this.undergroundFloorCount = Math.max(this.undergroundFloorCount, floorNum);
121
83
  }
122
84
  }
85
+ if (prefix) {
86
+ this.addToFloorGroup(prefix, {
87
+ mesh: object,
88
+ originalPosition: object.position.clone(),
89
+ originalVisibility: object.visible
90
+ }, level, isUnderground);
91
+ }
92
+ }
93
+ });
94
+ }
95
+
96
+ /**
97
+ * 将组件添加到对应楼层分组
98
+ */
99
+ addToFloorGroup(prefix, component, level = this.aboveGroundFloorCount + 1, isUnderground = false) {
100
+ var _this$floorGroups$get;
101
+ if (!this.floorGroups.has(prefix)) {
102
+ this.floorGroups.set(prefix, {
103
+ level,
104
+ isUnderground,
105
+ isRoof: prefix === 'Roof',
106
+ components: []
123
107
  });
124
108
  }
109
+ (_this$floorGroups$get = this.floorGroups.get(prefix)) === null || _this$floorGroups$get === void 0 || _this$floorGroups$get.components.push(component);
110
+ }
125
111
 
126
- /**
127
- * 将组件添加到对应楼层分组
128
- */
129
- }, {
130
- key: "addToFloorGroup",
131
- value: function addToFloorGroup(prefix, component) {
132
- var _this$floorGroups$get;
133
- var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.aboveGroundFloorCount + 1;
134
- var isUnderground = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
135
- if (!this.floorGroups.has(prefix)) {
136
- this.floorGroups.set(prefix, {
137
- level: level,
138
- isUnderground: isUnderground,
139
- isRoof: prefix === 'Roof',
140
- components: []
141
- });
142
- }
143
- (_this$floorGroups$get = this.floorGroups.get(prefix)) === null || _this$floorGroups$get === void 0 || _this$floorGroups$get.components.push(component);
112
+ /**
113
+ * 拆分楼层
114
+ * @param options 拆分选项
115
+ * @returns 成功或错误信息
116
+ */
117
+ split(options) {
118
+ const {
119
+ floor,
120
+ animation
121
+ } = options;
122
+ const animOption = animation || {
123
+ type: EBuildingSplitType.Move,
124
+ duration: 1000
125
+ };
126
+
127
+ // 取消当前动画
128
+ if (this.currentAnimation.timer !== null) {
129
+ window.clearTimeout(this.currentAnimation.timer);
130
+ this.currentAnimation.timer = null;
144
131
  }
145
132
 
146
- /**
147
- * 拆分楼层
148
- * @param options 拆分选项
149
- * @returns 成功或错误信息
150
- */
151
- }, {
152
- key: "split",
153
- value: function split(options) {
154
- var floor = options.floor,
155
- animation = options.animation;
156
- var animOption = animation || {
157
- type: EBuildingSplitType.Move,
158
- duration: 1000
133
+ // 处理 floor = 0 的情况:恢复完整状态
134
+ if (floor === 0) {
135
+ this.resetBuilding();
136
+ return {
137
+ success: true
159
138
  };
139
+ }
160
140
 
161
- // 取消当前动画
162
- if (this.currentAnimation.timer !== null) {
163
- window.clearTimeout(this.currentAnimation.timer);
164
- this.currentAnimation.timer = null;
165
- }
166
-
167
- // 处理 floor = 0 的情况:恢复完整状态
168
- if (floor === 0) {
169
- this.resetBuilding();
170
- return {
171
- success: true
172
- };
173
- }
174
-
175
- // 验证楼层参数
176
- if (floor > 0 && floor > this.aboveGroundFloorCount) {
177
- return {
178
- success: false,
179
- message: "\u5730\u4E0A\u697C\u5C42\u6570\u8D85\u51FA\u8303\u56F4\uFF0C\u6700\u5927\u697C\u5C42\u4E3A ".concat(this.aboveGroundFloorCount)
180
- };
181
- }
182
- if (floor < 0 && Math.abs(floor) > this.undergroundFloorCount) {
183
- return {
184
- success: false,
185
- message: "\u5730\u4E0B\u697C\u5C42\u6570\u8D85\u51FA\u8303\u56F4\uFF0C\u6700\u5927\u5730\u4E0B\u697C\u5C42\u4E3A ".concat(this.undergroundFloorCount)
186
- };
187
- }
188
-
189
- // 执行拆分操作
190
- switch (animOption.type) {
191
- case EBuildingSplitType.Hide:
192
- this.hideAboveFloors(floor);
193
- break;
194
- case EBuildingSplitType.Move:
195
- this.moveAboveFloorsDirection(floor, animOption);
196
- break;
197
- case EBuildingSplitType.Solo:
198
- this.showSoloFloor(floor);
199
- break;
200
- }
141
+ // 验证楼层参数
142
+ if (floor > 0 && floor > this.aboveGroundFloorCount) {
201
143
  return {
202
- success: true
144
+ success: false,
145
+ message: `地上楼层数超出范围,最大楼层为 ${this.aboveGroundFloorCount}`
146
+ };
147
+ }
148
+ if (floor < 0 && Math.abs(floor) > this.undergroundFloorCount) {
149
+ return {
150
+ success: false,
151
+ message: `地下楼层数超出范围,最大地下楼层为 ${this.undergroundFloorCount}`
203
152
  };
204
153
  }
205
154
 
206
- /**
207
- * 隐藏指定楼层以上的楼层
208
- * @param targetFloor 目标楼层
209
- */
210
- }, {
211
- key: "hideAboveFloors",
212
- value: function hideAboveFloors(targetFloor) {
213
- var _iterator = _createForOfIteratorHelper(this.floorGroups.values()),
214
- _step;
215
- try {
216
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
217
- var floorGroup = _step.value;
218
- var floorLevel = floorGroup.level;
155
+ // 执行拆分操作
156
+ switch (animOption.type) {
157
+ case EBuildingSplitType.Hide:
158
+ this.hideAboveFloors(floor);
159
+ break;
160
+ case EBuildingSplitType.Move:
161
+ this.moveAboveFloorsDirection(floor, animOption);
162
+ break;
163
+ case EBuildingSplitType.Solo:
164
+ this.showSoloFloor(floor);
165
+ break;
166
+ }
167
+ return {
168
+ success: true
169
+ };
170
+ }
219
171
 
220
- // 重置所有楼层组件位置
221
- var _iterator2 = _createForOfIteratorHelper(floorGroup.components),
222
- _step2;
223
- try {
224
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
225
- var component = _step2.value;
226
- component.mesh.position.copy(component.originalPosition);
227
- }
172
+ /**
173
+ * 隐藏指定楼层以上的楼层
174
+ * @param targetFloor 目标楼层
175
+ */
176
+ hideAboveFloors(targetFloor) {
177
+ for (const floorGroup of this.floorGroups.values()) {
178
+ const floorLevel = floorGroup.level;
228
179
 
229
- // 设置可见性
230
- } catch (err) {
231
- _iterator2.e(err);
232
- } finally {
233
- _iterator2.f();
234
- }
235
- var shouldBeVisible = floorLevel <= targetFloor;
236
- var _iterator3 = _createForOfIteratorHelper(floorGroup.components),
237
- _step3;
238
- try {
239
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
240
- var _component = _step3.value;
241
- _component.mesh.visible = shouldBeVisible;
242
- }
243
- } catch (err) {
244
- _iterator3.e(err);
245
- } finally {
246
- _iterator3.f();
247
- }
248
- }
249
- } catch (err) {
250
- _iterator.e(err);
251
- } finally {
252
- _iterator.f();
253
- }
180
+ // 重置所有楼层组件位置
181
+ for (const component of floorGroup.components) component.mesh.position.copy(component.originalPosition);
182
+
183
+ // 设置可见性
184
+ const shouldBeVisible = floorLevel <= targetFloor;
185
+ for (const component of floorGroup.components) component.mesh.visible = shouldBeVisible;
254
186
  }
187
+ }
255
188
 
256
- /**
257
- * 将指定楼层以上的楼层整体上移
258
- * @param targetFloor 目标楼层
259
- * @param animation 动画选项
260
- */
261
- }, {
262
- key: "moveAboveFloorsUp",
263
- value: function moveAboveFloorsUp(targetFloor, animation) {
264
- var distance = 10;
265
- var duration = animation.duration;
189
+ /**
190
+ * 将指定楼层以上的楼层整体上移
191
+ * @param targetFloor 目标楼层
192
+ * @param animation 动画选项
193
+ */
194
+ moveAboveFloorsUp(targetFloor, animation) {
195
+ const distance = 10;
196
+ const duration = animation.duration;
266
197
 
267
- // 重置所有楼层可见性
268
- var _iterator4 = _createForOfIteratorHelper(this.floorGroups.values()),
269
- _step4;
270
- try {
271
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
272
- var floorGroup = _step4.value;
273
- var _iterator6 = _createForOfIteratorHelper(floorGroup.components),
274
- _step6;
275
- try {
276
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
277
- var component = _step6.value;
278
- component.mesh.visible = true;
279
- }
280
- } catch (err) {
281
- _iterator6.e(err);
282
- } finally {
283
- _iterator6.f();
284
- }
285
- }
198
+ // 重置所有楼层可见性
199
+ for (const floorGroup of this.floorGroups.values()) {
200
+ for (const component of floorGroup.components) component.mesh.visible = true;
201
+ }
286
202
 
287
- // 计算起始位置和目标位置
288
- } catch (err) {
289
- _iterator4.e(err);
290
- } finally {
291
- _iterator4.f();
292
- }
293
- var startPositions = new Map();
294
- var targetPositions = new Map();
295
- var _iterator5 = _createForOfIteratorHelper(this.floorGroups.values()),
296
- _step5;
297
- try {
298
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
299
- var _floorGroup = _step5.value;
300
- var floorLevel = _floorGroup.level;
301
- var _iterator7 = _createForOfIteratorHelper(_floorGroup.components),
302
- _step7;
303
- try {
304
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
305
- var _component2 = _step7.value;
306
- startPositions.set(_component2.mesh, _component2.mesh.position.clone());
307
- if (floorLevel > targetFloor) {
308
- // 上方楼层需要上移
309
- var targetPos = _component2.originalPosition.clone();
310
- targetPos.y += distance;
311
- targetPositions.set(_component2.mesh, targetPos);
312
- } else {
313
- // 其他楼层保持原位
314
- targetPositions.set(_component2.mesh, _component2.originalPosition.clone());
315
- }
316
- }
317
- } catch (err) {
318
- _iterator7.e(err);
319
- } finally {
320
- _iterator7.f();
321
- }
203
+ // 计算起始位置和目标位置
204
+ const startPositions = new Map();
205
+ const targetPositions = new Map();
206
+ for (const floorGroup of this.floorGroups.values()) {
207
+ const floorLevel = floorGroup.level;
208
+ for (const component of floorGroup.components) {
209
+ startPositions.set(component.mesh, component.mesh.position.clone());
210
+ if (floorLevel > targetFloor) {
211
+ // 上方楼层需要上移
212
+ const targetPos = component.originalPosition.clone();
213
+ targetPos.y += distance;
214
+ targetPositions.set(component.mesh, targetPos);
215
+ } else {
216
+ // 其他楼层保持原位
217
+ targetPositions.set(component.mesh, component.originalPosition.clone());
322
218
  }
323
-
324
- // 执行动画
325
- } catch (err) {
326
- _iterator5.e(err);
327
- } finally {
328
- _iterator5.f();
329
219
  }
330
- this.animatePositions(startPositions, targetPositions, duration);
331
220
  }
332
221
 
333
- /**
334
- * 将指定楼层以上的楼层向指定方向移动
335
- * @param targetFloor 目标楼层
336
- * @param animation 动画选项
337
- */
338
- }, {
339
- key: "moveAboveFloorsDirection",
340
- value: function moveAboveFloorsDirection(targetFloor, animation) {
341
- var _ref = animation.rule || {},
342
- _ref$direction = _ref.direction,
343
- direction = _ref$direction === void 0 ? [10, 10, 0] : _ref$direction;
344
- var duration = animation.duration;
222
+ // 执行动画
223
+ this.animatePositions(startPositions, targetPositions, duration);
224
+ }
345
225
 
346
- // 重置所有楼层可见性
347
- var _iterator8 = _createForOfIteratorHelper(this.floorGroups.values()),
348
- _step8;
349
- try {
350
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
351
- var floorGroup = _step8.value;
352
- var _iterator10 = _createForOfIteratorHelper(floorGroup.components),
353
- _step10;
354
- try {
355
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
356
- var component = _step10.value;
357
- component.mesh.visible = true;
358
- }
359
- } catch (err) {
360
- _iterator10.e(err);
361
- } finally {
362
- _iterator10.f();
363
- }
364
- }
226
+ /**
227
+ * 将指定楼层以上的楼层向指定方向移动
228
+ * @param targetFloor 目标楼层
229
+ * @param animation 动画选项
230
+ */
231
+ moveAboveFloorsDirection(targetFloor, animation) {
232
+ const {
233
+ direction = [10, 10, 0]
234
+ } = animation.rule || {};
235
+ const duration = animation.duration;
365
236
 
366
- // 计算起始位置和目标位置
367
- } catch (err) {
368
- _iterator8.e(err);
369
- } finally {
370
- _iterator8.f();
371
- }
372
- var startPositions = new Map();
373
- var targetPositions = new Map();
374
- var _iterator9 = _createForOfIteratorHelper(this.floorGroups.values()),
375
- _step9;
376
- try {
377
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
378
- var _floorGroup2 = _step9.value;
379
- var floorLevel = _floorGroup2.level;
380
- var _iterator11 = _createForOfIteratorHelper(_floorGroup2.components),
381
- _step11;
382
- try {
383
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
384
- var _component3 = _step11.value;
385
- startPositions.set(_component3.mesh, _component3.mesh.position.clone());
386
- if (floorLevel > targetFloor) {
387
- // 上方楼层需要移动
388
- var targetPos = _component3.originalPosition.clone().add(new Vector3().fromArray(direction));
389
- targetPositions.set(_component3.mesh, targetPos);
390
- } else {
391
- // 其他楼层保持原位
392
- targetPositions.set(_component3.mesh, _component3.originalPosition.clone());
393
- }
394
- }
395
- } catch (err) {
396
- _iterator11.e(err);
397
- } finally {
398
- _iterator11.f();
399
- }
400
- }
237
+ // 重置所有楼层可见性
238
+ for (const floorGroup of this.floorGroups.values()) {
239
+ for (const component of floorGroup.components) component.mesh.visible = true;
240
+ }
401
241
 
402
- // 执行动画
403
- } catch (err) {
404
- _iterator9.e(err);
405
- } finally {
406
- _iterator9.f();
242
+ // 计算起始位置和目标位置
243
+ const startPositions = new Map();
244
+ const targetPositions = new Map();
245
+ for (const floorGroup of this.floorGroups.values()) {
246
+ const floorLevel = floorGroup.level;
247
+ for (const component of floorGroup.components) {
248
+ startPositions.set(component.mesh, component.mesh.position.clone());
249
+ if (floorLevel > targetFloor) {
250
+ // 上方楼层需要移动
251
+ const targetPos = component.originalPosition.clone().add(new Vector3().fromArray(direction));
252
+ targetPositions.set(component.mesh, targetPos);
253
+ } else {
254
+ // 其他楼层保持原位
255
+ targetPositions.set(component.mesh, component.originalPosition.clone());
256
+ }
407
257
  }
408
- this.animatePositions(startPositions, targetPositions, duration);
409
258
  }
410
259
 
411
- /**
412
- * 计算方向向量
413
- * 规则:往右方(X)、前方(Z)是正、往左方(X)、后方(Z)是负数
414
- * @param direction 方向枚举
415
- * @param distance 移动距离
416
- * @returns Vector3 方向向量
417
- */
418
- }, {
419
- key: "getDirectionVector",
420
- value: function getDirectionVector(direction, distance) {
421
- var vector = new Vector3(0, 0, 0);
422
- var coefficient = 0.7071; // cos(45°) ≈ 0.7071
423
- switch (direction) {
424
- case EDirection.Right:
425
- vector.set(distance, 0, 0);
426
- break;
427
- case EDirection.Left:
428
- vector.set(-distance, 0, 0);
429
- break;
430
- case EDirection.Front:
431
- vector.set(0, 0, distance);
432
- break;
433
- case EDirection.Back:
434
- vector.set(0, 0, -distance);
435
- break;
436
- case EDirection.Right_Front:
437
- vector.set(distance * coefficient, distance * coefficient, distance * coefficient);
438
- break;
439
- case EDirection.Left_Front:
440
- vector.set(-distance * coefficient, distance * coefficient, distance * coefficient);
441
- break;
442
- case EDirection.Right_Back:
443
- vector.set(distance * coefficient, distance * coefficient, -distance * coefficient);
444
- break;
445
- case EDirection.Left_Back:
446
- vector.set(-distance * coefficient, distance * coefficient, -distance * coefficient);
447
- break;
448
- default:
449
- // 默认向右移动
450
- vector.set(distance, 0, 0);
451
- }
452
- return vector;
260
+ // 执行动画
261
+ this.animatePositions(startPositions, targetPositions, duration);
262
+ }
263
+
264
+ /**
265
+ * 计算方向向量
266
+ * 规则:往右方(X)、前方(Z)是正、往左方(X)、后方(Z)是负数
267
+ * @param direction 方向枚举
268
+ * @param distance 移动距离
269
+ * @returns Vector3 方向向量
270
+ */
271
+ getDirectionVector(direction, distance) {
272
+ const vector = new Vector3(0, 0, 0);
273
+ const coefficient = 0.7071; // cos(45°) ≈ 0.7071
274
+ switch (direction) {
275
+ case EDirection.Right:
276
+ vector.set(distance, 0, 0);
277
+ break;
278
+ case EDirection.Left:
279
+ vector.set(-distance, 0, 0);
280
+ break;
281
+ case EDirection.Front:
282
+ vector.set(0, 0, distance);
283
+ break;
284
+ case EDirection.Back:
285
+ vector.set(0, 0, -distance);
286
+ break;
287
+ case EDirection.Right_Front:
288
+ vector.set(distance * coefficient, distance * coefficient, distance * coefficient);
289
+ break;
290
+ case EDirection.Left_Front:
291
+ vector.set(-distance * coefficient, distance * coefficient, distance * coefficient);
292
+ break;
293
+ case EDirection.Right_Back:
294
+ vector.set(distance * coefficient, distance * coefficient, -distance * coefficient);
295
+ break;
296
+ case EDirection.Left_Back:
297
+ vector.set(-distance * coefficient, distance * coefficient, -distance * coefficient);
298
+ break;
299
+ default:
300
+ // 默认向右移动
301
+ vector.set(distance, 0, 0);
453
302
  }
303
+ return vector;
304
+ }
454
305
 
455
- /**
456
- * 只显示指定楼层
457
- * @param targetFloor 目标楼层
458
- */
459
- }, {
460
- key: "showSoloFloor",
461
- value: function showSoloFloor(targetFloor) {
462
- var _iterator12 = _createForOfIteratorHelper(this.floorGroups.values()),
463
- _step12;
464
- try {
465
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
466
- var floorGroup = _step12.value;
467
- var floorLevel = floorGroup.level;
306
+ /**
307
+ * 只显示指定楼层
308
+ * @param targetFloor 目标楼层
309
+ */
310
+ showSoloFloor(targetFloor) {
311
+ for (const floorGroup of this.floorGroups.values()) {
312
+ const floorLevel = floorGroup.level;
468
313
 
469
- // 重置所有楼层组件位置
470
- var _iterator13 = _createForOfIteratorHelper(floorGroup.components),
471
- _step13;
472
- try {
473
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
474
- var component = _step13.value;
475
- component.mesh.position.copy(component.originalPosition);
476
- }
314
+ // 重置所有楼层组件位置
315
+ for (const component of floorGroup.components) component.mesh.position.copy(component.originalPosition);
477
316
 
478
- // 设置可见性
479
- } catch (err) {
480
- _iterator13.e(err);
481
- } finally {
482
- _iterator13.f();
483
- }
484
- var shouldBeVisible = floorLevel === targetFloor;
485
- var _iterator14 = _createForOfIteratorHelper(floorGroup.components),
486
- _step14;
487
- try {
488
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
489
- var _component4 = _step14.value;
490
- _component4.mesh.visible = shouldBeVisible;
491
- }
492
- } catch (err) {
493
- _iterator14.e(err);
494
- } finally {
495
- _iterator14.f();
496
- }
497
- }
498
- } catch (err) {
499
- _iterator12.e(err);
500
- } finally {
501
- _iterator12.f();
502
- }
317
+ // 设置可见性
318
+ const shouldBeVisible = floorLevel === targetFloor;
319
+ for (const component of floorGroup.components) component.mesh.visible = shouldBeVisible;
503
320
  }
321
+ }
504
322
 
505
- /**
506
- * 执行位置动画
507
- * @param startPositions 起始位置
508
- * @param targetPositions 目标位置
509
- * @param duration 动画时长
510
- */
511
- }, {
512
- key: "animatePositions",
513
- value: function animatePositions(startPositions, targetPositions, duration) {
514
- var _this3 = this;
515
- var startTime = performance.now();
516
- var animate = function animate() {
517
- var currentTime = performance.now();
518
- var elapsed = currentTime - startTime;
519
- var progress = Math.min(elapsed / duration, 1);
520
- targetPositions.forEach(function (targetPos, mesh) {
521
- var startPos = startPositions.get(mesh);
522
- if (startPos) {
523
- // 线性插值计算当前位置
524
- mesh.position.lerpVectors(startPos, targetPos, progress);
525
- }
526
- });
527
- if (progress < 1) {
528
- requestAnimationFrame(animate);
529
- } else {
530
- // 动画结束
531
- _this3.currentAnimation.timer = null;
323
+ /**
324
+ * 执行位置动画
325
+ * @param startPositions 起始位置
326
+ * @param targetPositions 目标位置
327
+ * @param duration 动画时长
328
+ */
329
+ animatePositions(startPositions, targetPositions, duration) {
330
+ const startTime = performance.now();
331
+ const animate = () => {
332
+ const currentTime = performance.now();
333
+ const elapsed = currentTime - startTime;
334
+ const progress = Math.min(elapsed / duration, 1);
335
+ targetPositions.forEach((targetPos, mesh) => {
336
+ const startPos = startPositions.get(mesh);
337
+ if (startPos) {
338
+ // 线性插值计算当前位置
339
+ mesh.position.lerpVectors(startPos, targetPos, progress);
532
340
  }
533
- };
534
- animate();
341
+ });
342
+ if (progress < 1) {
343
+ requestAnimationFrame(animate);
344
+ } else {
345
+ // 动画结束
346
+ this.currentAnimation.timer = null;
347
+ }
348
+ };
349
+ animate();
535
350
 
536
- // 设置超时以确保动画完成
537
- this.currentAnimation.timer = window.setTimeout(function () {
538
- _this3.currentAnimation.timer = null;
539
- }, duration + 100);
540
- }
351
+ // 设置超时以确保动画完成
352
+ this.currentAnimation.timer = window.setTimeout(() => {
353
+ this.currentAnimation.timer = null;
354
+ }, duration + 100);
355
+ }
541
356
 
542
- /**
543
- * 重置建筑到初始状态
544
- */
545
- }, {
546
- key: "resetBuilding",
547
- value: function resetBuilding() {
548
- var _iterator15 = _createForOfIteratorHelper(this.floorGroups.values()),
549
- _step15;
550
- try {
551
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
552
- var floorGroup = _step15.value;
553
- var _iterator16 = _createForOfIteratorHelper(floorGroup.components),
554
- _step16;
555
- try {
556
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
557
- var component = _step16.value;
558
- // 恢复原始位置
559
- component.mesh.position.copy(component.originalPosition);
357
+ /**
358
+ * 重置建筑到初始状态
359
+ */
360
+ resetBuilding() {
361
+ for (const floorGroup of this.floorGroups.values()) {
362
+ for (const component of floorGroup.components) {
363
+ // 恢复原始位置
364
+ component.mesh.position.copy(component.originalPosition);
560
365
 
561
- // 恢复原始可见性
562
- component.mesh.visible = component.originalVisibility;
563
- }
564
- } catch (err) {
565
- _iterator16.e(err);
566
- } finally {
567
- _iterator16.f();
568
- }
569
- }
570
- } catch (err) {
571
- _iterator15.e(err);
572
- } finally {
573
- _iterator15.f();
366
+ // 恢复原始可见性
367
+ component.mesh.visible = component.originalVisibility;
574
368
  }
575
369
  }
370
+ }
576
371
 
577
- /**
578
- * 获取楼层总数信息
579
- */
580
- }, {
581
- key: "getFloorCounts",
582
- value: function getFloorCounts() {
583
- return {
584
- aboveGround: this.aboveGroundFloorCount,
585
- underground: this.undergroundFloorCount,
586
- hasRoof: this.hasRoof
587
- };
588
- }
589
- }]);
590
- return BuildingSplit;
591
- }(ObjectLayer);
372
+ /**
373
+ * 获取楼层总数信息
374
+ */
375
+ getFloorCounts() {
376
+ return {
377
+ aboveGround: this.aboveGroundFloorCount,
378
+ underground: this.undergroundFloorCount,
379
+ hasRoof: this.hasRoof
380
+ };
381
+ }
382
+ }
592
383
  export { BuildingSplit, EBuildingSplitType };
593
384
  //# sourceMappingURL=index.js.map