@realsee/dnalogel 2.0.0-alpha.48 → 2.0.0-alpha.50

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 (411) hide show
  1. package/dist/CSS3DRenderPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  2. package/dist/CSS3DRenderPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  3. package/dist/CSS3DRenderPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  4. package/dist/CSS3DRenderPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  5. package/dist/CSS3DRenderPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  6. package/dist/CSS3DRenderPlugin/floorplan/index.d.ts +2 -1
  7. package/dist/CameraMovementPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  8. package/dist/CameraMovementPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  9. package/dist/CameraMovementPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  10. package/dist/CameraMovementPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  11. package/dist/CameraMovementPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  12. package/dist/CameraMovementPlugin/floorplan/index.d.ts +2 -1
  13. package/dist/ItemLabelPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  14. package/dist/ItemLabelPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  15. package/dist/ItemLabelPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  16. package/dist/ItemLabelPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  17. package/dist/ItemLabelPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  18. package/dist/ItemLabelPlugin/floorplan/index.d.ts +2 -1
  19. package/dist/ModelChassisCompassPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  20. package/dist/ModelChassisCompassPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  21. package/dist/ModelChassisCompassPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  22. package/dist/ModelChassisCompassPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  23. package/dist/ModelChassisCompassPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  24. package/dist/ModelChassisCompassPlugin/floorplan/index.d.ts +2 -1
  25. package/dist/ModelEntryDoorGuidePlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  26. package/dist/ModelEntryDoorGuidePlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  27. package/dist/ModelEntryDoorGuidePlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  28. package/dist/ModelEntryDoorGuidePlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  29. package/dist/ModelEntryDoorGuidePlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  30. package/dist/ModelEntryDoorGuidePlugin/floorplan/index.d.ts +2 -1
  31. package/dist/ModelItemLabelPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  32. package/dist/ModelItemLabelPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  33. package/dist/ModelItemLabelPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  34. package/dist/ModelItemLabelPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  35. package/dist/ModelItemLabelPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  36. package/dist/ModelItemLabelPlugin/floorplan/index.d.ts +2 -1
  37. package/dist/ModelRoomLabelPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  38. package/dist/ModelRoomLabelPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  39. package/dist/ModelRoomLabelPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  40. package/dist/ModelRoomLabelPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  41. package/dist/ModelRoomLabelPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  42. package/dist/ModelRoomLabelPlugin/floorplan/index.d.ts +2 -1
  43. package/dist/ModelTVVideoPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  44. package/dist/ModelTVVideoPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  45. package/dist/ModelTVVideoPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  46. package/dist/ModelTVVideoPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  47. package/dist/ModelTVVideoPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  48. package/dist/ModelTVVideoPlugin/floorplan/index.d.ts +2 -1
  49. package/dist/ModelTVVideoPlugin/index.js +2 -2
  50. package/dist/ModelViewPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  51. package/dist/ModelViewPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  52. package/dist/ModelViewPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  53. package/dist/ModelViewPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  54. package/dist/ModelViewPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  55. package/dist/ModelViewPlugin/floorplan/index.d.ts +2 -1
  56. package/dist/PanoCompassPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  57. package/dist/PanoCompassPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  58. package/dist/PanoCompassPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  59. package/dist/PanoCompassPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  60. package/dist/PanoCompassPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  61. package/dist/PanoCompassPlugin/floorplan/index.d.ts +2 -1
  62. package/dist/PanoCursorRaycasterPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  63. package/dist/PanoCursorRaycasterPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  64. package/dist/PanoCursorRaycasterPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  65. package/dist/PanoCursorRaycasterPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  66. package/dist/PanoCursorRaycasterPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  67. package/dist/PanoCursorRaycasterPlugin/floorplan/index.d.ts +2 -1
  68. package/dist/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  69. package/dist/PanoDoorLabelPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  70. package/dist/PanoDoorLabelPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  71. package/dist/PanoDoorLabelPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  72. package/dist/PanoDoorLabelPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  73. package/dist/PanoDoorLabelPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  74. package/dist/PanoDoorLabelPlugin/floorplan/index.d.ts +2 -1
  75. package/dist/PanoDoorLabelPlugin/index.js +7 -2
  76. package/dist/PanoDoorLabelPlugin/typings.d.ts +5 -0
  77. package/dist/PanoMeasurePlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  78. package/dist/PanoMeasurePlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  79. package/dist/PanoMeasurePlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  80. package/dist/PanoMeasurePlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  81. package/dist/PanoMeasurePlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  82. package/dist/PanoMeasurePlugin/floorplan/index.d.ts +2 -1
  83. package/dist/PanoRulerPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  84. package/dist/PanoRulerPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  85. package/dist/PanoRulerPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  86. package/dist/PanoRulerPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  87. package/dist/PanoRulerPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  88. package/dist/PanoRulerPlugin/floorplan/index.d.ts +2 -1
  89. package/dist/PanoRulerProPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  90. package/dist/PanoRulerProPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  91. package/dist/PanoRulerProPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  92. package/dist/PanoRulerProPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  93. package/dist/PanoRulerProPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  94. package/dist/PanoRulerProPlugin/floorplan/index.d.ts +2 -1
  95. package/dist/PanoSpatialTagPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  96. package/dist/PanoSpatialTagPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  97. package/dist/PanoSpatialTagPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  98. package/dist/PanoSpatialTagPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  99. package/dist/PanoSpatialTagPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  100. package/dist/PanoSpatialTagPlugin/floorplan/index.d.ts +2 -1
  101. package/dist/floorplan/MapviewFloorplanPlugin/CSS3DRenderPlugin/Plugin.d.ts +49 -0
  102. package/dist/floorplan/MapviewFloorplanPlugin/CSS3DRenderPlugin/index.d.ts +4 -0
  103. package/dist/floorplan/MapviewFloorplanPlugin/CSS3DRenderPlugin/utils/createResizeObserver.d.ts +7 -0
  104. package/dist/floorplan/MapviewFloorplanPlugin/CameraMovementPlugin/CameraMovementPlugin.d.ts +7 -0
  105. package/dist/floorplan/MapviewFloorplanPlugin/CameraMovementPlugin/index.d.ts +5 -0
  106. package/dist/floorplan/MapviewFloorplanPlugin/CameraMovementPlugin/typing.d.ts +68 -0
  107. package/dist/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  108. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/Plugin.d.ts +4 -0
  109. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/events.type.d.ts +9 -0
  110. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/index.d.ts +9 -0
  111. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/typings.d.ts +65 -0
  112. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
  113. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
  114. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
  115. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/utils/parseData.d.ts +3 -0
  116. package/dist/floorplan/MapviewFloorplanPlugin/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
  117. package/dist/floorplan/MapviewFloorplanPlugin/ModelChassisCompassPlugin/Plugin.d.ts +19 -0
  118. package/dist/floorplan/MapviewFloorplanPlugin/ModelChassisCompassPlugin/index.d.ts +4 -0
  119. package/dist/floorplan/MapviewFloorplanPlugin/ModelEntryDoorGuidePlugin/Plugin.d.ts +26 -0
  120. package/dist/floorplan/MapviewFloorplanPlugin/ModelEntryDoorGuidePlugin/index.d.ts +4 -0
  121. package/dist/floorplan/MapviewFloorplanPlugin/ModelItemLabelPlugin/ModelItemLabelPlugin.d.ts +4 -0
  122. package/dist/floorplan/MapviewFloorplanPlugin/ModelItemLabelPlugin/events.type.d.ts +9 -0
  123. package/dist/floorplan/MapviewFloorplanPlugin/ModelItemLabelPlugin/index.d.ts +9 -0
  124. package/dist/floorplan/MapviewFloorplanPlugin/ModelItemLabelPlugin/typings.d.ts +56 -0
  125. package/dist/floorplan/MapviewFloorplanPlugin/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  126. package/dist/floorplan/MapviewFloorplanPlugin/ModelRoomLabelPlugin/Assets/roomLabelBg.d.ts +1 -0
  127. package/dist/floorplan/MapviewFloorplanPlugin/ModelRoomLabelPlugin/Controller.d.ts +36 -0
  128. package/dist/floorplan/MapviewFloorplanPlugin/ModelRoomLabelPlugin/index.d.ts +12 -0
  129. package/dist/floorplan/MapviewFloorplanPlugin/ModelRoomLabelPlugin/typings.d.ts +35 -0
  130. package/dist/floorplan/MapviewFloorplanPlugin/ModelRoomLabelPlugin/utils/parseData.d.ts +3 -0
  131. package/dist/floorplan/MapviewFloorplanPlugin/ModelTVVideoPlugin/Plugin.d.ts +4 -0
  132. package/dist/floorplan/MapviewFloorplanPlugin/ModelTVVideoPlugin/index.d.ts +5 -0
  133. package/dist/floorplan/MapviewFloorplanPlugin/ModelTVVideoPlugin/typings.d.ts +25 -0
  134. package/dist/floorplan/MapviewFloorplanPlugin/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
  135. package/dist/floorplan/MapviewFloorplanPlugin/ModelViewPlugin/Plugin.d.ts +17 -0
  136. package/dist/floorplan/MapviewFloorplanPlugin/ModelViewPlugin/index.d.ts +4 -0
  137. package/dist/floorplan/MapviewFloorplanPlugin/PanoCompassPlugin/Assets/roomInfoIcon.d.ts +1 -0
  138. package/dist/floorplan/MapviewFloorplanPlugin/PanoCompassPlugin/Controller.d.ts +84 -0
  139. package/dist/floorplan/MapviewFloorplanPlugin/PanoCompassPlugin/getRoomInfoInstance.d.ts +8 -0
  140. package/dist/floorplan/MapviewFloorplanPlugin/PanoCompassPlugin/index.d.ts +7 -0
  141. package/dist/floorplan/MapviewFloorplanPlugin/PanoCompassPlugin/typings.d.ts +57 -0
  142. package/dist/floorplan/MapviewFloorplanPlugin/PanoCursorRaycasterPlugin/index.d.ts +48 -0
  143. package/dist/floorplan/MapviewFloorplanPlugin/PanoDoorLabelPlugin/BaseController.d.ts +60 -0
  144. package/dist/floorplan/MapviewFloorplanPlugin/PanoDoorLabelPlugin/Controller.d.ts +37 -0
  145. package/dist/floorplan/MapviewFloorplanPlugin/PanoDoorLabelPlugin/index.d.ts +7 -0
  146. package/dist/floorplan/MapviewFloorplanPlugin/PanoDoorLabelPlugin/typings.d.ts +38 -0
  147. package/dist/floorplan/MapviewFloorplanPlugin/PanoDoorLabelPlugin/utils.d.ts +5 -0
  148. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/BaseController.d.ts +39 -0
  149. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
  150. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
  151. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
  152. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/ViewController.d.ts +16 -0
  153. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/WatchController.d.ts +26 -0
  154. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Controller/index.d.ts +70 -0
  155. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Model/index.d.ts +38 -0
  156. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Model/line.d.ts +30 -0
  157. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Model/point.d.ts +16 -0
  158. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
  159. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
  160. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
  161. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
  162. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +25 -0
  163. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
  164. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
  165. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/Magnifier.d.ts +59 -0
  166. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +2 -0
  167. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +15 -0
  168. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +13 -0
  169. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/index.d.ts +20 -0
  170. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +4 -0
  171. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/mobileMainBtnController.d.ts +12 -0
  172. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/UIController/style.d.ts +16 -0
  173. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
  174. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +44 -0
  175. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/index.d.ts +10 -0
  176. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/typings/data.d.ts +37 -0
  177. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/typings/event.type.d.ts +37 -0
  178. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
  179. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
  180. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
  181. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/constants.d.ts +4 -0
  182. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
  183. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
  184. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
  185. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
  186. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
  187. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
  188. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
  189. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/line.d.ts +17 -0
  190. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/math.d.ts +17 -0
  191. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/mouseGroup.d.ts +7 -0
  192. package/dist/floorplan/MapviewFloorplanPlugin/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
  193. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerPlugin/Plugin.d.ts +31 -0
  194. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerPlugin/index.d.ts +5 -0
  195. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerPlugin/style.d.ts +2 -0
  196. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerPlugin/typings.d.ts +21 -0
  197. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerProPlugin/Controller.d.ts +15 -0
  198. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerProPlugin/index.d.ts +8 -0
  199. package/dist/floorplan/MapviewFloorplanPlugin/PanoRulerProPlugin/typings.d.ts +46 -0
  200. package/dist/floorplan/MapviewFloorplanPlugin/PanoSpatialTagPlugin/Plugin.d.ts +35 -0
  201. package/dist/floorplan/MapviewFloorplanPlugin/PanoSpatialTagPlugin/index.d.ts +5 -0
  202. package/dist/floorplan/MapviewFloorplanPlugin/PanoSpatialTagPlugin/store.d.ts +1 -0
  203. package/dist/floorplan/MapviewFloorplanPlugin/PanoSpatialTagPlugin/style.d.ts +1 -0
  204. package/dist/floorplan/MapviewFloorplanPlugin/PanoSpatialTagPlugin/typings.d.ts +40 -0
  205. package/dist/floorplan/MapviewFloorplanPlugin/base/BasePlugin.d.ts +100 -0
  206. package/dist/floorplan/MapviewFloorplanPlugin/base/BasePluginWithData.d.ts +34 -0
  207. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/Controller.d.ts +43 -0
  208. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/Subscribe.d.ts +76 -0
  209. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/index.d.ts +27 -0
  210. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/style.d.ts +2 -0
  211. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/tween.d.ts +62 -0
  212. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/typings.d.ts +58 -0
  213. package/dist/floorplan/MapviewFloorplanPlugin/components/PaintBrush/utils.d.ts +26 -0
  214. package/dist/floorplan/MapviewFloorplanPlugin/components/index.d.ts +2 -0
  215. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/Assets/camera.d.ts +1 -0
  216. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/Assets/compass.d.ts +1 -0
  217. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/Assets/floorplanExtraObject.d.ts +1 -0
  218. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  219. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  220. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  221. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/ModelFloorplanPlugin/Controller.d.ts +98 -0
  222. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/ModelFloorplanPlugin/index.d.ts +7 -0
  223. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
  224. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +36 -0
  225. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/PanoFloorplanRadarPlugin/index.d.ts +7 -0
  226. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
  227. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/TopviewFloorplanPlugin/Controller.d.ts +67 -0
  228. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/TopviewFloorplanPlugin/index.d.ts +7 -0
  229. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/TopviewFloorplanPlugin/style.d.ts +1 -0
  230. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
  231. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/constant.d.ts +5 -0
  232. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/index.d.ts +7 -0
  233. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/typings/floorplanData.d.ts +137 -0
  234. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/typings/floorplanServerData.d.ts +144 -0
  235. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/typings/utility.d.ts +2 -0
  236. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/utils/constant.d.ts +22 -0
  237. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/utils/correctFiveState.d.ts +15 -0
  238. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/utils/formatData.d.ts +5 -0
  239. package/dist/floorplan/MapviewFloorplanPlugin/floorplan/utils/formatPosition.d.ts +36 -0
  240. package/dist/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  241. package/dist/floorplan/MapviewFloorplanPlugin/index.js +4510 -0
  242. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/Preloader.d.ts +6 -0
  243. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/Subscribe.d.ts +45 -0
  244. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/animationFrame/BetterTween.d.ts +11 -0
  245. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/animationFrame/calculateProgress.d.ts +8 -0
  246. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/animationFrame/formatRad.d.ts +15 -0
  247. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/animationFrame/index.d.ts +15 -0
  248. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/animationFrame/tween.d.ts +75 -0
  249. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
  250. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/createCanvasTextTexture.d.ts +8 -0
  251. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/createLine/index.d.ts +3 -0
  252. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/debounce.d.ts +6 -0
  253. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/equal.d.ts +11 -0
  254. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/filter.d.ts +27 -0
  255. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/five/changeMode.d.ts +5 -0
  256. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/formatRad.d.ts +7 -0
  257. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/getPxmm.d.ts +19 -0
  258. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/getRandomColor.d.ts +1 -0
  259. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/index.d.ts +1 -0
  260. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/isNil.d.ts +10 -0
  261. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/isTruelyObject.d.ts +18 -0
  262. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/logger.d.ts +16 -0
  263. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/math/Interval.d.ts +13 -0
  264. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/math/Rectangle.d.ts +27 -0
  265. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/math/evenNumber.d.ts +3 -0
  266. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/math/index.d.ts +2 -0
  267. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/math/planimetry.d.ts +116 -0
  268. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/math/rad2Deg.d.ts +1 -0
  269. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/nearlyEqual.d.ts +7 -0
  270. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/nextFrame.d.ts +1 -0
  271. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/noop.d.ts +5 -0
  272. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/object3d2LocalMatrix.d.ts +12 -0
  273. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/px2rem.d.ts +1 -0
  274. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/removeArrayItem.d.ts +7 -0
  275. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/tap.d.ts +8 -0
  276. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/centerPoint.d.ts +2 -0
  277. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/getExtraModelLoader.d.ts +6 -0
  278. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/getNormal.d.ts +2 -0
  279. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/getTextureLoader.d.ts +6 -0
  280. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/loadFbxObj.d.ts +2 -0
  281. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/loadTexture.d.ts +2 -0
  282. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/transformPositionToVector3.d.ts +7 -0
  283. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/three/transfromToMeshBasicMaterial.d.ts +2 -0
  284. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/throttle.d.ts +7 -0
  285. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/tinyEJSrender.d.ts +5 -0
  286. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/to.d.ts +8 -0
  287. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/uuid.d.ts +5 -0
  288. package/dist/floorplan/MapviewFloorplanPlugin/shared-utils/vectorTocoordinates.d.ts +7 -0
  289. package/dist/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  290. package/dist/floorplan/MapviewFloorplanPlugin/typings/math.type.d.ts +44 -0
  291. package/dist/floorplan/MapviewFloorplanPlugin/typings/utils.type.d.ts +2 -0
  292. package/dist/floorplan/ModelFloorplanPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  293. package/dist/floorplan/ModelFloorplanPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  294. package/dist/floorplan/ModelFloorplanPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  295. package/dist/floorplan/ModelFloorplanPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  296. package/dist/floorplan/ModelFloorplanPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  297. package/dist/floorplan/ModelFloorplanPlugin/floorplan/index.d.ts +2 -1
  298. package/dist/floorplan/PanoFloorplanRadarPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  299. package/dist/floorplan/PanoFloorplanRadarPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  300. package/dist/floorplan/PanoFloorplanRadarPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  301. package/dist/floorplan/PanoFloorplanRadarPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  302. package/dist/floorplan/PanoFloorplanRadarPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  303. package/dist/floorplan/PanoFloorplanRadarPlugin/floorplan/index.d.ts +2 -1
  304. package/dist/floorplan/TopviewFloorplanPlugin/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  305. package/dist/floorplan/TopviewFloorplanPlugin/PanoDoorLabelPlugin/typings.d.ts +5 -0
  306. package/dist/floorplan/TopviewFloorplanPlugin/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  307. package/dist/floorplan/TopviewFloorplanPlugin/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  308. package/dist/floorplan/TopviewFloorplanPlugin/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  309. package/dist/floorplan/TopviewFloorplanPlugin/floorplan/index.d.ts +2 -1
  310. package/dist/floorplan/index.d.ts +2 -1
  311. package/dist/index.d.ts +1 -1
  312. package/dist/index.es.js +2400 -1721
  313. package/dist/index.js +2400 -1720
  314. package/dist/index.umd.js +2400 -1720
  315. package/docs/assets/search.js +1 -1
  316. package/docs/classes/Magnifier.html +4 -4
  317. package/docs/classes/ModelRoomLabelController.html +4 -4
  318. package/docs/enums/CameraMovementEffect.html +2 -2
  319. package/docs/enums/DIRECTION.html +1 -1
  320. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  321. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  322. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  323. package/docs/enums/Rotation.html +2 -2
  324. package/docs/index.html +2 -2
  325. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  326. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  327. package/docs/interfaces/FloorplanBounding.html +4 -4
  328. package/docs/interfaces/FloorplanData.html +2 -2
  329. package/docs/interfaces/FloorplanEntrance.html +7 -7
  330. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  331. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  332. package/docs/interfaces/FloorplanFloorData.html +2 -2
  333. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  334. package/docs/interfaces/FloorplanObserver.html +2 -2
  335. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  336. package/docs/interfaces/FloorplanPosition.html +2 -2
  337. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  338. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  339. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  340. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  341. package/docs/interfaces/FloorplanServerData.html +2 -2
  342. package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
  343. package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
  344. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  345. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  346. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  347. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  348. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  349. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  350. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  351. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  352. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  353. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  354. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  355. package/docs/interfaces/LineJson.html +1 -1
  356. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  357. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  358. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  359. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  360. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  361. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  362. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  363. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  364. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  365. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  366. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  367. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  368. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  369. package/docs/interfaces/OpenParameter.html +2 -2
  370. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  371. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  372. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  373. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  374. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  375. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  376. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  377. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  378. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  379. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  380. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  381. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  382. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  383. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  384. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  385. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  386. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  387. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  388. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  389. package/docs/interfaces/Point.html +1 -1
  390. package/docs/interfaces/PointJson.html +1 -1
  391. package/docs/interfaces/Room.html +1 -1
  392. package/docs/interfaces/RoomInfo.html +1 -1
  393. package/docs/interfaces/RoomLabel.html +7 -7
  394. package/docs/interfaces/RoomRules.html +1 -1
  395. package/docs/interfaces/Rooms.html +1 -1
  396. package/docs/modules.html +18 -18
  397. package/libs/ModelTVVideoPlugin/Plugin.js +2 -2
  398. package/libs/PanoDoorLabelPlugin/Controller.d.ts +2 -1
  399. package/libs/PanoDoorLabelPlugin/Controller.js +7 -2
  400. package/libs/PanoDoorLabelPlugin/typings.d.ts +5 -0
  401. package/libs/floorplan/MapviewFloorplanPlugin/Controller.d.ts +95 -0
  402. package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +682 -0
  403. package/libs/floorplan/MapviewFloorplanPlugin/index.d.ts +7 -0
  404. package/libs/floorplan/MapviewFloorplanPlugin/index.js +5 -0
  405. package/libs/floorplan/MapviewFloorplanPlugin/typing.d.ts +107 -0
  406. package/libs/floorplan/MapviewFloorplanPlugin/typing.js +1 -0
  407. package/libs/floorplan/index.d.ts +2 -1
  408. package/libs/floorplan/index.js +2 -1
  409. package/libs/index.d.ts +1 -1
  410. package/libs/index.js +1 -1
  411. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1023,6 +1023,24 @@ exports.FLOOR_PLAN_ATTACHED_TO = void 0;
1023
1023
  FLOOR_PLAN_ATTACHED_TO[FLOOR_PLAN_ATTACHED_TO["BOUNDING_CENTER"] = 3] = "BOUNDING_CENTER";
1024
1024
  })(exports.FLOOR_PLAN_ATTACHED_TO || (exports.FLOOR_PLAN_ATTACHED_TO = {}));
1025
1025
 
1026
+ /**
1027
+ * 传入一个 Promise
1028
+ * 无异常,返回 [null, data]
1029
+ * 有异常,则返回 [Error, undefined]
1030
+ * 用于替代 try&catch 处理 await 异常的方案
1031
+ */
1032
+ async function to(promise) {
1033
+ try {
1034
+ const data = await promise;
1035
+ return [null, data];
1036
+ }
1037
+ catch (error) {
1038
+ if (error instanceof Error)
1039
+ return [error, null];
1040
+ return [new Error(''), null];
1041
+ }
1042
+ }
1043
+
1026
1044
  /**
1027
1045
  * 检查一个值是否是狭义上的对象
1028
1046
  * @param {any} value 要检查的值
@@ -4648,10 +4666,48 @@ function omit(object, props) {
4648
4666
  });
4649
4667
  }
4650
4668
 
4669
+ /** 获取当前楼层地面的 Y 值 */
4670
+ function getFloorY(five, floorIndex) {
4671
+ const maxFloorIndex = Math.max(...five.work.observers.map((ob) => ob.floorIndex));
4672
+ return floorIndex > maxFloorIndex
4673
+ ? five.model.bounding.max.y
4674
+ : Math.max(...five.work.observers
4675
+ .filter((ob) => ob.floorIndex === floorIndex)
4676
+ .map((ob) => ob.standingPosition.y));
4677
+ }
4678
+ /** 获取当前吸附类型的 Y 值
4679
+ * * FLOOR_PLAN_ATTACHED_TO.FLOOR:当前楼层地板的 Y
4680
+ * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前模型中心的 Y
4681
+ * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前楼层天花板的 Y
4682
+ */
4683
+ function getAttachedY(five, floorIndex, attachedTo = exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER) {
4684
+ const currentFloorY = getFloorY(five, floorIndex);
4685
+ const nextFloorY = getFloorY(five, floorIndex + 1);
4686
+ if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
4687
+ return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
4688
+ else if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.CEILING)
4689
+ return nextFloorY;
4690
+ else
4691
+ return currentFloorY;
4692
+ }
4693
+ /**
4694
+ * 获取「在俯视图」状态下,模型 mm 与屏幕像素 px 的对应关系,即每 mm 对应多少 px
4695
+ * @param five five
4696
+ */
4697
+ function getPxmm(five, container, floorIndex, options) {
4698
+ const y = getAttachedY(five, floorIndex, options === null || options === void 0 ? void 0 : options.attachedTo);
4699
+ const originPosition = new THREE__namespace.Vector3(0, y, 0);
4700
+ const originPositionXUnit = new THREE__namespace.Vector3(1, y, 0);
4701
+ const mouse = originPosition.clone().project(five.camera);
4702
+ const xUnitMouse = originPositionXUnit.clone().project(five.camera);
4703
+ const pxmm = Math.abs((xUnitMouse.x - mouse.x) / 1000) * (container.getBoundingClientRect().width / 2);
4704
+ return pxmm;
4705
+ }
4706
+
4651
4707
  /**
4652
4708
  * plugin 的基本控制器
4653
4709
  */
4654
- class Controller$5 {
4710
+ class Controller$6 {
4655
4711
  constructor(five$1) {
4656
4712
  Object.defineProperty(this, "five", {
4657
4713
  enumerable: true,
@@ -4678,9 +4734,31 @@ class Controller$5 {
4678
4734
  }
4679
4735
  }
4680
4736
 
4681
- class Controller$4 extends Controller$5 {
4737
+ class Controller$5 extends Controller$6 {
4682
4738
  }
4683
4739
 
4740
+ var FloorplanErrorType;
4741
+ (function (FloorplanErrorType) {
4742
+ /** 意料之外的错误 */
4743
+ FloorplanErrorType["UnknownError"] = "UnknownError";
4744
+ /** 数据未加载 */
4745
+ FloorplanErrorType["DataNotLoaded"] = "DataNotLoaded";
4746
+ /** 展示过程被隐藏打断 */
4747
+ FloorplanErrorType["BreakOffByHide"] = "BreakOffByHide";
4748
+ /** 展示过程中插件被禁用 */
4749
+ FloorplanErrorType["BreakOffByDisable"] = "BreakOffByDisable";
4750
+ /** 模型未加载完成 */
4751
+ FloorplanErrorType["ModelNotLoaded"] = "ModelNotLoaded";
4752
+ /** Five changeMode 行为不符合预期 */
4753
+ FloorplanErrorType["ChangeModeError"] = "ChangeModeError";
4754
+ /** Five updateCamera 行为不符合预期 */
4755
+ FloorplanErrorType["UpdateCameraError"] = "UpdateCameraError";
4756
+ })(FloorplanErrorType || (FloorplanErrorType = {}));
4757
+ /** 户型图展示 & 模型消失的默认时间 */
4758
+ const SHOW_ANIME_DURATION = 500;
4759
+ /** Five camera 默认 fov */
4760
+ const FIVE_CAMERA_DEFAULT_FOV = 80;
4761
+
4684
4762
  /**
4685
4763
  * 比较两个数字近似相等
4686
4764
  * @param num1 数字1
@@ -4727,42 +4805,47 @@ async function changeMode(five, changeModeParams) {
4727
4805
  });
4728
4806
  }
4729
4807
 
4730
- /** 获取当前楼层地面的 Y 值 */
4731
- function getFloorY(five, floorIndex) {
4732
- const maxFloorIndex = Math.max(...five.work.observers.map((ob) => ob.floorIndex));
4733
- return floorIndex > maxFloorIndex
4734
- ? five.model.bounding.max.y
4735
- : Math.max(...five.work.observers
4736
- .filter((ob) => ob.floorIndex === floorIndex)
4737
- .map((ob) => ob.standingPosition.y));
4738
- }
4739
- /** 获取当前吸附类型的 Y
4740
- * * FLOOR_PLAN_ATTACHED_TO.FLOOR:当前楼层地板的 Y
4741
- * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前模型中心的 Y
4742
- * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前楼层天花板的 Y
4743
- */
4744
- function getAttachedY(five, floorIndex, attachedTo = exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER) {
4745
- const currentFloorY = getFloorY(five, floorIndex);
4746
- const nextFloorY = getFloorY(five, floorIndex + 1);
4747
- if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
4748
- return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
4749
- else if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.CEILING)
4750
- return nextFloorY;
4751
- else
4752
- return currentFloorY;
4808
+ /** 判断当前状态是否可以展示户型图 */
4809
+ function checkShowState(five, showState) {
4810
+ if (five.currentMode !== showState.mode)
4811
+ return false;
4812
+ const { latitude, longitude, fov } = showState;
4813
+ const { latitude: _latitude, longitude: _longitude } = five.getCurrentState();
4814
+ const _fov = five.camera.fov;
4815
+ if (!nearlyEqual(latitude, _latitude, 2))
4816
+ return false;
4817
+ if (!nearlyEqual(longitude, _longitude, 2))
4818
+ return false;
4819
+ if (fov !== _fov)
4820
+ return false;
4821
+ return true;
4753
4822
  }
4754
- /**
4755
- * 获取「在俯视图」状态下,模型 mm 与屏幕像素 px 的对应关系,即每 mm 对应多少 px
4756
- * @param five five
4823
+ /** 更改 Five 状态到展示户型图的状态
4824
+ * 1. 判断状态不符合时,会纠正到正确的状态
4825
+ * 2. 内置了相应的动画时间计算
4826
+ * 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
4757
4827
  */
4758
- function getPxmm(five, container, floorIndex, options) {
4759
- const y = getAttachedY(five, floorIndex, options === null || options === void 0 ? void 0 : options.attachedTo);
4760
- const originPosition = new THREE__namespace.Vector3(0, y, 0);
4761
- const originPositionXUnit = new THREE__namespace.Vector3(1, y, 0);
4762
- const mouse = originPosition.clone().project(five.camera);
4763
- const xUnitMouse = originPositionXUnit.clone().project(five.camera);
4764
- const pxmm = Math.abs((xUnitMouse.x - mouse.x) / 1000) * (container.getBoundingClientRect().width / 2);
4765
- return pxmm;
4828
+ async function correctFiveState(five, showState, userAction = true) {
4829
+ // 当前已满足状态,不需要变更
4830
+ const result = checkShowState(five, showState);
4831
+ if (result === true)
4832
+ return;
4833
+ const currentFiveState = five.getCurrentState();
4834
+ // 纠正 mode
4835
+ if (currentFiveState.mode !== showState.mode) {
4836
+ const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
4837
+ if (changeModeError)
4838
+ throw new Error(FloorplanErrorType.ChangeModeError);
4839
+ return;
4840
+ }
4841
+ // 纠正相机状态
4842
+ // 根据 latitude、longitude、fov 计算动画时间,最多 1s
4843
+ const { latitude, longitude, fov } = currentFiveState;
4844
+ const time = Math.min(1000, Math.max(200, Math.abs(latitude - Math.PI / 2) * 1000, (longitude > Math.PI ? 2 * Math.PI - longitude : longitude) * 500, Math.abs(fov - showState.fov) * 10));
4845
+ const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
4846
+ if (updateCameraError)
4847
+ throw new Error(FloorplanErrorType.UpdateCameraError);
4848
+ return;
4766
4849
  }
4767
4850
 
4768
4851
  function changeModelCanvasOpacity(five, opacity, duration = 300) {
@@ -4781,15 +4864,38 @@ function changeModelCanvasOpacity(five, opacity, duration = 300) {
4781
4864
  });
4782
4865
  }
4783
4866
 
4784
- class Controller$3 extends Controller$4 {
4867
+ /** 当前 five 的相机视角是否满足户型图自动隐藏条件
4868
+ *
4869
+ * @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
4870
+ *
4871
+ */
4872
+ function shouldFloorplanHideWithPose$1(pose) {
4873
+ const { latitude, longitude } = pose;
4874
+ const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
4875
+ const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
4876
+ return latitudeHide || longitudeHide;
4877
+ }
4878
+ /** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
4879
+ *
4880
+ * @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
4881
+ *
4882
+ */
4883
+ function shouldFloorplanShowWithPose$1(pose) {
4884
+ const { latitude, longitude } = pose;
4885
+ const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
4886
+ const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
4887
+ return latitudeVisible && longitudeVisible;
4888
+ }
4889
+ class Controller$4 extends Controller$5 {
4785
4890
  constructor(five, params) {
4891
+ var _a;
4786
4892
  super(five);
4787
4893
  // =============== public properties =================
4788
4894
  Object.defineProperty(this, "name", {
4789
4895
  enumerable: true,
4790
4896
  configurable: true,
4791
4897
  writable: true,
4792
- value: 'topviewFloorplanPlugin'
4898
+ value: 'modelFloorplanPlugin'
4793
4899
  });
4794
4900
  Object.defineProperty(this, "state", {
4795
4901
  enumerable: true,
@@ -4804,18 +4910,26 @@ class Controller$3 extends Controller$4 {
4804
4910
  writable: true,
4805
4911
  value: void 0
4806
4912
  });
4807
- Object.defineProperty(this, "app", {
4913
+ /** 展示户型图时,需要正确的状态 */
4914
+ Object.defineProperty(this, "showState", {
4808
4915
  enumerable: true,
4809
4916
  configurable: true,
4810
4917
  writable: true,
4811
- value: undefined
4918
+ value: void 0
4812
4919
  });
4813
- Object.defineProperty(this, "selector", {
4920
+ /** show 动画的公共 Promise */
4921
+ Object.defineProperty(this, "showPromise", {
4814
4922
  enumerable: true,
4815
4923
  configurable: true,
4816
4924
  writable: true,
4817
4925
  value: void 0
4818
4926
  });
4927
+ Object.defineProperty(this, "app", {
4928
+ enumerable: true,
4929
+ configurable: true,
4930
+ writable: true,
4931
+ value: undefined
4932
+ });
4819
4933
  Object.defineProperty(this, "panoIndex", {
4820
4934
  enumerable: true,
4821
4935
  configurable: true,
@@ -4828,6 +4942,19 @@ class Controller$3 extends Controller$4 {
4828
4942
  writable: true,
4829
4943
  value: 0
4830
4944
  });
4945
+ Object.defineProperty(this, "selector", {
4946
+ enumerable: true,
4947
+ configurable: true,
4948
+ writable: true,
4949
+ value: void 0
4950
+ });
4951
+ /** 公共 Promise 的 reject 方法 */
4952
+ Object.defineProperty(this, "showRejection", {
4953
+ enumerable: true,
4954
+ configurable: true,
4955
+ writable: true,
4956
+ value: void 0
4957
+ });
4831
4958
  /** 户型图父容器 */
4832
4959
  Object.defineProperty(this, "wrapper", {
4833
4960
  enumerable: true,
@@ -4870,34 +4997,6 @@ class Controller$3 extends Controller$4 {
4870
4997
  writable: true,
4871
4998
  value: false
4872
4999
  });
4873
- /** 更新户型图大小 */
4874
- Object.defineProperty(this, "updateSize", {
4875
- enumerable: true,
4876
- configurable: true,
4877
- writable: true,
4878
- value: () => {
4879
- if (!this.data)
4880
- return;
4881
- if (!this.container || !this.wrapper)
4882
- return;
4883
- if (this.five.getCurrentState().mode !== 'Topview')
4884
- return;
4885
- // 计算户型图展示大小
4886
- const { min, max } = this.data.bounding;
4887
- const width = max.x - min.x;
4888
- const height = max.y - min.y;
4889
- // 每毫米对应的 px 值
4890
- const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
4891
- const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
4892
- const _width = Math.ceil(width * pxmm);
4893
- const _height = Math.ceil(height * pxmm);
4894
- if (this.size.width === _width && this.size.height === _height)
4895
- return;
4896
- this.container.style.width = _width + 'px';
4897
- this.container.style.height = _height + 'px';
4898
- this.size = { width: _width, height: _height };
4899
- }
4900
- });
4901
5000
  /** 销毁插件 */
4902
5001
  Object.defineProperty(this, "dispose", {
4903
5002
  enumerable: true,
@@ -4915,21 +5014,213 @@ class Controller$3 extends Controller$4 {
4915
5014
  this.hooks.emit('dispose');
4916
5015
  }
4917
5016
  });
4918
- Object.defineProperty(this, "_disable", {
5017
+ /** 展示户型图
5018
+ * 1. show 函数大部分情况下需要耗时
5019
+ * 2. 如果当前已经在展示中,将不会触发任何事件
5020
+ * 3. 如果展示过程被中断,将抛出错误
5021
+ * 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
5022
+ * 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
5023
+ * @param opts.floorIndex 楼层
5024
+ * @param opts.modelOpacity 模型透明度
5025
+ * @param opts.immediately 是否立即展示
5026
+ * @param opts.isAutoShow 是否是自动展示
5027
+ * @param opts.userAction 是否是用户行为
5028
+ */
5029
+ Object.defineProperty(this, "show", {
4919
5030
  enumerable: true,
4920
5031
  configurable: true,
4921
5032
  writable: true,
4922
- value: (options) => {
4923
- var _a, _b;
4924
- const { userAction } = options;
4925
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
4926
- this.app = undefined;
4927
- (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
4928
- this.removeEventListener();
4929
- this.hooks.emit('disable', { userAction });
4930
- }
4931
- });
4932
- /** modelLoaded 之后自动执行 append container 操作 */
5033
+ value: async (options = {}) => {
5034
+ if (!this.state.enabled)
5035
+ return;
5036
+ // 已经展示完成了,不做任何操作
5037
+ if (!this.showPromise && this.state.visible)
5038
+ return;
5039
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5040
+ this.updateState({ visible: true }, userAction);
5041
+ this._show(options);
5042
+ }
5043
+ });
5044
+ /** 隐藏户型图 */
5045
+ Object.defineProperty(this, "hide", {
5046
+ enumerable: true,
5047
+ configurable: true,
5048
+ writable: true,
5049
+ value: async (options = {}) => {
5050
+ if (!this.state.enabled)
5051
+ return;
5052
+ this.isHiddenByHideFunc = true;
5053
+ if (this.state.visible === false)
5054
+ return;
5055
+ this.updateState({ visible: false }, options.userAction || true);
5056
+ this._hide(options);
5057
+ }
5058
+ });
5059
+ /** 更新户型图大小 */
5060
+ Object.defineProperty(this, "updateSize", {
5061
+ enumerable: true,
5062
+ configurable: true,
5063
+ writable: true,
5064
+ value: () => {
5065
+ if (!this.data)
5066
+ return;
5067
+ if (!checkShowState(this.five, this.showState))
5068
+ return;
5069
+ if (!this.container || !this.wrapper)
5070
+ return;
5071
+ // 计算户型图展示大小
5072
+ const { min, max } = this.data.bounding;
5073
+ const width = max.x - min.x;
5074
+ const height = max.y - min.y;
5075
+ // 每毫米对应的 px 值
5076
+ const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
5077
+ const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
5078
+ const _width = Math.ceil(width * pxmm);
5079
+ const _height = Math.ceil(height * pxmm);
5080
+ if (this.size.width === _width && this.size.height === _height)
5081
+ return;
5082
+ this.container.style.width = _width + 'px';
5083
+ this.container.style.height = _height + 'px';
5084
+ this.size = { width: _width, height: _height };
5085
+ }
5086
+ });
5087
+ Object.defineProperty(this, "_disable", {
5088
+ enumerable: true,
5089
+ configurable: true,
5090
+ writable: true,
5091
+ value: (options) => {
5092
+ var _a, _b, _c;
5093
+ const { userAction } = options;
5094
+ this.hooks.emit('disable', { userAction });
5095
+ // ===== 处理展示过程中 disable =====
5096
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
5097
+ this.showPromise = undefined;
5098
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
5099
+ this.app = undefined;
5100
+ (_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
5101
+ this.removeEventListener();
5102
+ }
5103
+ });
5104
+ Object.defineProperty(this, "_enable", {
5105
+ enumerable: true,
5106
+ configurable: true,
5107
+ writable: true,
5108
+ value: (options) => {
5109
+ const { userAction } = options;
5110
+ this.addEventListener();
5111
+ if (!this.wrapper)
5112
+ return;
5113
+ this.wrapper.append(this.container);
5114
+ this.hooks.emit('enable', { userAction });
5115
+ if (this.state.visible)
5116
+ this._show({ userAction });
5117
+ }
5118
+ });
5119
+ Object.defineProperty(this, "_show", {
5120
+ enumerable: true,
5121
+ configurable: true,
5122
+ writable: true,
5123
+ value: async (options) => {
5124
+ var _a;
5125
+ if (!this.state.enabled)
5126
+ return;
5127
+ if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
5128
+ throw new Error(FloorplanErrorType.ModelNotLoaded);
5129
+ if (!this.data)
5130
+ throw new Error(FloorplanErrorType.DataNotLoaded);
5131
+ this.isHiddenByHideFunc = false;
5132
+ // ===== 参数合并 =====
5133
+ const baseShowOpts = {
5134
+ floorIndex: this.floorIndex,
5135
+ modelOpacity: this.state.config.modelOpacity,
5136
+ immediately: false,
5137
+ isAutoShow: false,
5138
+ userAction: true,
5139
+ };
5140
+ const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
5141
+ const getShowPromise = async () => {
5142
+ this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
5143
+ let hasRejected = false;
5144
+ let externalErrorMsg;
5145
+ this.showRejection = (errorMsg) => {
5146
+ hasRejected = true;
5147
+ externalErrorMsg = errorMsg;
5148
+ };
5149
+ const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
5150
+ if (correctError)
5151
+ throw correctError;
5152
+ // 异步结束要判断当前是不是被中断了
5153
+ if (hasRejected)
5154
+ throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
5155
+ // 更新户型图大小
5156
+ this.updateSize();
5157
+ // 高亮当前楼层,有两个目的
5158
+ // 1. 点击模型时,可以跳转到当前楼层的点位上
5159
+ // 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
5160
+ this.floorIndex = mergedOptions.floorIndex;
5161
+ this.five.model.show(this.floorIndex);
5162
+ // 模型消失, 渲染户型图
5163
+ const modelOpacity = mergedOptions.modelOpacity;
5164
+ const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
5165
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5166
+ this.render(renderDuration);
5167
+ };
5168
+ this.showPromise = getShowPromise()
5169
+ .then(() => {
5170
+ this.hooks.emit('showAnimationEnded', {
5171
+ auto: mergedOptions.isAutoShow,
5172
+ userAction: mergedOptions.userAction,
5173
+ });
5174
+ })
5175
+ .catch((error) => {
5176
+ this.updateState({ visible: false }, mergedOptions.userAction);
5177
+ // 自动展示的报错内部处理
5178
+ if (mergedOptions.isAutoShow)
5179
+ return;
5180
+ // 非自动展示的报错继续向外抛出
5181
+ if (error instanceof Error)
5182
+ throw error;
5183
+ })
5184
+ .finally(() => {
5185
+ this.showPromise = undefined;
5186
+ this.showRejection = undefined;
5187
+ });
5188
+ return this.showPromise;
5189
+ }
5190
+ });
5191
+ Object.defineProperty(this, "_hide", {
5192
+ enumerable: true,
5193
+ configurable: true,
5194
+ writable: true,
5195
+ value: (options) => {
5196
+ var _a;
5197
+ // ===== 处理展示过程中 hide =====
5198
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
5199
+ this.showPromise = undefined;
5200
+ // ===== 合并参数 =====
5201
+ const baseOptions = {
5202
+ userAction: true,
5203
+ isAutoHide: false,
5204
+ };
5205
+ const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
5206
+ changeModelCanvasOpacity(this.five, 1, 0);
5207
+ this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
5208
+ this.render();
5209
+ }
5210
+ });
5211
+ Object.defineProperty(this, "handleClick", {
5212
+ enumerable: true,
5213
+ configurable: true,
5214
+ writable: true,
5215
+ value: () => {
5216
+ if (!this.state.visible)
5217
+ return;
5218
+ const preventDefault = this.hooks.emit('click');
5219
+ if (preventDefault)
5220
+ return false;
5221
+ }
5222
+ });
5223
+ /** modelLoaded 之后自动执行 append container 操作 */
4933
5224
  Object.defineProperty(this, "onFiveModelLoaded", {
4934
5225
  enumerable: true,
4935
5226
  configurable: true,
@@ -4948,18 +5239,44 @@ class Controller$3 extends Controller$4 {
4948
5239
  wrapper.append(this.container);
4949
5240
  }
4950
5241
  });
4951
- /** Topview 态隐藏户型图 */
5242
+ /** 更改模型时,自动隐藏户型图 */
4952
5243
  Object.defineProperty(this, "onFiveModeChange", {
4953
5244
  enumerable: true,
4954
5245
  configurable: true,
4955
5246
  writable: true,
4956
- value: (...[mode, , , , userAction]) => {
4957
- if (mode !== 'Topview' && this.state.visible) {
4958
- this.updateState({ visible: false }, userAction);
4959
- this._hide({ userAction });
5247
+ value: (mode) => {
5248
+ // 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
5249
+ if (mode !== this.showState.mode) {
5250
+ this.updateState({ visible: false }, false);
5251
+ this._hide({ userAction: false });
5252
+ }
5253
+ }
5254
+ });
5255
+ /** 惯性结束后,判断能否自动展示户型图 */
5256
+ Object.defineProperty(this, "onFiveInteriaPan", {
5257
+ enumerable: true,
5258
+ configurable: true,
5259
+ writable: true,
5260
+ value: (_, isFinal) => {
5261
+ if (!isFinal)
5262
+ return;
5263
+ if (this.state.config.autoShowEnable === false)
5264
+ return;
5265
+ // 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
5266
+ if (this.isHiddenByHideFunc)
5267
+ return;
5268
+ const fiveCurrentState = this.five.getCurrentState();
5269
+ if (fiveCurrentState.mode !== 'Floorplan')
5270
+ return;
5271
+ if (this.state.visible)
5272
+ return;
5273
+ if (shouldFloorplanShowWithPose$1(fiveCurrentState)) {
5274
+ this.updateState({ visible: true }, true);
5275
+ this._show({ isAutoShow: true });
4960
5276
  }
4961
5277
  }
4962
5278
  });
5279
+ /** panoIndex 改变时,更新 floorIndex */
4963
5280
  Object.defineProperty(this, "onFivePanoArrived", {
4964
5281
  enumerable: true,
4965
5282
  configurable: true,
@@ -4972,6 +5289,7 @@ class Controller$3 extends Controller$4 {
4972
5289
  this.floorIndex = this.five.work.observers[index].floorIndex;
4973
5290
  }
4974
5291
  });
5292
+ /** cameraUpdate 时判断户型图是否应该自动隐藏 */
4975
5293
  Object.defineProperty(this, "onFiveCameraUpdate", {
4976
5294
  enumerable: true,
4977
5295
  configurable: true,
@@ -4979,43 +5297,71 @@ class Controller$3 extends Controller$4 {
4979
5297
  value: (_, userAction) => {
4980
5298
  if (!this.state.visible)
4981
5299
  return;
4982
- this.updatePosition();
4983
- this.updateSize();
5300
+ // 展示过程中不处理自动隐藏逻辑
5301
+ if (this.showPromise)
5302
+ return;
5303
+ const fiveCurrentState = this.five.getCurrentState();
5304
+ if (shouldFloorplanHideWithPose$1(fiveCurrentState)) {
5305
+ this.updateState({ visible: false }, userAction);
5306
+ this._hide({ userAction, isAutoHide: true });
5307
+ }
4984
5308
  }
4985
5309
  });
5310
+ /** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
4986
5311
  Object.defineProperty(this, "onFiveWantsGesture", {
4987
5312
  enumerable: true,
4988
5313
  configurable: true,
4989
5314
  writable: true,
4990
- value: (type) => {
4991
- if (type !== 'pan' && type !== 'pinch' && type !== 'mouseWheel')
5315
+ value: (type, pointers) => {
5316
+ if (!this.state.visible)
4992
5317
  return;
4993
- if (this.state.visible && !this.state.config.gestureEnable)
5318
+ // 阻止多指操作
5319
+ if (pointers.length > 1)
5320
+ return false;
5321
+ // 阻止鼠标滚轮行为
5322
+ if (type === 'mouseWheel')
4994
5323
  return false;
4995
5324
  }
4996
5325
  });
4997
- Object.defineProperty(this, "onFiveWantsMoveToPano", {
5326
+ /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
5327
+ Object.defineProperty(this, "onFiveWantsPanGesture", {
4998
5328
  enumerable: true,
4999
5329
  configurable: true,
5000
5330
  writable: true,
5001
- value: () => {
5002
- if (this.state.visible && this.state.config.preventRoomClick)
5003
- return false;
5004
- }
5005
- });
5006
- /** 动画结束后是 Topview 态就展示户型图 */
5007
- Object.defineProperty(this, "onFiveInitAnimationEnded", {
5331
+ value: (_, isFinal) => {
5332
+ if (this.five.getCurrentState().mode !== 'Floorplan')
5333
+ return;
5334
+ if (this.state.config.autoShowEnable === false)
5335
+ return;
5336
+ if (isFinal && this.state.visible) {
5337
+ this.five.updateCamera(this.showState, 0);
5338
+ // 禁用掉 isFinal 的 panGesture 行为
5339
+ // 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
5340
+ // 此行为也会禁用 pan 结束后的惯性处理
5341
+ return false;
5342
+ }
5343
+ }
5344
+ });
5345
+ /** 阻止点击分间走点 */
5346
+ Object.defineProperty(this, "onFiveWantsTapGesture", {
5008
5347
  enumerable: true,
5009
5348
  configurable: true,
5010
5349
  writable: true,
5011
- value: (...[, , userAction]) => {
5012
- const { mode } = this.five.getCurrentState();
5013
- if (mode === 'Topview' && !this.isHiddenByHideFunc && !this.state.visible && this.state.config.autoShowEnable) {
5014
- this.updateState({ visible: true }, userAction);
5015
- this._show({ userAction });
5350
+ value: () => this.handleClick()
5351
+ });
5352
+ /** Panorama 切换到其他模态时,记录当前的相机水平视角 */
5353
+ Object.defineProperty(this, "onFiveWantsChangeMode", {
5354
+ enumerable: true,
5355
+ configurable: true,
5356
+ writable: true,
5357
+ value: (mode, prevMode) => {
5358
+ if (prevMode === 'Panorama' && mode === 'Floorplan') {
5359
+ this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
5016
5360
  }
5361
+ // if (mode !== 'Floorplan') this.hide()
5017
5362
  }
5018
5363
  });
5364
+ /** 模型楼层高亮改变时,自动进行楼层切换 */
5019
5365
  Object.defineProperty(this, "onModelShownFloorChange", {
5020
5366
  enumerable: true,
5021
5367
  configurable: true,
@@ -5028,7 +5374,6 @@ class Controller$3 extends Controller$4 {
5028
5374
  this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
5029
5375
  return;
5030
5376
  }
5031
- // 模型楼层高亮改变时,自动进行楼层切换
5032
5377
  this.floorIndex = shownFloor;
5033
5378
  this.updateSize();
5034
5379
  this.render();
@@ -5038,13 +5383,19 @@ class Controller$3 extends Controller$4 {
5038
5383
  this.selector = params.selector;
5039
5384
  console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
5040
5385
  }
5386
+ // =============== init Show State ===============
5387
+ this.showState = {
5388
+ mode: 'Floorplan',
5389
+ longitude: 0,
5390
+ latitude: Math.PI / 2,
5391
+ fov: FIVE_CAMERA_DEFAULT_FOV / ((_a = params === null || params === void 0 ? void 0 : params.scale) !== null && _a !== void 0 ? _a : 1),
5392
+ };
5041
5393
  // =============== init State ===============
5042
5394
  const baseConfig = {
5043
5395
  northDesc: '北',
5044
5396
  modelOpacity: 1,
5045
5397
  hoverEnable: true,
5046
5398
  compassEnable: true,
5047
- gestureEnable: false,
5048
5399
  autoShowEnable: true,
5049
5400
  ruleLabelsEnable: true,
5050
5401
  roomLabelsEnable: true,
@@ -5086,19 +5437,6 @@ class Controller$3 extends Controller$4 {
5086
5437
  this.updateState(state, userAction);
5087
5438
  this.render();
5088
5439
  }
5089
- /** 更新户型图位置 */
5090
- updatePosition() {
5091
- var _a;
5092
- const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
5093
- const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE__namespace.Vector3()).setY(y);
5094
- if (!modelPosition)
5095
- return;
5096
- const ndcPosition = modelPosition.clone().project(this.five.camera);
5097
- const left = (ndcPosition.x + 1) / 2;
5098
- const top = -(ndcPosition.y - 1) / 2;
5099
- this.container.style.left = left * 100 + '%';
5100
- this.container.style.top = top * 100 + '%';
5101
- }
5102
5440
  /** 把插件的渲染DOM插入到对应的容器中去 */
5103
5441
  appendTo(wrapper) {
5104
5442
  this.wrapper = wrapper;
@@ -5109,22 +5447,7 @@ class Controller$3 extends Controller$4 {
5109
5447
  this.render();
5110
5448
  return this;
5111
5449
  }
5112
- async show(options = {}) {
5113
- // 已经展示完成了,不做任何操作
5114
- if (this.state.visible)
5115
- return;
5116
- const userAction = options.userAction !== undefined ? options.userAction : true;
5117
- this.updateState({ visible: true }, userAction);
5118
- this._show({ userAction });
5119
- }
5120
- async hide(options = {}) {
5121
- this.isHiddenByHideFunc = true;
5122
- if (!this.state.visible)
5123
- return;
5124
- const userAction = options.userAction !== undefined ? options.userAction : true;
5125
- this.updateState({ visible: false }, userAction);
5126
- this._hide({ userAction });
5127
- }
5450
+ /** 启用插件 */
5128
5451
  enable(options = {}) {
5129
5452
  if (this.state.enabled)
5130
5453
  return;
@@ -5132,6 +5455,7 @@ class Controller$3 extends Controller$4 {
5132
5455
  this.updateState({ enabled: true }, options.userAction || userAction);
5133
5456
  this._enable({ userAction });
5134
5457
  }
5458
+ /** 禁用插件 */
5135
5459
  disable(options = {}) {
5136
5460
  if (!this.state.enabled)
5137
5461
  return;
@@ -5145,53 +5469,22 @@ class Controller$3 extends Controller$4 {
5145
5469
  const userAction = options.userAction !== undefined ? options.userAction : true;
5146
5470
  this.updateState(state, userAction);
5147
5471
  if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
5148
- const options = { userAction };
5149
- state.enabled ? this._enable(options) : this._disable(options);
5472
+ state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
5150
5473
  }
5151
5474
  if (state.visible !== undefined && prevState.visible !== state.visible) {
5152
5475
  const options = { userAction };
5153
5476
  state.visible ? this._show(options) : this._hide(options);
5154
5477
  }
5155
5478
  }
5156
- async formatData(serverData) {
5157
- return await formatData(serverData.data);
5158
- }
5159
- async _show(options) {
5160
- if (!this.state.enabled)
5161
- return;
5162
- this.isHiddenByHideFunc = false;
5163
- const { userAction } = options;
5164
- this.hooks.emit('show', { userAction });
5165
- if (this.five.getCurrentState().mode !== 'Topview') {
5166
- await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
5167
- }
5168
- this.five.model.show(this.floorIndex);
5169
- this.updatePosition();
5170
- this.updateSize();
5171
- const renderDuration = 500;
5172
- const modelOpacity = this.state.config.modelOpacity;
5173
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5174
- this.hooks.emit('showAnimationEnded', { userAction });
5175
- this.render();
5176
- }
5177
- async _hide(options) {
5178
- if (!this.state.enabled)
5479
+ changeConfigs(_config, userAction = true) {
5480
+ const config = Object.assign(Object.assign({}, this.state.config), _config);
5481
+ this.updateState({ config }, userAction);
5482
+ if (!this.container)
5179
5483
  return;
5180
- const { userAction } = options;
5181
- this.hooks.emit('hide', { userAction });
5182
- const modelOpacity = 1;
5183
- const renderDuration = 0;
5184
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5185
5484
  this.render();
5186
5485
  }
5187
- _enable(options) {
5188
- const { userAction } = options;
5189
- this.addEventListener();
5190
- if (this.wrapper)
5191
- this.wrapper.append(this.container);
5192
- this.hooks.emit('enable', { userAction });
5193
- if (this.state.visible)
5194
- this._show({ userAction });
5486
+ async formatData(serverData) {
5487
+ return await formatData(serverData.data);
5195
5488
  }
5196
5489
  updateState(state, userAction) {
5197
5490
  const prevState = this.state;
@@ -5200,6 +5493,22 @@ class Controller$3 extends Controller$4 {
5200
5493
  return;
5201
5494
  this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
5202
5495
  }
5496
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
5497
+ *
5498
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
5499
+ */
5500
+ initContainer() {
5501
+ this.container.classList.add('floorplan-plugin');
5502
+ Object.assign(this.container.style, {
5503
+ position: 'absolute',
5504
+ left: '50%',
5505
+ top: '50%',
5506
+ transform: 'translate(-50%, -50%)',
5507
+ zIndex: 10,
5508
+ pointerEvents: 'none',
5509
+ });
5510
+ this.five.addExtraElement(this.container);
5511
+ }
5203
5512
  addEventListener() {
5204
5513
  if (!this.state.enabled)
5205
5514
  return;
@@ -5207,42 +5516,30 @@ class Controller$3 extends Controller$4 {
5207
5516
  return;
5208
5517
  const five = this.five;
5209
5518
  five.on('modeChange', this.onFiveModeChange);
5519
+ five.on('interiaPan', this.onFiveInteriaPan);
5210
5520
  five.on('panoArrived', this.onFivePanoArrived);
5211
5521
  five.on('cameraUpdate', this.onFiveCameraUpdate);
5212
5522
  five.on('wantsGesture', this.onFiveWantsGesture);
5213
- five.on('wantsMoveToPano', this.onFiveWantsMoveToPano);
5214
- five.on('initAnimationEnded', this.onFiveInitAnimationEnded);
5523
+ five.on('wantsPanGesture', this.onFiveWantsPanGesture);
5524
+ five.on('wantsTapGesture', this.onFiveWantsTapGesture);
5525
+ five.on('wantsChangeMode', this.onFiveWantsChangeMode);
5215
5526
  five.on('modelShownFloorChange', this.onModelShownFloorChange);
5216
5527
  }
5217
5528
  removeEventListener() {
5218
5529
  const five = this.five;
5219
5530
  this.hasAddedEventListener = false;
5220
5531
  // 注意这里并没有消除 dispose 的监听
5532
+ five.off('modelLoaded', this.onFiveModelLoaded);
5221
5533
  five.off('modeChange', this.onFiveModeChange);
5534
+ five.off('interiaPan', this.onFiveInteriaPan);
5222
5535
  five.off('panoArrived', this.onFivePanoArrived);
5223
5536
  five.off('cameraUpdate', this.onFiveCameraUpdate);
5224
5537
  five.off('wantsGesture', this.onFiveWantsGesture);
5225
- five.off('wantsMoveToPano', this.onFiveWantsMoveToPano);
5226
- five.off('initAnimationEnded', this.onFiveInitAnimationEnded);
5538
+ five.off('wantsPanGesture', this.onFiveWantsPanGesture);
5539
+ five.off('wantsTapGesture', this.onFiveWantsTapGesture);
5540
+ five.off('wantsChangeMode', this.onFiveWantsChangeMode);
5227
5541
  five.off('modelShownFloorChange', this.onModelShownFloorChange);
5228
5542
  }
5229
- /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
5230
- *
5231
- * - TODO: 等 selector 功能下掉之后删除这个逻辑
5232
- */
5233
- initContainer() {
5234
- this.container.classList.add('floorplan-plugin');
5235
- Object.assign(this.container.style, {
5236
- position: 'absolute',
5237
- left: '50%',
5238
- top: '50%',
5239
- transform: 'translate3d(-50%, -50%, 10px)',
5240
- zIndex: 10,
5241
- pointerEvents: 'none',
5242
- 'will-change': 'width, height',
5243
- });
5244
- this.five.addExtraElement(this.container);
5245
- }
5246
5543
  render(duration) {
5247
5544
  if (!this.state.enabled)
5248
5545
  return;
@@ -5257,887 +5554,33 @@ class Controller$3 extends Controller$4 {
5257
5554
  }
5258
5555
  }
5259
5556
 
5260
- const TopviewFloorplanPlugin = (five, params) => {
5261
- return new Controller$3(five, params);
5557
+ const ModelFloorplanPlugin = (five, params) => {
5558
+ return new Controller$4(five, params);
5262
5559
  };
5263
5560
 
5264
- /**
5265
- * 创建一个防抖动函数,该函数在高频调用时会每隔 wait 毫秒后调用 func 方法
5266
- * `throttle` 会在第一次调用时立刻调用一次
5267
- * @param func - 要防抖动的函数
5268
- * @param wait - 需要延迟的毫秒数
5561
+ /** 当前 five 的相机视角是否满足户型图自动隐藏条件
5562
+ *
5563
+ * @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
5564
+ *
5269
5565
  */
5270
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5271
- function throttle(func, wait = 200) {
5272
- let last;
5273
- return function (...args) {
5274
- if (last)
5275
- return;
5276
- func(...args);
5277
- last = setTimeout(function () {
5278
- last = null;
5279
- }, wait);
5280
- };
5281
- }
5282
-
5283
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte generated by Svelte v3.49.0 */
5284
-
5285
- function add_css$a(target) {
5286
- internal.append_styles(target, "svelte-1ty3s4p", ".plugin-radar__camera-wrapper.svelte-1ty3s4p{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1ty3s4p{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1ty3s4p{position:absolute;left:-0.78125rem;top:-0.78125rem;width:0.88542rem;height:0.88542rem;transform-origin:0.78125rem 0.78125rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}");
5566
+ function shouldFloorplanHideWithPose(pose) {
5567
+ const { latitude, longitude } = pose;
5568
+ const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
5569
+ const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
5570
+ return latitudeHide || longitudeHide;
5287
5571
  }
5288
-
5289
- function create_fragment$c(ctx) {
5290
- let div2;
5291
- let div1;
5292
- let div0;
5293
-
5294
- return {
5295
- c() {
5296
- div2 = internal.element("div");
5297
- div1 = internal.element("div");
5298
- div0 = internal.element("div");
5299
- internal.attr(div0, "class", "plugin-radar__camera-rotate svelte-1ty3s4p");
5300
- internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
5301
- internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
5302
- internal.attr(div1, "class", "plugin-radar__camera-position svelte-1ty3s4p");
5303
- internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
5304
- internal.attr(div2, "class", "plugin-radar__camera-wrapper svelte-1ty3s4p");
5305
- },
5306
- m(target, anchor) {
5307
- internal.insert(target, div2, anchor);
5308
- internal.append(div2, div1);
5309
- internal.append(div1, div0);
5310
- },
5311
- p(ctx, [dirty]) {
5312
- if (dirty & /*cameraImageUrl*/ 1) {
5313
- internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
5314
- }
5315
-
5316
- if (dirty & /*rotateTransform*/ 2) {
5317
- internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
5318
- }
5319
-
5320
- if (dirty & /*positionTransform*/ 4) {
5321
- internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
5322
- }
5323
- },
5324
- i: internal.noop,
5325
- o: internal.noop,
5326
- d(detaching) {
5327
- if (detaching) internal.detach(div2);
5328
- }
5329
- };
5572
+ /** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
5573
+ *
5574
+ * @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
5575
+ *
5576
+ */
5577
+ function shouldFloorplanShowWithPose(pose) {
5578
+ const { latitude, longitude } = pose;
5579
+ const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
5580
+ const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
5581
+ return latitudeVisible && longitudeVisible;
5330
5582
  }
5331
-
5332
- function getCameraRotateTransform(longitude) {
5333
- // 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
5334
- const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
5335
-
5336
- return `rotate(${rotate}deg)`;
5337
- }
5338
-
5339
- function instance$c($$self, $$props, $$invalidate) {
5340
- let positionTransform;
5341
- let rotateTransform;
5342
- let { five } = $$props;
5343
- let { pxmm } = $$props;
5344
- let { floorplanData } = $$props;
5345
- let { cameraImageUrl } = $$props;
5346
- let panoIndex = five.getCurrentState().panoIndex;
5347
- let longitude = five.getCurrentState().longitude;
5348
-
5349
- /** 获取相机在当前 Five 状态下的位移 */
5350
- function getCameraPositionTransform(floorplanData, panoIndex) {
5351
- const bounding = floorplanData.bounding;
5352
- const floorplanObserver = floorplanData.observers[panoIndex];
5353
- if (!floorplanObserver) return '';
5354
- const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
5355
- const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
5356
- const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
5357
- const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
5358
- return `translate(${left}px, ${top}px)`;
5359
- }
5360
-
5361
- function onFivePanoWillArrive(_panoIndex) {
5362
- $$invalidate(6, panoIndex = _panoIndex);
5363
- }
5364
-
5365
- const onFiveCameraDirectionUpdate = throttle(
5366
- pose => {
5367
- $$invalidate(7, longitude = pose.longitude);
5368
- },
5369
- 1000 / 60
5370
- );
5371
-
5372
- svelte.onMount(() => {
5373
- five.on('panoWillArrive', onFivePanoWillArrive);
5374
- five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
5375
-
5376
- return function dispose() {
5377
- five.off('panoWillArrive', onFivePanoWillArrive);
5378
- five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
5379
- };
5380
- });
5381
-
5382
- $$self.$$set = $$props => {
5383
- if ('five' in $$props) $$invalidate(3, five = $$props.five);
5384
- if ('pxmm' in $$props) $$invalidate(4, pxmm = $$props.pxmm);
5385
- if ('floorplanData' in $$props) $$invalidate(5, floorplanData = $$props.floorplanData);
5386
- if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
5387
- };
5388
-
5389
- $$self.$$.update = () => {
5390
- if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
5391
- // 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
5392
- $$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
5393
- }
5394
-
5395
- if ($$self.$$.dirty & /*longitude*/ 128) {
5396
- $$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
5397
- }
5398
- };
5399
-
5400
- return [
5401
- cameraImageUrl,
5402
- rotateTransform,
5403
- positionTransform,
5404
- five,
5405
- pxmm,
5406
- floorplanData,
5407
- panoIndex,
5408
- longitude
5409
- ];
5410
- }
5411
-
5412
- class Camera extends internal.SvelteComponent {
5413
- constructor(options) {
5414
- super();
5415
-
5416
- internal.init(
5417
- this,
5418
- options,
5419
- instance$c,
5420
- create_fragment$c,
5421
- internal.safe_not_equal,
5422
- {
5423
- five: 3,
5424
- pxmm: 4,
5425
- floorplanData: 5,
5426
- cameraImageUrl: 0
5427
- },
5428
- add_css$a
5429
- );
5430
- }
5431
- }
5432
-
5433
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte generated by Svelte v3.49.0 */
5434
-
5435
- function add_css$9(target) {
5436
- internal.append_styles(target, "svelte-1i87fz7", ".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}");
5437
- }
5438
-
5439
- function get_each_context$5(ctx, list, i) {
5440
- const child_ctx = ctx.slice();
5441
- child_ctx[1] = list[i];
5442
- return child_ctx;
5443
- }
5444
-
5445
- // (5:2) {#each extraObjects as extraObject (extraObject.id)}
5446
- function create_each_block$5(key_1, ctx) {
5447
- let div1;
5448
- let div0;
5449
- let style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`;
5450
- let style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`;
5451
- let t;
5452
- let style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`;
5453
- let style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`;
5454
-
5455
- return {
5456
- key: key_1,
5457
- first: null,
5458
- c() {
5459
- div1 = internal.element("div");
5460
- div0 = internal.element("div");
5461
- t = internal.space();
5462
- internal.attr(div0, "class", "plugin-pano-floorplan__extra-object-item svelte-1i87fz7");
5463
- internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
5464
- internal.set_style(div0, "width", style_width, false);
5465
- internal.set_style(div0, "height", style_height, false);
5466
- internal.attr(div1, "class", "plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7");
5467
- internal.set_style(div1, "top", style_top, false);
5468
- internal.set_style(div1, "left", style_left, false);
5469
- this.first = div1;
5470
- },
5471
- m(target, anchor) {
5472
- internal.insert(target, div1, anchor);
5473
- internal.append(div1, div0);
5474
- internal.append(div1, t);
5475
- },
5476
- p(new_ctx, dirty) {
5477
- ctx = new_ctx;
5478
-
5479
- if (dirty & /*extraObjects*/ 1) {
5480
- internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
5481
- }
5482
-
5483
- if (dirty & /*extraObjects*/ 1 && style_width !== (style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`)) {
5484
- internal.set_style(div0, "width", style_width, false);
5485
- }
5486
-
5487
- if (dirty & /*extraObjects*/ 1 && style_height !== (style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`)) {
5488
- internal.set_style(div0, "height", style_height, false);
5489
- }
5490
-
5491
- if (dirty & /*extraObjects*/ 1 && style_top !== (style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`)) {
5492
- internal.set_style(div1, "top", style_top, false);
5493
- }
5494
-
5495
- if (dirty & /*extraObjects*/ 1 && style_left !== (style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`)) {
5496
- internal.set_style(div1, "left", style_left, false);
5497
- }
5498
- },
5499
- d(detaching) {
5500
- if (detaching) internal.detach(div1);
5501
- }
5502
- };
5503
- }
5504
-
5505
- function create_fragment$b(ctx) {
5506
- let div;
5507
- let each_blocks = [];
5508
- let each_1_lookup = new Map();
5509
- let each_value = /*extraObjects*/ ctx[0];
5510
- const get_key = ctx => /*extraObject*/ ctx[1].id;
5511
-
5512
- for (let i = 0; i < each_value.length; i += 1) {
5513
- let child_ctx = get_each_context$5(ctx, each_value, i);
5514
- let key = get_key(child_ctx);
5515
- each_1_lookup.set(key, each_blocks[i] = create_each_block$5(key, child_ctx));
5516
- }
5517
-
5518
- return {
5519
- c() {
5520
- div = internal.element("div");
5521
-
5522
- for (let i = 0; i < each_blocks.length; i += 1) {
5523
- each_blocks[i].c();
5524
- }
5525
-
5526
- internal.attr(div, "class", "plugin-pano-floorplan__extra-objects svelte-1i87fz7");
5527
- },
5528
- m(target, anchor) {
5529
- internal.insert(target, div, anchor);
5530
-
5531
- for (let i = 0; i < each_blocks.length; i += 1) {
5532
- each_blocks[i].m(div, null);
5533
- }
5534
- },
5535
- p(ctx, [dirty]) {
5536
- if (dirty & /*extraObjects*/ 1) {
5537
- each_value = /*extraObjects*/ ctx[0];
5538
- each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, internal.destroy_block, create_each_block$5, null, get_each_context$5);
5539
- }
5540
- },
5541
- i: internal.noop,
5542
- o: internal.noop,
5543
- d(detaching) {
5544
- if (detaching) internal.detach(div);
5545
-
5546
- for (let i = 0; i < each_blocks.length; i += 1) {
5547
- each_blocks[i].d();
5548
- }
5549
- }
5550
- };
5551
- }
5552
-
5553
- function instance$b($$self, $$props, $$invalidate) {
5554
- let { extraObjects = [] } = $$props;
5555
-
5556
- $$self.$$set = $$props => {
5557
- if ('extraObjects' in $$props) $$invalidate(0, extraObjects = $$props.extraObjects);
5558
- };
5559
-
5560
- return [extraObjects];
5561
- }
5562
-
5563
- class ExtraObjects extends internal.SvelteComponent {
5564
- constructor(options) {
5565
- super();
5566
- internal.init(this, options, instance$b, create_fragment$b, internal.safe_not_equal, { extraObjects: 0 }, add_css$9);
5567
- }
5568
- }
5569
-
5570
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte generated by Svelte v3.49.0 */
5571
-
5572
- function create_if_block$4(ctx) {
5573
- let highlight;
5574
- let current;
5575
-
5576
- const highlight_spread_levels = [
5577
- {
5578
- five: /*five*/ ctx[0],
5579
- pxmm: /*pxmm*/ ctx[1],
5580
- floorIndex: /*floorIndex*/ ctx[2],
5581
- floorplanData: /*floorplanData*/ ctx[4],
5582
- onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
5583
- }
5584
- ];
5585
-
5586
- let highlight_props = {};
5587
-
5588
- for (let i = 0; i < highlight_spread_levels.length; i += 1) {
5589
- highlight_props = internal.assign(highlight_props, highlight_spread_levels[i]);
5590
- }
5591
-
5592
- highlight = new RoomHighlight({ props: highlight_props });
5593
-
5594
- return {
5595
- c() {
5596
- internal.create_component(highlight.$$.fragment);
5597
- },
5598
- m(target, anchor) {
5599
- internal.mount_component(highlight, target, anchor);
5600
- current = true;
5601
- },
5602
- p(ctx, dirty) {
5603
- const highlight_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, onRoomHeightClick*/ 87)
5604
- ? internal.get_spread_update(highlight_spread_levels, [
5605
- {
5606
- five: /*five*/ ctx[0],
5607
- pxmm: /*pxmm*/ ctx[1],
5608
- floorIndex: /*floorIndex*/ ctx[2],
5609
- floorplanData: /*floorplanData*/ ctx[4],
5610
- onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
5611
- }
5612
- ])
5613
- : {};
5614
-
5615
- highlight.$set(highlight_changes);
5616
- },
5617
- i(local) {
5618
- if (current) return;
5619
- internal.transition_in(highlight.$$.fragment, local);
5620
- current = true;
5621
- },
5622
- o(local) {
5623
- internal.transition_out(highlight.$$.fragment, local);
5624
- current = false;
5625
- },
5626
- d(detaching) {
5627
- internal.destroy_component(highlight, detaching);
5628
- }
5629
- };
5630
- }
5631
-
5632
- function create_fragment$a(ctx) {
5633
- let baseimage;
5634
- let t0;
5635
- let extraobjects;
5636
- let t1;
5637
- let if_block_anchor;
5638
- let current;
5639
-
5640
- const baseimage_spread_levels = [
5641
- {
5642
- floorIndex: /*floorIndex*/ ctx[2],
5643
- floorplanData: /*floorplanData*/ ctx[4]
5644
- }
5645
- ];
5646
-
5647
- let baseimage_props = {};
5648
-
5649
- for (let i = 0; i < baseimage_spread_levels.length; i += 1) {
5650
- baseimage_props = internal.assign(baseimage_props, baseimage_spread_levels[i]);
5651
- }
5652
-
5653
- baseimage = new BaseImage({ props: baseimage_props });
5654
-
5655
- extraobjects = new ExtraObjects({
5656
- props: {
5657
- extraObjects: /*currentFloorExtraObjects*/ ctx[5]
5658
- }
5659
- });
5660
-
5661
- let if_block = /*hoverEnable*/ ctx[3] && create_if_block$4(ctx);
5662
-
5663
- return {
5664
- c() {
5665
- internal.create_component(baseimage.$$.fragment);
5666
- t0 = internal.space();
5667
- internal.create_component(extraobjects.$$.fragment);
5668
- t1 = internal.space();
5669
- if (if_block) if_block.c();
5670
- if_block_anchor = internal.empty();
5671
- },
5672
- m(target, anchor) {
5673
- internal.mount_component(baseimage, target, anchor);
5674
- internal.insert(target, t0, anchor);
5675
- internal.mount_component(extraobjects, target, anchor);
5676
- internal.insert(target, t1, anchor);
5677
- if (if_block) if_block.m(target, anchor);
5678
- internal.insert(target, if_block_anchor, anchor);
5679
- current = true;
5680
- },
5681
- p(ctx, [dirty]) {
5682
- const baseimage_changes = (dirty & /*floorIndex, floorplanData*/ 20)
5683
- ? internal.get_spread_update(baseimage_spread_levels, [
5684
- {
5685
- floorIndex: /*floorIndex*/ ctx[2],
5686
- floorplanData: /*floorplanData*/ ctx[4]
5687
- }
5688
- ])
5689
- : {};
5690
-
5691
- baseimage.$set(baseimage_changes);
5692
- const extraobjects_changes = {};
5693
- if (dirty & /*currentFloorExtraObjects*/ 32) extraobjects_changes.extraObjects = /*currentFloorExtraObjects*/ ctx[5];
5694
- extraobjects.$set(extraobjects_changes);
5695
-
5696
- if (/*hoverEnable*/ ctx[3]) {
5697
- if (if_block) {
5698
- if_block.p(ctx, dirty);
5699
-
5700
- if (dirty & /*hoverEnable*/ 8) {
5701
- internal.transition_in(if_block, 1);
5702
- }
5703
- } else {
5704
- if_block = create_if_block$4(ctx);
5705
- if_block.c();
5706
- internal.transition_in(if_block, 1);
5707
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
5708
- }
5709
- } else if (if_block) {
5710
- internal.group_outros();
5711
-
5712
- internal.transition_out(if_block, 1, 1, () => {
5713
- if_block = null;
5714
- });
5715
-
5716
- internal.check_outros();
5717
- }
5718
- },
5719
- i(local) {
5720
- if (current) return;
5721
- internal.transition_in(baseimage.$$.fragment, local);
5722
- internal.transition_in(extraobjects.$$.fragment, local);
5723
- internal.transition_in(if_block);
5724
- current = true;
5725
- },
5726
- o(local) {
5727
- internal.transition_out(baseimage.$$.fragment, local);
5728
- internal.transition_out(extraobjects.$$.fragment, local);
5729
- internal.transition_out(if_block);
5730
- current = false;
5731
- },
5732
- d(detaching) {
5733
- internal.destroy_component(baseimage, detaching);
5734
- if (detaching) internal.detach(t0);
5735
- internal.destroy_component(extraobjects, detaching);
5736
- if (detaching) internal.detach(t1);
5737
- if (if_block) if_block.d(detaching);
5738
- if (detaching) internal.detach(if_block_anchor);
5739
- }
5740
- };
5741
- }
5742
-
5743
- function instance$a($$self, $$props, $$invalidate) {
5744
- let currentFloorExtraObjects;
5745
- let { five } = $$props;
5746
- let { pxmm } = $$props;
5747
- let { floorIndex } = $$props;
5748
- let { hoverEnable } = $$props;
5749
- let { floorplanData } = $$props;
5750
- let { extraObjects = [] } = $$props;
5751
- const onRoomHeightClick = undefined;
5752
-
5753
- $$self.$$set = $$props => {
5754
- if ('five' in $$props) $$invalidate(0, five = $$props.five);
5755
- if ('pxmm' in $$props) $$invalidate(1, pxmm = $$props.pxmm);
5756
- if ('floorIndex' in $$props) $$invalidate(2, floorIndex = $$props.floorIndex);
5757
- if ('hoverEnable' in $$props) $$invalidate(3, hoverEnable = $$props.hoverEnable);
5758
- if ('floorplanData' in $$props) $$invalidate(4, floorplanData = $$props.floorplanData);
5759
- if ('extraObjects' in $$props) $$invalidate(7, extraObjects = $$props.extraObjects);
5760
- };
5761
-
5762
- $$self.$$.update = () => {
5763
- if ($$self.$$.dirty & /*extraObjects, floorIndex*/ 132) {
5764
- $$invalidate(5, currentFloorExtraObjects = extraObjects === null || extraObjects === void 0
5765
- ? void 0
5766
- : extraObjects.filter(object => object.floorIndex === floorIndex));
5767
- }
5768
- };
5769
-
5770
- return [
5771
- five,
5772
- pxmm,
5773
- floorIndex,
5774
- hoverEnable,
5775
- floorplanData,
5776
- currentFloorExtraObjects,
5777
- onRoomHeightClick,
5778
- extraObjects
5779
- ];
5780
- }
5781
-
5782
- class CurrentFloor extends internal.SvelteComponent {
5783
- constructor(options) {
5784
- super();
5785
-
5786
- internal.init(this, options, instance$a, create_fragment$a, internal.safe_not_equal, {
5787
- five: 0,
5788
- pxmm: 1,
5789
- floorIndex: 2,
5790
- hoverEnable: 3,
5791
- floorplanData: 4,
5792
- extraObjects: 7
5793
- });
5794
- }
5795
- }
5796
-
5797
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte generated by Svelte v3.49.0 */
5798
-
5799
- function add_css$8(target) {
5800
- internal.append_styles(target, "svelte-1mvqyqq", ".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}");
5801
- }
5802
-
5803
- // (41:0) {#if visible}
5804
- function create_if_block$3(ctx) {
5805
- let div;
5806
- let div_resize_listener;
5807
- let current;
5808
- let if_block = /*clientWidth*/ ctx[6] !== 0 && create_if_block_1$1(ctx);
5809
-
5810
- return {
5811
- c() {
5812
- div = internal.element("div");
5813
- if (if_block) if_block.c();
5814
- internal.attr(div, "class", "plugin-floorplan-radar svelte-1mvqyqq");
5815
- internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
5816
- },
5817
- m(target, anchor) {
5818
- internal.insert(target, div, anchor);
5819
- if (if_block) if_block.m(div, null);
5820
- div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
5821
- current = true;
5822
- },
5823
- p(ctx, dirty) {
5824
- if (/*clientWidth*/ ctx[6] !== 0) {
5825
- if (if_block) {
5826
- if_block.p(ctx, dirty);
5827
-
5828
- if (dirty & /*clientWidth*/ 64) {
5829
- internal.transition_in(if_block, 1);
5830
- }
5831
- } else {
5832
- if_block = create_if_block_1$1(ctx);
5833
- if_block.c();
5834
- internal.transition_in(if_block, 1);
5835
- if_block.m(div, null);
5836
- }
5837
- } else if (if_block) {
5838
- internal.group_outros();
5839
-
5840
- internal.transition_out(if_block, 1, 1, () => {
5841
- if_block = null;
5842
- });
5843
-
5844
- internal.check_outros();
5845
- }
5846
- },
5847
- i(local) {
5848
- if (current) return;
5849
- internal.transition_in(if_block);
5850
- current = true;
5851
- },
5852
- o(local) {
5853
- internal.transition_out(if_block);
5854
- current = false;
5855
- },
5856
- d(detaching) {
5857
- if (detaching) internal.detach(div);
5858
- if (if_block) if_block.d();
5859
- div_resize_listener();
5860
- }
5861
- };
5862
- }
5863
-
5864
- // (43:4) {#if clientWidth !== 0}
5865
- function create_if_block_1$1(ctx) {
5866
- let div;
5867
- let currentfloor;
5868
- let t;
5869
- let camera;
5870
- let style_width = `${/*contentWidth*/ ctx[8]}px`;
5871
- let style_height = `${/*contentHeight*/ ctx[11]}px`;
5872
- let current;
5873
-
5874
- const currentfloor_spread_levels = [
5875
- {
5876
- five: /*five*/ ctx[0],
5877
- pxmm: /*pxmm*/ ctx[9],
5878
- floorIndex: /*floorIndex*/ ctx[10],
5879
- floorplanData: /*floorplanData*/ ctx[3],
5880
- hoverEnable: /*hoverEnable*/ ctx[2],
5881
- extraObjects: /*extraObjects*/ ctx[5]
5882
- }
5883
- ];
5884
-
5885
- let currentfloor_props = {};
5886
-
5887
- for (let i = 0; i < currentfloor_spread_levels.length; i += 1) {
5888
- currentfloor_props = internal.assign(currentfloor_props, currentfloor_spread_levels[i]);
5889
- }
5890
-
5891
- currentfloor = new CurrentFloor({ props: currentfloor_props });
5892
-
5893
- const camera_spread_levels = [
5894
- {
5895
- pxmm: /*pxmm*/ ctx[9],
5896
- five: /*five*/ ctx[0],
5897
- floorplanData: /*floorplanData*/ ctx[3],
5898
- cameraImageUrl: /*cameraImageUrl*/ ctx[4]
5899
- }
5900
- ];
5901
-
5902
- let camera_props = {};
5903
-
5904
- for (let i = 0; i < camera_spread_levels.length; i += 1) {
5905
- camera_props = internal.assign(camera_props, camera_spread_levels[i]);
5906
- }
5907
-
5908
- camera = new Camera({ props: camera_props });
5909
-
5910
- return {
5911
- c() {
5912
- div = internal.element("div");
5913
- internal.create_component(currentfloor.$$.fragment);
5914
- t = internal.space();
5915
- internal.create_component(camera.$$.fragment);
5916
- internal.attr(div, "class", "plugin-floorplan-radar-container svelte-1mvqyqq");
5917
- internal.set_style(div, "width", style_width, false);
5918
- internal.set_style(div, "height", style_height, false);
5919
- },
5920
- m(target, anchor) {
5921
- internal.insert(target, div, anchor);
5922
- internal.mount_component(currentfloor, div, null);
5923
- internal.append(div, t);
5924
- internal.mount_component(camera, div, null);
5925
- current = true;
5926
- },
5927
- p(ctx, dirty) {
5928
- const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, hoverEnable, extraObjects*/ 1581)
5929
- ? internal.get_spread_update(currentfloor_spread_levels, [
5930
- {
5931
- five: /*five*/ ctx[0],
5932
- pxmm: /*pxmm*/ ctx[9],
5933
- floorIndex: /*floorIndex*/ ctx[10],
5934
- floorplanData: /*floorplanData*/ ctx[3],
5935
- hoverEnable: /*hoverEnable*/ ctx[2],
5936
- extraObjects: /*extraObjects*/ ctx[5]
5937
- }
5938
- ])
5939
- : {};
5940
-
5941
- currentfloor.$set(currentfloor_changes);
5942
-
5943
- const camera_changes = (dirty & /*pxmm, five, floorplanData, cameraImageUrl*/ 537)
5944
- ? internal.get_spread_update(camera_spread_levels, [
5945
- {
5946
- pxmm: /*pxmm*/ ctx[9],
5947
- five: /*five*/ ctx[0],
5948
- floorplanData: /*floorplanData*/ ctx[3],
5949
- cameraImageUrl: /*cameraImageUrl*/ ctx[4]
5950
- }
5951
- ])
5952
- : {};
5953
-
5954
- camera.$set(camera_changes);
5955
-
5956
- if (dirty & /*contentWidth*/ 256 && style_width !== (style_width = `${/*contentWidth*/ ctx[8]}px`)) {
5957
- internal.set_style(div, "width", style_width, false);
5958
- }
5959
-
5960
- if (dirty & /*contentHeight*/ 2048 && style_height !== (style_height = `${/*contentHeight*/ ctx[11]}px`)) {
5961
- internal.set_style(div, "height", style_height, false);
5962
- }
5963
- },
5964
- i(local) {
5965
- if (current) return;
5966
- internal.transition_in(currentfloor.$$.fragment, local);
5967
- internal.transition_in(camera.$$.fragment, local);
5968
- current = true;
5969
- },
5970
- o(local) {
5971
- internal.transition_out(currentfloor.$$.fragment, local);
5972
- internal.transition_out(camera.$$.fragment, local);
5973
- current = false;
5974
- },
5975
- d(detaching) {
5976
- if (detaching) internal.detach(div);
5977
- internal.destroy_component(currentfloor);
5978
- internal.destroy_component(camera);
5979
- }
5980
- };
5981
- }
5982
-
5983
- function create_fragment$9(ctx) {
5984
- let if_block_anchor;
5985
- let current;
5986
- let if_block = /*visible*/ ctx[1] && create_if_block$3(ctx);
5987
-
5988
- return {
5989
- c() {
5990
- if (if_block) if_block.c();
5991
- if_block_anchor = internal.empty();
5992
- },
5993
- m(target, anchor) {
5994
- if (if_block) if_block.m(target, anchor);
5995
- internal.insert(target, if_block_anchor, anchor);
5996
- current = true;
5997
- },
5998
- p(ctx, [dirty]) {
5999
- if (/*visible*/ ctx[1]) {
6000
- if (if_block) {
6001
- if_block.p(ctx, dirty);
6002
-
6003
- if (dirty & /*visible*/ 2) {
6004
- internal.transition_in(if_block, 1);
6005
- }
6006
- } else {
6007
- if_block = create_if_block$3(ctx);
6008
- if_block.c();
6009
- internal.transition_in(if_block, 1);
6010
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
6011
- }
6012
- } else if (if_block) {
6013
- internal.group_outros();
6014
-
6015
- internal.transition_out(if_block, 1, 1, () => {
6016
- if_block = null;
6017
- });
6018
-
6019
- internal.check_outros();
6020
- }
6021
- },
6022
- i(local) {
6023
- if (current) return;
6024
- internal.transition_in(if_block);
6025
- current = true;
6026
- },
6027
- o(local) {
6028
- internal.transition_out(if_block);
6029
- current = false;
6030
- },
6031
- d(detaching) {
6032
- if (if_block) if_block.d(detaching);
6033
- if (detaching) internal.detach(if_block_anchor);
6034
- }
6035
- };
6036
- }
6037
-
6038
- function instance$9($$self, $$props, $$invalidate) {
6039
- let { five } = $$props;
6040
- let { visible } = $$props;
6041
- let { hoverEnable } = $$props;
6042
- let { floorplanData } = $$props;
6043
- let { cameraImageUrl } = $$props;
6044
- let { extraObjects = [] } = $$props;
6045
- let pxmm = 0;
6046
- let floorIndex = 0;
6047
- let clientWidth = 0;
6048
- let clientHeight = 0;
6049
- let contentWidth = 0;
6050
- let contentHeight = 0;
6051
-
6052
- function handlePanoArrived(panoIndex) {
6053
- $$invalidate(10, floorIndex = five.work.observers[panoIndex].floorIndex);
6054
- }
6055
-
6056
- svelte.onMount(() => {
6057
- five.on('panoArrived', handlePanoArrived);
6058
-
6059
- return () => {
6060
- five.off('panoArrived', handlePanoArrived);
6061
- };
6062
- });
6063
-
6064
- function div_elementresize_handler() {
6065
- clientWidth = this.clientWidth;
6066
- clientHeight = this.clientHeight;
6067
- $$invalidate(6, clientWidth);
6068
- $$invalidate(7, clientHeight);
6069
- }
6070
-
6071
- $$self.$$set = $$props => {
6072
- if ('five' in $$props) $$invalidate(0, five = $$props.five);
6073
- if ('visible' in $$props) $$invalidate(1, visible = $$props.visible);
6074
- if ('hoverEnable' in $$props) $$invalidate(2, hoverEnable = $$props.hoverEnable);
6075
- if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
6076
- if ('cameraImageUrl' in $$props) $$invalidate(4, cameraImageUrl = $$props.cameraImageUrl);
6077
- if ('extraObjects' in $$props) $$invalidate(5, extraObjects = $$props.extraObjects);
6078
- };
6079
-
6080
- $$self.$$.update = () => {
6081
- if ($$self.$$.dirty & /*clientWidth, clientHeight, floorplanData, contentWidth*/ 456) {
6082
- {
6083
- const size = Math.min(clientWidth, clientHeight);
6084
- const { max, min } = floorplanData.bounding;
6085
- const boundingWidth = max.x - min.x;
6086
- const boundingHeight = max.y - min.y;
6087
-
6088
- const contentSize = (function getSize() {
6089
- if (boundingWidth > boundingHeight) return [size, size / boundingWidth * boundingHeight];
6090
- return [size / boundingHeight * boundingWidth, size];
6091
- })();
6092
-
6093
- $$invalidate(8, contentWidth = contentSize[0]);
6094
- $$invalidate(11, contentHeight = contentSize[1]);
6095
- $$invalidate(9, pxmm = contentWidth / boundingWidth);
6096
- }
6097
- }
6098
- };
6099
-
6100
- return [
6101
- five,
6102
- visible,
6103
- hoverEnable,
6104
- floorplanData,
6105
- cameraImageUrl,
6106
- extraObjects,
6107
- clientWidth,
6108
- clientHeight,
6109
- contentWidth,
6110
- pxmm,
6111
- floorIndex,
6112
- contentHeight,
6113
- div_elementresize_handler
6114
- ];
6115
- }
6116
-
6117
- class Main extends internal.SvelteComponent {
6118
- constructor(options) {
6119
- super();
6120
-
6121
- internal.init(
6122
- this,
6123
- options,
6124
- instance$9,
6125
- create_fragment$9,
6126
- internal.safe_not_equal,
6127
- {
6128
- five: 0,
6129
- visible: 1,
6130
- hoverEnable: 2,
6131
- floorplanData: 3,
6132
- cameraImageUrl: 4,
6133
- extraObjects: 5
6134
- },
6135
- add_css$8
6136
- );
6137
- }
6138
- }
6139
-
6140
- class Controller$2 extends Controller$4 {
5583
+ class Controller$3 extends Controller$5 {
6141
5584
  constructor(five, params) {
6142
5585
  super(five);
6143
5586
  // =============== public properties =================
@@ -6145,115 +5588,517 @@ class Controller$2 extends Controller$4 {
6145
5588
  enumerable: true,
6146
5589
  configurable: true,
6147
5590
  writable: true,
6148
- value: 'panoFloorplanRadarPlugin'
5591
+ value: 'modelFloorplanPlugin'
5592
+ });
5593
+ Object.defineProperty(this, "state", {
5594
+ enumerable: true,
5595
+ configurable: true,
5596
+ writable: true,
5597
+ value: void 0
5598
+ });
5599
+ // =============== private properties =================
5600
+ Object.defineProperty(this, "data", {
5601
+ enumerable: true,
5602
+ configurable: true,
5603
+ writable: true,
5604
+ value: void 0
5605
+ });
5606
+ /** 展示户型图时,需要正确的状态 */
5607
+ Object.defineProperty(this, "showState", {
5608
+ enumerable: true,
5609
+ configurable: true,
5610
+ writable: true,
5611
+ value: void 0
5612
+ });
5613
+ /** show 动画的公共 Promise */
5614
+ Object.defineProperty(this, "showPromise", {
5615
+ enumerable: true,
5616
+ configurable: true,
5617
+ writable: true,
5618
+ value: void 0
5619
+ });
5620
+ Object.defineProperty(this, "app", {
5621
+ enumerable: true,
5622
+ configurable: true,
5623
+ writable: true,
5624
+ value: undefined
5625
+ });
5626
+ Object.defineProperty(this, "panoIndex", {
5627
+ enumerable: true,
5628
+ configurable: true,
5629
+ writable: true,
5630
+ value: 0
5631
+ });
5632
+ Object.defineProperty(this, "floorIndex", {
5633
+ enumerable: true,
5634
+ configurable: true,
5635
+ writable: true,
5636
+ value: 0
5637
+ });
5638
+ Object.defineProperty(this, "selector", {
5639
+ enumerable: true,
5640
+ configurable: true,
5641
+ writable: true,
5642
+ value: void 0
5643
+ });
5644
+ /** 公共 Promise 的 reject 方法 */
5645
+ Object.defineProperty(this, "showRejection", {
5646
+ enumerable: true,
5647
+ configurable: true,
5648
+ writable: true,
5649
+ value: void 0
5650
+ });
5651
+ /** 户型图父容器 */
5652
+ Object.defineProperty(this, "wrapper", {
5653
+ enumerable: true,
5654
+ configurable: true,
5655
+ writable: true,
5656
+ value: void 0
5657
+ });
5658
+ /** 户型图主容器 */
5659
+ Object.defineProperty(this, "container", {
5660
+ enumerable: true,
5661
+ configurable: true,
5662
+ writable: true,
5663
+ value: document.createElement('div')
5664
+ });
5665
+ /** 展示户型图图前,Five 的 Panorama Longitude */
5666
+ Object.defineProperty(this, "lastPanoramaLongitude", {
5667
+ enumerable: true,
5668
+ configurable: true,
5669
+ writable: true,
5670
+ value: 0
5671
+ });
5672
+ /** 户型图大小 */
5673
+ Object.defineProperty(this, "size", {
5674
+ enumerable: true,
5675
+ configurable: true,
5676
+ writable: true,
5677
+ value: { width: 0, height: 0 }
5678
+ });
5679
+ /** 是否已经执行过事件监听 */
5680
+ Object.defineProperty(this, "hasAddedEventListener", {
5681
+ enumerable: true,
5682
+ configurable: true,
5683
+ writable: true,
5684
+ value: false
5685
+ });
5686
+ /** 上一次隐藏是否是用户调用了 hide 导致的 */
5687
+ Object.defineProperty(this, "isHiddenByHideFunc", {
5688
+ enumerable: true,
5689
+ configurable: true,
5690
+ writable: true,
5691
+ value: false
5692
+ });
5693
+ /** 销毁插件 */
5694
+ Object.defineProperty(this, "dispose", {
5695
+ enumerable: true,
5696
+ configurable: true,
5697
+ writable: true,
5698
+ value: () => {
5699
+ var _a, _b;
5700
+ this.removeEventListener();
5701
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
5702
+ this.app = undefined;
5703
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
5704
+ this.data = undefined;
5705
+ this.wrapper = undefined;
5706
+ this.selector = undefined;
5707
+ this.hooks.emit('dispose');
5708
+ }
5709
+ });
5710
+ /** 展示户型图
5711
+ * 1. show 函数大部分情况下需要耗时
5712
+ * 2. 如果当前已经在展示中,将不会触发任何事件
5713
+ * 3. 如果展示过程被中断,将抛出错误
5714
+ * 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
5715
+ * 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
5716
+ * @param opts.floorIndex 楼层
5717
+ * @param opts.modelOpacity 模型透明度
5718
+ * @param opts.immediately 是否立即展示
5719
+ * @param opts.isAutoShow 是否是自动展示
5720
+ * @param opts.userAction 是否是用户行为
5721
+ */
5722
+ Object.defineProperty(this, "show", {
5723
+ enumerable: true,
5724
+ configurable: true,
5725
+ writable: true,
5726
+ value: async (options = {}) => {
5727
+ if (!this.state.enabled)
5728
+ return;
5729
+ // 已经展示完成了,不做任何操作
5730
+ if (!this.showPromise && this.state.visible)
5731
+ return;
5732
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5733
+ this.updateState({ visible: true }, userAction);
5734
+ this._show(options);
5735
+ }
5736
+ });
5737
+ /** 隐藏户型图 */
5738
+ Object.defineProperty(this, "hide", {
5739
+ enumerable: true,
5740
+ configurable: true,
5741
+ writable: true,
5742
+ value: async (options = {}) => {
5743
+ if (!this.state.enabled)
5744
+ return;
5745
+ this.isHiddenByHideFunc = true;
5746
+ if (this.state.visible === false)
5747
+ return;
5748
+ this.updateState({ visible: false }, options.userAction || true);
5749
+ this._hide(options);
5750
+ }
5751
+ });
5752
+ /** 更新户型图大小 */
5753
+ Object.defineProperty(this, "updateSize", {
5754
+ enumerable: true,
5755
+ configurable: true,
5756
+ writable: true,
5757
+ value: () => {
5758
+ if (!this.data)
5759
+ return;
5760
+ if (!checkShowState(this.five, this.showState))
5761
+ return;
5762
+ if (!this.container || !this.wrapper)
5763
+ return;
5764
+ // 计算户型图展示大小
5765
+ const { min, max } = this.data.bounding;
5766
+ const width = max.x - min.x;
5767
+ const height = max.y - min.y;
5768
+ // 每毫米对应的 px 值
5769
+ const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
5770
+ const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
5771
+ const _width = Math.ceil(width * pxmm);
5772
+ const _height = Math.ceil(height * pxmm);
5773
+ if (this.size.width === _width && this.size.height === _height)
5774
+ return;
5775
+ this.container.style.width = _width + 'px';
5776
+ this.container.style.height = _height + 'px';
5777
+ this.size = { width: _width, height: _height };
5778
+ }
5779
+ });
5780
+ Object.defineProperty(this, "_disable", {
5781
+ enumerable: true,
5782
+ configurable: true,
5783
+ writable: true,
5784
+ value: (options) => {
5785
+ var _a, _b, _c;
5786
+ const { userAction } = options;
5787
+ this.hooks.emit('disable', { userAction });
5788
+ // ===== 处理展示过程中 disable =====
5789
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
5790
+ this.showPromise = undefined;
5791
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
5792
+ this.app = undefined;
5793
+ (_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
5794
+ this.removeEventListener();
5795
+ }
6149
5796
  });
6150
- Object.defineProperty(this, "state", {
5797
+ Object.defineProperty(this, "_enable", {
6151
5798
  enumerable: true,
6152
5799
  configurable: true,
6153
5800
  writable: true,
6154
- value: void 0
5801
+ value: (options) => {
5802
+ const { userAction } = options;
5803
+ this.addEventListener();
5804
+ if (!this.wrapper)
5805
+ return;
5806
+ this.wrapper.append(this.container);
5807
+ this.hooks.emit('enable', { userAction });
5808
+ if (this.state.visible)
5809
+ this._show({ userAction });
5810
+ }
6155
5811
  });
6156
- // =============== protected properties =================
6157
- Object.defineProperty(this, "data", {
5812
+ Object.defineProperty(this, "_show", {
6158
5813
  enumerable: true,
6159
5814
  configurable: true,
6160
5815
  writable: true,
6161
- value: void 0
5816
+ value: async (options) => {
5817
+ var _a;
5818
+ if (!this.state.enabled)
5819
+ return;
5820
+ if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
5821
+ throw new Error(FloorplanErrorType.ModelNotLoaded);
5822
+ if (!this.data)
5823
+ throw new Error(FloorplanErrorType.DataNotLoaded);
5824
+ this.isHiddenByHideFunc = false;
5825
+ // ===== 参数合并 =====
5826
+ const baseShowOpts = {
5827
+ floorIndex: this.floorIndex,
5828
+ modelOpacity: this.state.config.modelOpacity,
5829
+ immediately: false,
5830
+ isAutoShow: false,
5831
+ userAction: true,
5832
+ };
5833
+ const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
5834
+ const getShowPromise = async () => {
5835
+ this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
5836
+ let hasRejected = false;
5837
+ let externalErrorMsg;
5838
+ this.showRejection = (errorMsg) => {
5839
+ hasRejected = true;
5840
+ externalErrorMsg = errorMsg;
5841
+ };
5842
+ const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
5843
+ if (correctError)
5844
+ throw correctError;
5845
+ // 异步结束要判断当前是不是被中断了
5846
+ if (hasRejected)
5847
+ throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
5848
+ // 更新户型图大小
5849
+ this.updateSize();
5850
+ this.updatePosition();
5851
+ // 高亮当前楼层,有两个目的
5852
+ // 1. 点击模型时,可以跳转到当前楼层的点位上
5853
+ // 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
5854
+ this.floorIndex = mergedOptions.floorIndex;
5855
+ this.five.model.show(this.floorIndex);
5856
+ // 模型消失, 渲染户型图
5857
+ const modelOpacity = mergedOptions.modelOpacity;
5858
+ const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
5859
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5860
+ this.render(renderDuration);
5861
+ };
5862
+ this.showPromise = getShowPromise()
5863
+ .then(() => {
5864
+ this.hooks.emit('showAnimationEnded', {
5865
+ auto: mergedOptions.isAutoShow,
5866
+ userAction: mergedOptions.userAction,
5867
+ });
5868
+ })
5869
+ .catch((error) => {
5870
+ this.updateState({ visible: false }, mergedOptions.userAction);
5871
+ // 自动展示的报错内部处理
5872
+ if (mergedOptions.isAutoShow)
5873
+ return;
5874
+ // 非自动展示的报错继续向外抛出
5875
+ if (error instanceof Error)
5876
+ throw error;
5877
+ })
5878
+ .finally(() => {
5879
+ this.showPromise = undefined;
5880
+ this.showRejection = undefined;
5881
+ });
5882
+ return this.showPromise;
5883
+ }
6162
5884
  });
6163
- // =============== private properties =================
6164
- Object.defineProperty(this, "app", {
5885
+ Object.defineProperty(this, "_hide", {
6165
5886
  enumerable: true,
6166
5887
  configurable: true,
6167
5888
  writable: true,
6168
- value: void 0
5889
+ value: (options) => {
5890
+ var _a;
5891
+ // ===== 处理展示过程中 hide =====
5892
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
5893
+ this.showPromise = undefined;
5894
+ // ===== 合并参数 =====
5895
+ const baseOptions = {
5896
+ userAction: true,
5897
+ isAutoHide: false,
5898
+ };
5899
+ const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
5900
+ changeModelCanvasOpacity(this.five, 1, 0);
5901
+ this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
5902
+ this.render();
5903
+ }
6169
5904
  });
6170
- Object.defineProperty(this, "wrapperSelector", {
5905
+ Object.defineProperty(this, "handleClick", {
6171
5906
  enumerable: true,
6172
5907
  configurable: true,
6173
5908
  writable: true,
6174
- value: ''
5909
+ value: () => {
5910
+ if (!this.state.visible)
5911
+ return;
5912
+ const preventDefault = this.hooks.emit('click');
5913
+ if (preventDefault)
5914
+ return false;
5915
+ }
6175
5916
  });
6176
- Object.defineProperty(this, "wrapper", {
5917
+ /** modelLoaded 之后自动执行 append container 操作 */
5918
+ Object.defineProperty(this, "onFiveModelLoaded", {
6177
5919
  enumerable: true,
6178
5920
  configurable: true,
6179
5921
  writable: true,
6180
- value: null
5922
+ value: () => {
5923
+ if (this.state.enabled === false)
5924
+ return;
5925
+ if (this.wrapper)
5926
+ return;
5927
+ if (!this.selector)
5928
+ return;
5929
+ const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
5930
+ if (!wrapper)
5931
+ throw new Error('不正确的父容器选择器');
5932
+ this.wrapper = wrapper;
5933
+ wrapper.append(this.container);
5934
+ }
6181
5935
  });
6182
- Object.defineProperty(this, "disposed", {
5936
+ /** 更改模型时,自动隐藏户型图 */
5937
+ Object.defineProperty(this, "onFiveModeChange", {
6183
5938
  enumerable: true,
6184
5939
  configurable: true,
6185
5940
  writable: true,
6186
- value: false
5941
+ value: (mode) => {
5942
+ // 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
5943
+ if (mode !== this.showState.mode) {
5944
+ this.updateState({ visible: false }, false);
5945
+ this._hide({ userAction: false });
5946
+ }
5947
+ }
6187
5948
  });
6188
- Object.defineProperty(this, "extraObjects", {
5949
+ /** panoIndex 改变时,更新 floorIndex */
5950
+ Object.defineProperty(this, "onFivePanoArrived", {
6189
5951
  enumerable: true,
6190
5952
  configurable: true,
6191
5953
  writable: true,
6192
- value: []
5954
+ value: (index) => {
5955
+ var _a;
5956
+ if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
5957
+ return;
5958
+ this.panoIndex = index;
5959
+ this.floorIndex = this.five.work.observers[index].floorIndex;
5960
+ }
6193
5961
  });
6194
- Object.defineProperty(this, "dispose", {
5962
+ /** cameraUpdate 时判断户型图是否应该自动隐藏 */
5963
+ Object.defineProperty(this, "onFiveCameraUpdate", {
6195
5964
  enumerable: true,
6196
5965
  configurable: true,
6197
5966
  writable: true,
6198
- value: () => {
6199
- var _a;
6200
- this.disposed = true;
6201
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6202
- this.wrapper = null;
6203
- this.wrapperSelector = '';
6204
- this.hooks.emit('dispose');
5967
+ value: (_, userAction) => {
5968
+ if (!this.state.visible)
5969
+ return;
5970
+ // 展示过程中不处理自动隐藏逻辑
5971
+ if (this.showPromise)
5972
+ return;
5973
+ const fiveCurrentState = this.five.getCurrentState();
5974
+ this.updatePosition();
5975
+ this.updateSize();
5976
+ if (shouldFloorplanHideWithPose(fiveCurrentState)) {
5977
+ this.updateState({ visible: false }, userAction);
5978
+ this._hide({ userAction });
5979
+ }
6205
5980
  }
6206
5981
  });
6207
- Object.defineProperty(this, "_disable", {
5982
+ /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
5983
+ Object.defineProperty(this, "onFiveWantsPanGesture", {
6208
5984
  enumerable: true,
6209
5985
  configurable: true,
6210
5986
  writable: true,
6211
- value: (options) => {
6212
- var _a;
6213
- const { userAction } = options;
6214
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6215
- this.app = undefined;
6216
- this.hooks.emit('disable', { userAction });
5987
+ value: (_, isFinal) => {
5988
+ if (this.five.getCurrentState().mode !== this.showState.mode)
5989
+ return;
5990
+ if (this.state.config.autoShowEnable === false)
5991
+ return;
5992
+ if (isFinal && this.state.visible) {
5993
+ this.five.updateCamera(this.showState, 0);
5994
+ // 禁用掉 isFinal 的 panGesture 行为
5995
+ // 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
5996
+ // 此行为也会禁用 pan 结束后的惯性处理
5997
+ return false;
5998
+ }
5999
+ // 自动展示户型图
6000
+ // Five 没有惯性滚动,所以把自动展示的逻辑做在 WantsPanGesture 了
6001
+ if (isFinal && !this.state.visible) {
6002
+ // 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
6003
+ if (this.isHiddenByHideFunc)
6004
+ return;
6005
+ const fiveCurrentState = this.five.getCurrentState();
6006
+ if (fiveCurrentState.mode !== this.showState.mode)
6007
+ return;
6008
+ if (this.state.visible)
6009
+ return;
6010
+ if (shouldFloorplanShowWithPose(fiveCurrentState)) {
6011
+ this.updateState({ visible: true }, true);
6012
+ this._show({ isAutoShow: true });
6013
+ }
6014
+ return false;
6015
+ }
6217
6016
  }
6218
6017
  });
6219
- this.five = five;
6018
+ /** 阻止点击分间走点 */
6019
+ Object.defineProperty(this, "onFiveWantsTapGesture", {
6020
+ enumerable: true,
6021
+ configurable: true,
6022
+ writable: true,
6023
+ value: () => this.handleClick()
6024
+ });
6025
+ /** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
6026
+ Object.defineProperty(this, "onFiveWantsChangeMode", {
6027
+ enumerable: true,
6028
+ configurable: true,
6029
+ writable: true,
6030
+ value: (mode, prevMode) => {
6031
+ if (prevMode === 'Panorama' && mode === this.showState.mode) {
6032
+ this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
6033
+ }
6034
+ }
6035
+ });
6036
+ /** 模型楼层高亮改变时,自动进行楼层切换 */
6037
+ Object.defineProperty(this, "onModelShownFloorChange", {
6038
+ enumerable: true,
6039
+ configurable: true,
6040
+ writable: true,
6041
+ value: (shownFloor) => {
6042
+ if (this.floorIndex === shownFloor)
6043
+ return;
6044
+ if (shownFloor === null) {
6045
+ const panoIndex = this.five.getCurrentState().panoIndex;
6046
+ this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
6047
+ return;
6048
+ }
6049
+ this.floorIndex = shownFloor;
6050
+ this.updateSize();
6051
+ this.render();
6052
+ }
6053
+ });
6054
+ if (params === null || params === void 0 ? void 0 : params.selector) {
6055
+ this.selector = params.selector;
6056
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6057
+ }
6058
+ // =============== init Show State ===============
6059
+ this.showState = {
6060
+ mode: 'Mapview',
6061
+ longitude: 0,
6062
+ latitude: Math.PI / 2,
6063
+ fov: 90,
6064
+ };
6220
6065
  // =============== init State ===============
6221
6066
  const baseConfig = {
6222
- hoverEnable: false,
6067
+ northDesc: '北',
6068
+ modelOpacity: 1,
6069
+ hoverEnable: true,
6070
+ compassEnable: true,
6071
+ autoShowEnable: true,
6072
+ ruleLabelsEnable: true,
6073
+ roomLabelsEnable: true,
6223
6074
  cameraImageUrl: CAMERA_IMAGE,
6075
+ attachedTo: exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
6076
+ getLabelElement: undefined,
6077
+ adaptiveRoomLabelVisibleEnable: true,
6224
6078
  };
6225
- const paramsConfig = (params === null || params === void 0 ? void 0 : params.configs) ? params.configs : {};
6079
+ const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
6226
6080
  const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
6227
- this.state = { enabled: true, visible: true, config };
6228
- // =============== init wrapper ===============
6229
- if (params === null || params === void 0 ? void 0 : params.wrapper)
6230
- console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6231
- if (typeof (params === null || params === void 0 ? void 0 : params.wrapper) === 'string')
6232
- this.wrapperSelector = params.wrapper;
6233
- else if ((params === null || params === void 0 ? void 0 : params.wrapper) instanceof Element)
6234
- this.wrapper = params.wrapper;
6081
+ this.state = {
6082
+ enabled: true,
6083
+ visible: false,
6084
+ config,
6085
+ };
6086
+ // =============== init Container ===============
6087
+ this.initContainer();
6235
6088
  // =============== init Listener ===============
6089
+ // 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
6090
+ // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
6091
+ five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
6236
6092
  five.once('dispose', this.dispose);
6093
+ this.addEventListener();
6237
6094
  }
6238
6095
  async load(serverData, state, userAction = true) {
6239
- // const loadImage = async () => {
6240
- // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
6241
- // // 当有 svgString 时,没有加载过程
6242
- // if (floorplanData.outlines[floorIndex]?.svgContent) return
6243
- // // 如果当前楼层图片不存在,不存在加载过程
6244
- // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
6245
- // if (!nowFloorImageSrc) return
6246
- // // 图片加载完成时再 render
6247
- // await new Promise<void>((resolve) => {
6248
- // const nowFloorImage = new Image()
6249
- // nowFloorImage.src = nowFloorImageSrc
6250
- // nowFloorImage.onload = () => resolve()
6251
- // })
6252
- // }
6253
- // await loadImage()
6254
6096
  function isPluginServerData(serverData) {
6255
6097
  return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6256
6098
  }
6099
+ const _data = serverData;
6100
+ if (_data && !_data.version)
6101
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
6257
6102
  const copyData = JSON.parse(JSON.stringify(serverData));
6258
6103
  const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6259
6104
  const prevData = this.data;
@@ -6264,21 +6109,17 @@ class Controller$2 extends Controller$4 {
6264
6109
  this.updateState(state, userAction);
6265
6110
  this.render();
6266
6111
  }
6267
- async show(options = {}) {
6268
- // 已经展示完成了,不做任何操作
6269
- if (this.state.visible)
6270
- return;
6271
- const userAction = options.userAction !== undefined ? options.userAction : true;
6272
- this.updateState({ visible: true }, userAction);
6273
- this._show({ userAction });
6274
- }
6275
- async hide(options = {}) {
6276
- if (!this.state.visible)
6112
+ /** 把插件的渲染DOM插入到对应的容器中去 */
6113
+ appendTo(wrapper) {
6114
+ this.wrapper = wrapper;
6115
+ // 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
6116
+ if (!this.state.enabled)
6277
6117
  return;
6278
- const userAction = options.userAction !== undefined ? options.userAction : true;
6279
- this.updateState({ visible: false }, userAction);
6280
- this._hide({ userAction });
6118
+ wrapper.appendChild(this.container);
6119
+ this.render();
6120
+ return this;
6281
6121
  }
6122
+ /** 启用插件 */
6282
6123
  enable(options = {}) {
6283
6124
  if (this.state.enabled)
6284
6125
  return;
@@ -6286,6 +6127,7 @@ class Controller$2 extends Controller$4 {
6286
6127
  this.updateState({ enabled: true }, options.userAction || userAction);
6287
6128
  this._enable({ userAction });
6288
6129
  }
6130
+ /** 禁用插件 */
6289
6131
  disable(options = {}) {
6290
6132
  if (!this.state.enabled)
6291
6133
  return;
@@ -6299,56 +6141,29 @@ class Controller$2 extends Controller$4 {
6299
6141
  const userAction = options.userAction !== undefined ? options.userAction : true;
6300
6142
  this.updateState(state, userAction);
6301
6143
  if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
6302
- const options = { userAction };
6303
- state.enabled ? this._enable(options) : this._disable(options);
6144
+ state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
6304
6145
  }
6305
6146
  if (state.visible !== undefined && prevState.visible !== state.visible) {
6306
6147
  const options = { userAction };
6307
6148
  state.visible ? this._show(options) : this._hide(options);
6308
6149
  }
6309
6150
  }
6310
- /** 把插件的渲染DOM插入到对应的容器中去 */
6311
- appendTo(wrapper) {
6312
- this.wrapper = wrapper;
6313
- this.render();
6314
- }
6315
- changeConfigs(config, userAction = true) {
6316
- this.setState({ config }, { userAction });
6317
- this.render();
6318
- }
6319
- setExtraObjectsWith3DPositions(data) {
6320
- if (!this.data)
6151
+ /** 更新户型图位置 */
6152
+ updatePosition() {
6153
+ var _a;
6154
+ const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
6155
+ const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE__namespace.Vector3()).setY(y);
6156
+ if (!modelPosition)
6321
6157
  return;
6322
- this.extraObjects = formatExtraObjects(data, this.five, this.data);
6323
- this.render();
6158
+ const ndcPosition = modelPosition.clone().project(this.five.camera);
6159
+ const left = (ndcPosition.x + 1) / 2;
6160
+ const top = -(ndcPosition.y - 1) / 2;
6161
+ this.container.style.left = left * 100 + '%';
6162
+ this.container.style.top = top * 100 + '%';
6324
6163
  }
6325
6164
  async formatData(serverData) {
6326
6165
  return await formatData(serverData.data);
6327
6166
  }
6328
- _enable(options) {
6329
- const { userAction } = options;
6330
- this.hooks.emit('enable', { userAction });
6331
- if (this.state.visible)
6332
- this._show({ userAction });
6333
- }
6334
- _show(options) {
6335
- if (this.disposed)
6336
- return;
6337
- if (!this.state.enabled)
6338
- return;
6339
- const { userAction } = options;
6340
- this.hooks.emit('show', { userAction });
6341
- this.render();
6342
- }
6343
- _hide(options) {
6344
- if (this.disposed)
6345
- return;
6346
- if (!this.state.enabled)
6347
- return;
6348
- const { userAction } = options;
6349
- this.hooks.emit('hide', { userAction });
6350
- this.render();
6351
- }
6352
6167
  updateState(state, userAction) {
6353
6168
  const prevState = this.state;
6354
6169
  this.state = Object.assign(Object.assign({}, this.state), state);
@@ -6356,142 +6171,76 @@ class Controller$2 extends Controller$4 {
6356
6171
  return;
6357
6172
  this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
6358
6173
  }
6359
- render() {
6360
- if (this.disposed)
6361
- return;
6174
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
6175
+ *
6176
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
6177
+ */
6178
+ initContainer() {
6179
+ this.container.classList.add('floorplan-plugin');
6180
+ Object.assign(this.container.style, {
6181
+ position: 'absolute',
6182
+ left: '50%',
6183
+ top: '50%',
6184
+ transform: 'translate(-50%, -50%)',
6185
+ zIndex: 10,
6186
+ pointerEvents: 'none',
6187
+ });
6188
+ this.five.addExtraElement(this.container);
6189
+ }
6190
+ addEventListener() {
6362
6191
  if (!this.state.enabled)
6363
6192
  return;
6364
- // 处理 wrapper
6365
- if (!this.wrapper && this.wrapperSelector) {
6366
- const _wrapper = document.querySelector(this.wrapperSelector);
6367
- this.wrapper = _wrapper;
6368
- }
6369
- if (!this.data || !this.wrapper)
6193
+ if (this.hasAddedEventListener)
6370
6194
  return;
6371
- const props = Object.assign(Object.assign({}, this.state.config), { five: this.five, floorplanData: this.data, visible: this.state.visible, extraObjects: this.extraObjects });
6372
- this.app ? this.app.$set(props) : (this.app = new Main({ target: this.wrapper, props }));
6373
- }
6374
- }
6375
-
6376
- const PanoFloorplanRadarPlugin = (five, params) => {
6377
- return new Controller$2(five, params);
6378
- };
6379
-
6380
- /**
6381
- * 传入一个 Promise
6382
- * 无异常,返回 [null, data]
6383
- * 有异常,则返回 [Error, undefined]
6384
- * 用于替代 try&catch 处理 await 异常的方案
6385
- */
6386
- async function to(promise) {
6387
- try {
6388
- const data = await promise;
6389
- return [null, data];
6195
+ const five = this.five;
6196
+ five.on('modeChange', this.onFiveModeChange);
6197
+ five.on('panoArrived', this.onFivePanoArrived);
6198
+ five.on('cameraUpdate', this.onFiveCameraUpdate);
6199
+ five.on('wantsPanGesture', this.onFiveWantsPanGesture);
6200
+ five.on('wantsTapGesture', this.onFiveWantsTapGesture);
6201
+ five.on('wantsChangeMode', this.onFiveWantsChangeMode);
6202
+ five.on('modelShownFloorChange', this.onModelShownFloorChange);
6390
6203
  }
6391
- catch (error) {
6392
- if (error instanceof Error)
6393
- return [error, null];
6394
- return [new Error(''), null];
6204
+ removeEventListener() {
6205
+ const five = this.five;
6206
+ this.hasAddedEventListener = false;
6207
+ // 注意这里并没有消除 dispose 的监听
6208
+ five.off('modelLoaded', this.onFiveModelLoaded);
6209
+ five.off('modeChange', this.onFiveModeChange);
6210
+ five.off('panoArrived', this.onFivePanoArrived);
6211
+ five.off('cameraUpdate', this.onFiveCameraUpdate);
6212
+ five.off('wantsPanGesture', this.onFiveWantsPanGesture);
6213
+ five.off('wantsTapGesture', this.onFiveWantsTapGesture);
6214
+ five.off('wantsChangeMode', this.onFiveWantsChangeMode);
6215
+ five.off('modelShownFloorChange', this.onModelShownFloorChange);
6395
6216
  }
6396
- }
6397
-
6398
- var FloorplanErrorType;
6399
- (function (FloorplanErrorType) {
6400
- /** 意料之外的错误 */
6401
- FloorplanErrorType["UnknownError"] = "UnknownError";
6402
- /** 数据未加载 */
6403
- FloorplanErrorType["DataNotLoaded"] = "DataNotLoaded";
6404
- /** 展示过程被隐藏打断 */
6405
- FloorplanErrorType["BreakOffByHide"] = "BreakOffByHide";
6406
- /** 展示过程中插件被禁用 */
6407
- FloorplanErrorType["BreakOffByDisable"] = "BreakOffByDisable";
6408
- /** 模型未加载完成 */
6409
- FloorplanErrorType["ModelNotLoaded"] = "ModelNotLoaded";
6410
- /** Five changeMode 行为不符合预期 */
6411
- FloorplanErrorType["ChangeModeError"] = "ChangeModeError";
6412
- /** Five updateCamera 行为不符合预期 */
6413
- FloorplanErrorType["UpdateCameraError"] = "UpdateCameraError";
6414
- })(FloorplanErrorType || (FloorplanErrorType = {}));
6415
- /** 户型图展示 & 模型消失的默认时间 */
6416
- const SHOW_ANIME_DURATION = 500;
6417
- /** Five camera 默认 fov */
6418
- const FIVE_CAMERA_DEFAULT_FOV = 80;
6419
-
6420
- /** 判断当前状态是否可以展示户型图 */
6421
- function checkShowState(five, showState) {
6422
- if (five.currentMode !== showState.mode)
6423
- return false;
6424
- const { latitude, longitude, fov } = showState;
6425
- const { latitude: _latitude, longitude: _longitude } = five.getCurrentState();
6426
- const _fov = five.camera.fov;
6427
- if (!nearlyEqual(latitude, _latitude, 2))
6428
- return false;
6429
- if (!nearlyEqual(longitude, _longitude, 2))
6430
- return false;
6431
- if (fov !== _fov)
6432
- return false;
6433
- return true;
6434
- }
6435
- /** 更改 Five 状态到展示户型图的状态
6436
- * 1. 判断状态不符合时,会纠正到正确的状态
6437
- * 2. 内置了相应的动画时间计算
6438
- * 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
6439
- */
6440
- async function correctFiveState(five, showState, userAction = true) {
6441
- // 当前已满足状态,不需要变更
6442
- const result = checkShowState(five, showState);
6443
- if (result === true)
6444
- return;
6445
- const currentFiveState = five.getCurrentState();
6446
- // 纠正 mode
6447
- if (currentFiveState.mode !== showState.mode) {
6448
- const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
6449
- if (changeModeError)
6450
- throw new Error(FloorplanErrorType.ChangeModeError);
6451
- return;
6217
+ render(duration) {
6218
+ if (!this.state.enabled)
6219
+ return;
6220
+ if (!this.container || !this.data)
6221
+ return;
6222
+ if (this.size.width === 0)
6223
+ return;
6224
+ const props = Object.assign(Object.assign({}, this.state.config), { visible: this.state.visible, duration: duration !== null && duration !== void 0 ? duration : 0, panoIndex: this.panoIndex, floorIndex: this.floorIndex, floorplanData: this.data, lastPanoramaLongitude: this.lastPanoramaLongitude });
6225
+ if (this.app)
6226
+ return this.app.$set(props);
6227
+ this.app = new Main$1({ target: this.container, intro: true, props });
6452
6228
  }
6453
- // 纠正相机状态
6454
- // 根据 latitude、longitude、fov 计算动画时间,最多 1s
6455
- const { latitude, longitude, fov } = currentFiveState;
6456
- const time = Math.min(1000, Math.max(200, Math.abs(latitude - Math.PI / 2) * 1000, (longitude > Math.PI ? 2 * Math.PI - longitude : longitude) * 500, Math.abs(fov - showState.fov) * 10));
6457
- const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
6458
- if (updateCameraError)
6459
- throw new Error(FloorplanErrorType.UpdateCameraError);
6460
- return;
6461
6229
  }
6462
6230
 
6463
- /** 当前 five 的相机视角是否满足户型图自动隐藏条件
6464
- *
6465
- * @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
6466
- *
6467
- */
6468
- function shouldFloorplanHideWithPose(pose) {
6469
- const { latitude, longitude } = pose;
6470
- const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
6471
- const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
6472
- return latitudeHide || longitudeHide;
6473
- }
6474
- /** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
6475
- *
6476
- * @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
6477
- *
6478
- */
6479
- function shouldFloorplanShowWithPose(pose) {
6480
- const { latitude, longitude } = pose;
6481
- const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
6482
- const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
6483
- return latitudeVisible && longitudeVisible;
6484
- }
6485
- class Controller$1 extends Controller$4 {
6231
+ const MapviewFloorplanPlugin = (five, params) => {
6232
+ return new Controller$3(five, params);
6233
+ };
6234
+
6235
+ class Controller$2 extends Controller$5 {
6486
6236
  constructor(five, params) {
6487
- var _a;
6488
6237
  super(five);
6489
6238
  // =============== public properties =================
6490
6239
  Object.defineProperty(this, "name", {
6491
6240
  enumerable: true,
6492
6241
  configurable: true,
6493
6242
  writable: true,
6494
- value: 'modelFloorplanPlugin'
6243
+ value: 'topviewFloorplanPlugin'
6495
6244
  });
6496
6245
  Object.defineProperty(this, "state", {
6497
6246
  enumerable: true,
@@ -6506,26 +6255,18 @@ class Controller$1 extends Controller$4 {
6506
6255
  writable: true,
6507
6256
  value: void 0
6508
6257
  });
6509
- /** 展示户型图时,需要正确的状态 */
6510
- Object.defineProperty(this, "showState", {
6258
+ Object.defineProperty(this, "app", {
6511
6259
  enumerable: true,
6512
6260
  configurable: true,
6513
6261
  writable: true,
6514
- value: void 0
6262
+ value: undefined
6515
6263
  });
6516
- /** show 动画的公共 Promise */
6517
- Object.defineProperty(this, "showPromise", {
6264
+ Object.defineProperty(this, "selector", {
6518
6265
  enumerable: true,
6519
6266
  configurable: true,
6520
6267
  writable: true,
6521
6268
  value: void 0
6522
6269
  });
6523
- Object.defineProperty(this, "app", {
6524
- enumerable: true,
6525
- configurable: true,
6526
- writable: true,
6527
- value: undefined
6528
- });
6529
6270
  Object.defineProperty(this, "panoIndex", {
6530
6271
  enumerable: true,
6531
6272
  configurable: true,
@@ -6538,19 +6279,6 @@ class Controller$1 extends Controller$4 {
6538
6279
  writable: true,
6539
6280
  value: 0
6540
6281
  });
6541
- Object.defineProperty(this, "selector", {
6542
- enumerable: true,
6543
- configurable: true,
6544
- writable: true,
6545
- value: void 0
6546
- });
6547
- /** 公共 Promise 的 reject 方法 */
6548
- Object.defineProperty(this, "showRejection", {
6549
- enumerable: true,
6550
- configurable: true,
6551
- writable: true,
6552
- value: void 0
6553
- });
6554
6282
  /** 户型图父容器 */
6555
6283
  Object.defineProperty(this, "wrapper", {
6556
6284
  enumerable: true,
@@ -6593,65 +6321,6 @@ class Controller$1 extends Controller$4 {
6593
6321
  writable: true,
6594
6322
  value: false
6595
6323
  });
6596
- /** 销毁插件 */
6597
- Object.defineProperty(this, "dispose", {
6598
- enumerable: true,
6599
- configurable: true,
6600
- writable: true,
6601
- value: () => {
6602
- var _a, _b;
6603
- this.removeEventListener();
6604
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6605
- this.app = undefined;
6606
- (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
6607
- this.data = undefined;
6608
- this.wrapper = undefined;
6609
- this.selector = undefined;
6610
- this.hooks.emit('dispose');
6611
- }
6612
- });
6613
- /** 展示户型图
6614
- * 1. show 函数大部分情况下需要耗时
6615
- * 2. 如果当前已经在展示中,将不会触发任何事件
6616
- * 3. 如果展示过程被中断,将抛出错误
6617
- * 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
6618
- * 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
6619
- * @param opts.floorIndex 楼层
6620
- * @param opts.modelOpacity 模型透明度
6621
- * @param opts.immediately 是否立即展示
6622
- * @param opts.isAutoShow 是否是自动展示
6623
- * @param opts.userAction 是否是用户行为
6624
- */
6625
- Object.defineProperty(this, "show", {
6626
- enumerable: true,
6627
- configurable: true,
6628
- writable: true,
6629
- value: async (options = {}) => {
6630
- if (!this.state.enabled)
6631
- return;
6632
- // 已经展示完成了,不做任何操作
6633
- if (!this.showPromise && this.state.visible)
6634
- return;
6635
- const userAction = options.userAction !== undefined ? options.userAction : true;
6636
- this.updateState({ visible: true }, userAction);
6637
- this._show(options);
6638
- }
6639
- });
6640
- /** 隐藏户型图 */
6641
- Object.defineProperty(this, "hide", {
6642
- enumerable: true,
6643
- configurable: true,
6644
- writable: true,
6645
- value: async (options = {}) => {
6646
- if (!this.state.enabled)
6647
- return;
6648
- this.isHiddenByHideFunc = true;
6649
- if (this.state.visible === false)
6650
- return;
6651
- this.updateState({ visible: false }, options.userAction || true);
6652
- this._hide(options);
6653
- }
6654
- });
6655
6324
  /** 更新户型图大小 */
6656
6325
  Object.defineProperty(this, "updateSize", {
6657
6326
  enumerable: true,
@@ -6660,10 +6329,10 @@ class Controller$1 extends Controller$4 {
6660
6329
  value: () => {
6661
6330
  if (!this.data)
6662
6331
  return;
6663
- if (!checkShowState(this.five, this.showState))
6664
- return;
6665
6332
  if (!this.container || !this.wrapper)
6666
6333
  return;
6334
+ if (this.five.getCurrentState().mode !== 'Topview')
6335
+ return;
6667
6336
  // 计算户型图展示大小
6668
6337
  const { min, max } = this.data.bounding;
6669
6338
  const width = max.x - min.x;
@@ -6680,349 +6349,1362 @@ class Controller$1 extends Controller$4 {
6680
6349
  this.size = { width: _width, height: _height };
6681
6350
  }
6682
6351
  });
6352
+ /** 销毁插件 */
6353
+ Object.defineProperty(this, "dispose", {
6354
+ enumerable: true,
6355
+ configurable: true,
6356
+ writable: true,
6357
+ value: () => {
6358
+ var _a, _b;
6359
+ this.removeEventListener();
6360
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6361
+ this.app = undefined;
6362
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
6363
+ this.data = undefined;
6364
+ this.wrapper = undefined;
6365
+ this.selector = undefined;
6366
+ this.hooks.emit('dispose');
6367
+ }
6368
+ });
6683
6369
  Object.defineProperty(this, "_disable", {
6684
6370
  enumerable: true,
6685
6371
  configurable: true,
6686
6372
  writable: true,
6687
6373
  value: (options) => {
6688
- var _a, _b, _c;
6374
+ var _a, _b;
6689
6375
  const { userAction } = options;
6690
- this.hooks.emit('disable', { userAction });
6691
- // ===== 处理展示过程中 disable =====
6692
- (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
6693
- this.showPromise = undefined;
6694
- (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
6376
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6695
6377
  this.app = undefined;
6696
- (_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
6378
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
6697
6379
  this.removeEventListener();
6380
+ this.hooks.emit('disable', { userAction });
6698
6381
  }
6699
6382
  });
6700
- Object.defineProperty(this, "_enable", {
6383
+ /** modelLoaded 之后自动执行 append container 操作 */
6384
+ Object.defineProperty(this, "onFiveModelLoaded", {
6701
6385
  enumerable: true,
6702
6386
  configurable: true,
6703
6387
  writable: true,
6704
- value: (options) => {
6705
- const { userAction } = options;
6706
- this.addEventListener();
6707
- if (!this.wrapper)
6388
+ value: () => {
6389
+ if (this.state.enabled === false)
6708
6390
  return;
6709
- this.wrapper.append(this.container);
6710
- this.hooks.emit('enable', { userAction });
6711
- if (this.state.visible)
6712
- this._show({ userAction });
6391
+ if (this.wrapper)
6392
+ return;
6393
+ if (!this.selector)
6394
+ return;
6395
+ const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
6396
+ if (!wrapper)
6397
+ throw new Error('不正确的父容器选择器');
6398
+ this.wrapper = wrapper;
6399
+ wrapper.append(this.container);
6713
6400
  }
6714
6401
  });
6715
- Object.defineProperty(this, "_show", {
6402
+ /** Topview 态隐藏户型图 */
6403
+ Object.defineProperty(this, "onFiveModeChange", {
6716
6404
  enumerable: true,
6717
6405
  configurable: true,
6718
6406
  writable: true,
6719
- value: async (options) => {
6720
- var _a;
6721
- if (!this.state.enabled)
6722
- return;
6723
- if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
6724
- throw new Error(FloorplanErrorType.ModelNotLoaded);
6725
- if (!this.data)
6726
- throw new Error(FloorplanErrorType.DataNotLoaded);
6727
- this.isHiddenByHideFunc = false;
6728
- // ===== 参数合并 =====
6729
- const baseShowOpts = {
6730
- floorIndex: this.floorIndex,
6731
- modelOpacity: this.state.config.modelOpacity,
6732
- immediately: false,
6733
- isAutoShow: false,
6734
- userAction: true,
6735
- };
6736
- const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
6737
- const getShowPromise = async () => {
6738
- this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
6739
- let hasRejected = false;
6740
- let externalErrorMsg;
6741
- this.showRejection = (errorMsg) => {
6742
- hasRejected = true;
6743
- externalErrorMsg = errorMsg;
6744
- };
6745
- const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
6746
- if (correctError)
6747
- throw correctError;
6748
- // 异步结束要判断当前是不是被中断了
6749
- if (hasRejected)
6750
- throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
6751
- // 更新户型图大小
6752
- this.updateSize();
6753
- // 高亮当前楼层,有两个目的
6754
- // 1. 点击模型时,可以跳转到当前楼层的点位上
6755
- // 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
6756
- this.floorIndex = mergedOptions.floorIndex;
6757
- this.five.model.show(this.floorIndex);
6758
- // 模型消失, 渲染户型图
6759
- const modelOpacity = mergedOptions.modelOpacity;
6760
- const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
6761
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6762
- this.render(renderDuration);
6763
- };
6764
- this.showPromise = getShowPromise()
6765
- .then(() => {
6766
- this.hooks.emit('showAnimationEnded', {
6767
- auto: mergedOptions.isAutoShow,
6768
- userAction: mergedOptions.userAction,
6769
- });
6770
- })
6771
- .catch((error) => {
6772
- this.updateState({ visible: false }, mergedOptions.userAction);
6773
- // 自动展示的报错内部处理
6774
- if (mergedOptions.isAutoShow)
6775
- return;
6776
- // 非自动展示的报错继续向外抛出
6777
- if (error instanceof Error)
6778
- throw error;
6779
- })
6780
- .finally(() => {
6781
- this.showPromise = undefined;
6782
- this.showRejection = undefined;
6783
- });
6784
- return this.showPromise;
6407
+ value: (...[mode, , , , userAction]) => {
6408
+ if (mode !== 'Topview' && this.state.visible) {
6409
+ this.updateState({ visible: false }, userAction);
6410
+ this._hide({ userAction });
6411
+ }
6785
6412
  }
6786
6413
  });
6787
- Object.defineProperty(this, "_hide", {
6414
+ Object.defineProperty(this, "onFivePanoArrived", {
6788
6415
  enumerable: true,
6789
6416
  configurable: true,
6790
6417
  writable: true,
6791
- value: (options) => {
6418
+ value: (index) => {
6792
6419
  var _a;
6793
- // ===== 处理展示过程中 hide =====
6794
- (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
6795
- this.showPromise = undefined;
6796
- // ===== 合并参数 =====
6797
- const baseOptions = {
6798
- userAction: true,
6799
- isAutoHide: false,
6800
- };
6801
- const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
6802
- changeModelCanvasOpacity(this.five, 1, 0);
6803
- this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
6804
- this.render();
6420
+ if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
6421
+ return;
6422
+ this.panoIndex = index;
6423
+ this.floorIndex = this.five.work.observers[index].floorIndex;
6805
6424
  }
6806
6425
  });
6807
- Object.defineProperty(this, "handleClick", {
6426
+ Object.defineProperty(this, "onFiveCameraUpdate", {
6808
6427
  enumerable: true,
6809
6428
  configurable: true,
6810
6429
  writable: true,
6811
- value: () => {
6430
+ value: (_, userAction) => {
6812
6431
  if (!this.state.visible)
6813
6432
  return;
6814
- const preventDefault = this.hooks.emit('click');
6815
- if (preventDefault)
6433
+ this.updatePosition();
6434
+ this.updateSize();
6435
+ }
6436
+ });
6437
+ Object.defineProperty(this, "onFiveWantsGesture", {
6438
+ enumerable: true,
6439
+ configurable: true,
6440
+ writable: true,
6441
+ value: (type) => {
6442
+ if (type !== 'pan' && type !== 'pinch' && type !== 'mouseWheel')
6443
+ return;
6444
+ if (this.state.visible && !this.state.config.gestureEnable)
6445
+ return false;
6446
+ }
6447
+ });
6448
+ Object.defineProperty(this, "onFiveWantsMoveToPano", {
6449
+ enumerable: true,
6450
+ configurable: true,
6451
+ writable: true,
6452
+ value: () => {
6453
+ if (this.state.visible && this.state.config.preventRoomClick)
6816
6454
  return false;
6817
6455
  }
6818
6456
  });
6819
- /** modelLoaded 之后自动执行 append container 操作 */
6820
- Object.defineProperty(this, "onFiveModelLoaded", {
6457
+ /** 动画结束后是 Topview 态就展示户型图 */
6458
+ Object.defineProperty(this, "onFiveInitAnimationEnded", {
6459
+ enumerable: true,
6460
+ configurable: true,
6461
+ writable: true,
6462
+ value: (...[, , userAction]) => {
6463
+ const { mode } = this.five.getCurrentState();
6464
+ if (mode === 'Topview' && !this.isHiddenByHideFunc && !this.state.visible && this.state.config.autoShowEnable) {
6465
+ this.updateState({ visible: true }, userAction);
6466
+ this._show({ userAction });
6467
+ }
6468
+ }
6469
+ });
6470
+ Object.defineProperty(this, "onModelShownFloorChange", {
6471
+ enumerable: true,
6472
+ configurable: true,
6473
+ writable: true,
6474
+ value: (shownFloor) => {
6475
+ if (this.floorIndex === shownFloor)
6476
+ return;
6477
+ if (shownFloor === null) {
6478
+ const panoIndex = this.five.getCurrentState().panoIndex;
6479
+ this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
6480
+ return;
6481
+ }
6482
+ // 模型楼层高亮改变时,自动进行楼层切换
6483
+ this.floorIndex = shownFloor;
6484
+ this.updateSize();
6485
+ this.render();
6486
+ }
6487
+ });
6488
+ if (params === null || params === void 0 ? void 0 : params.selector) {
6489
+ this.selector = params.selector;
6490
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6491
+ }
6492
+ // =============== init State ===============
6493
+ const baseConfig = {
6494
+ northDesc: '北',
6495
+ modelOpacity: 1,
6496
+ hoverEnable: true,
6497
+ compassEnable: true,
6498
+ gestureEnable: false,
6499
+ autoShowEnable: true,
6500
+ ruleLabelsEnable: true,
6501
+ roomLabelsEnable: true,
6502
+ cameraImageUrl: CAMERA_IMAGE,
6503
+ attachedTo: exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
6504
+ getLabelElement: undefined,
6505
+ adaptiveRoomLabelVisibleEnable: true,
6506
+ };
6507
+ const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
6508
+ const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
6509
+ this.state = {
6510
+ enabled: true,
6511
+ visible: false,
6512
+ config,
6513
+ };
6514
+ // =============== init Container ===============
6515
+ this.initContainer();
6516
+ // =============== init Listener ===============
6517
+ // 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
6518
+ // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
6519
+ five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
6520
+ five.once('dispose', this.dispose);
6521
+ this.addEventListener();
6522
+ }
6523
+ async load(serverData, state, userAction = true) {
6524
+ function isPluginServerData(serverData) {
6525
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6526
+ }
6527
+ const _data = serverData;
6528
+ if (_data && !_data.version)
6529
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
6530
+ const copyData = JSON.parse(JSON.stringify(serverData));
6531
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6532
+ const prevData = this.data;
6533
+ this.data = await formatData(_serverData);
6534
+ this.hooks.emit('dataLoaded', this.data);
6535
+ this.hooks.emit('dataChange', this.data, prevData);
6536
+ if (state)
6537
+ this.updateState(state, userAction);
6538
+ this.render();
6539
+ }
6540
+ /** 更新户型图位置 */
6541
+ updatePosition() {
6542
+ var _a;
6543
+ const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
6544
+ const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE__namespace.Vector3()).setY(y);
6545
+ if (!modelPosition)
6546
+ return;
6547
+ const ndcPosition = modelPosition.clone().project(this.five.camera);
6548
+ const left = (ndcPosition.x + 1) / 2;
6549
+ const top = -(ndcPosition.y - 1) / 2;
6550
+ this.container.style.left = left * 100 + '%';
6551
+ this.container.style.top = top * 100 + '%';
6552
+ }
6553
+ /** 把插件的渲染DOM插入到对应的容器中去 */
6554
+ appendTo(wrapper) {
6555
+ this.wrapper = wrapper;
6556
+ // 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
6557
+ if (!this.state.enabled)
6558
+ return;
6559
+ wrapper.appendChild(this.container);
6560
+ this.render();
6561
+ return this;
6562
+ }
6563
+ async show(options = {}) {
6564
+ // 已经展示完成了,不做任何操作
6565
+ if (this.state.visible)
6566
+ return;
6567
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6568
+ this.updateState({ visible: true }, userAction);
6569
+ this._show({ userAction });
6570
+ }
6571
+ async hide(options = {}) {
6572
+ this.isHiddenByHideFunc = true;
6573
+ if (!this.state.visible)
6574
+ return;
6575
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6576
+ this.updateState({ visible: false }, userAction);
6577
+ this._hide({ userAction });
6578
+ }
6579
+ enable(options = {}) {
6580
+ if (this.state.enabled)
6581
+ return;
6582
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6583
+ this.updateState({ enabled: true }, options.userAction || userAction);
6584
+ this._enable({ userAction });
6585
+ }
6586
+ disable(options = {}) {
6587
+ if (!this.state.enabled)
6588
+ return;
6589
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6590
+ this.updateState({ enabled: false }, options.userAction || userAction);
6591
+ this._disable({ userAction });
6592
+ }
6593
+ /** 更改插件 State */
6594
+ setState(state, options = {}) {
6595
+ const prevState = this.state;
6596
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6597
+ this.updateState(state, userAction);
6598
+ if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
6599
+ const options = { userAction };
6600
+ state.enabled ? this._enable(options) : this._disable(options);
6601
+ }
6602
+ if (state.visible !== undefined && prevState.visible !== state.visible) {
6603
+ const options = { userAction };
6604
+ state.visible ? this._show(options) : this._hide(options);
6605
+ }
6606
+ }
6607
+ async formatData(serverData) {
6608
+ return await formatData(serverData.data);
6609
+ }
6610
+ async _show(options) {
6611
+ if (!this.state.enabled)
6612
+ return;
6613
+ this.isHiddenByHideFunc = false;
6614
+ const { userAction } = options;
6615
+ this.hooks.emit('show', { userAction });
6616
+ if (this.five.getCurrentState().mode !== 'Topview') {
6617
+ await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
6618
+ }
6619
+ this.five.model.show(this.floorIndex);
6620
+ this.updatePosition();
6621
+ this.updateSize();
6622
+ const renderDuration = 500;
6623
+ const modelOpacity = this.state.config.modelOpacity;
6624
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6625
+ this.hooks.emit('showAnimationEnded', { userAction });
6626
+ this.render();
6627
+ }
6628
+ async _hide(options) {
6629
+ if (!this.state.enabled)
6630
+ return;
6631
+ const { userAction } = options;
6632
+ this.hooks.emit('hide', { userAction });
6633
+ const modelOpacity = 1;
6634
+ const renderDuration = 0;
6635
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6636
+ this.render();
6637
+ }
6638
+ _enable(options) {
6639
+ const { userAction } = options;
6640
+ this.addEventListener();
6641
+ if (this.wrapper)
6642
+ this.wrapper.append(this.container);
6643
+ this.hooks.emit('enable', { userAction });
6644
+ if (this.state.visible)
6645
+ this._show({ userAction });
6646
+ }
6647
+ updateState(state, userAction) {
6648
+ const prevState = this.state;
6649
+ this.state = Object.assign(Object.assign({}, this.state), state);
6650
+ if (equal(this.state, prevState, { deep: true }))
6651
+ return;
6652
+ this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
6653
+ }
6654
+ addEventListener() {
6655
+ if (!this.state.enabled)
6656
+ return;
6657
+ if (this.hasAddedEventListener)
6658
+ return;
6659
+ const five = this.five;
6660
+ five.on('modeChange', this.onFiveModeChange);
6661
+ five.on('panoArrived', this.onFivePanoArrived);
6662
+ five.on('cameraUpdate', this.onFiveCameraUpdate);
6663
+ five.on('wantsGesture', this.onFiveWantsGesture);
6664
+ five.on('wantsMoveToPano', this.onFiveWantsMoveToPano);
6665
+ five.on('initAnimationEnded', this.onFiveInitAnimationEnded);
6666
+ five.on('modelShownFloorChange', this.onModelShownFloorChange);
6667
+ }
6668
+ removeEventListener() {
6669
+ const five = this.five;
6670
+ this.hasAddedEventListener = false;
6671
+ // 注意这里并没有消除 dispose 的监听
6672
+ five.off('modeChange', this.onFiveModeChange);
6673
+ five.off('panoArrived', this.onFivePanoArrived);
6674
+ five.off('cameraUpdate', this.onFiveCameraUpdate);
6675
+ five.off('wantsGesture', this.onFiveWantsGesture);
6676
+ five.off('wantsMoveToPano', this.onFiveWantsMoveToPano);
6677
+ five.off('initAnimationEnded', this.onFiveInitAnimationEnded);
6678
+ five.off('modelShownFloorChange', this.onModelShownFloorChange);
6679
+ }
6680
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
6681
+ *
6682
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
6683
+ */
6684
+ initContainer() {
6685
+ this.container.classList.add('floorplan-plugin');
6686
+ Object.assign(this.container.style, {
6687
+ position: 'absolute',
6688
+ left: '50%',
6689
+ top: '50%',
6690
+ transform: 'translate3d(-50%, -50%, 10px)',
6691
+ zIndex: 10,
6692
+ pointerEvents: 'none',
6693
+ 'will-change': 'width, height',
6694
+ });
6695
+ this.five.addExtraElement(this.container);
6696
+ }
6697
+ render(duration) {
6698
+ if (!this.state.enabled)
6699
+ return;
6700
+ if (!this.container || !this.data)
6701
+ return;
6702
+ if (this.size.width === 0)
6703
+ return;
6704
+ const props = Object.assign(Object.assign({}, this.state.config), { visible: this.state.visible, duration: duration !== null && duration !== void 0 ? duration : 0, panoIndex: this.panoIndex, floorIndex: this.floorIndex, floorplanData: this.data, lastPanoramaLongitude: this.lastPanoramaLongitude });
6705
+ if (this.app)
6706
+ return this.app.$set(props);
6707
+ this.app = new Main$1({ target: this.container, intro: true, props });
6708
+ }
6709
+ }
6710
+
6711
+ const TopviewFloorplanPlugin = (five, params) => {
6712
+ return new Controller$2(five, params);
6713
+ };
6714
+
6715
+ /**
6716
+ * 创建一个防抖动函数,该函数在高频调用时会每隔 wait 毫秒后调用 func 方法
6717
+ * `throttle` 会在第一次调用时立刻调用一次
6718
+ * @param func - 要防抖动的函数
6719
+ * @param wait - 需要延迟的毫秒数
6720
+ */
6721
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6722
+ function throttle(func, wait = 200) {
6723
+ let last;
6724
+ return function (...args) {
6725
+ if (last)
6726
+ return;
6727
+ func(...args);
6728
+ last = setTimeout(function () {
6729
+ last = null;
6730
+ }, wait);
6731
+ };
6732
+ }
6733
+
6734
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte generated by Svelte v3.49.0 */
6735
+
6736
+ function add_css$a(target) {
6737
+ internal.append_styles(target, "svelte-1ty3s4p", ".plugin-radar__camera-wrapper.svelte-1ty3s4p{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1ty3s4p{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1ty3s4p{position:absolute;left:-0.78125rem;top:-0.78125rem;width:0.88542rem;height:0.88542rem;transform-origin:0.78125rem 0.78125rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}");
6738
+ }
6739
+
6740
+ function create_fragment$c(ctx) {
6741
+ let div2;
6742
+ let div1;
6743
+ let div0;
6744
+
6745
+ return {
6746
+ c() {
6747
+ div2 = internal.element("div");
6748
+ div1 = internal.element("div");
6749
+ div0 = internal.element("div");
6750
+ internal.attr(div0, "class", "plugin-radar__camera-rotate svelte-1ty3s4p");
6751
+ internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
6752
+ internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
6753
+ internal.attr(div1, "class", "plugin-radar__camera-position svelte-1ty3s4p");
6754
+ internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
6755
+ internal.attr(div2, "class", "plugin-radar__camera-wrapper svelte-1ty3s4p");
6756
+ },
6757
+ m(target, anchor) {
6758
+ internal.insert(target, div2, anchor);
6759
+ internal.append(div2, div1);
6760
+ internal.append(div1, div0);
6761
+ },
6762
+ p(ctx, [dirty]) {
6763
+ if (dirty & /*cameraImageUrl*/ 1) {
6764
+ internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
6765
+ }
6766
+
6767
+ if (dirty & /*rotateTransform*/ 2) {
6768
+ internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
6769
+ }
6770
+
6771
+ if (dirty & /*positionTransform*/ 4) {
6772
+ internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
6773
+ }
6774
+ },
6775
+ i: internal.noop,
6776
+ o: internal.noop,
6777
+ d(detaching) {
6778
+ if (detaching) internal.detach(div2);
6779
+ }
6780
+ };
6781
+ }
6782
+
6783
+ function getCameraRotateTransform(longitude) {
6784
+ // 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
6785
+ const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
6786
+
6787
+ return `rotate(${rotate}deg)`;
6788
+ }
6789
+
6790
+ function instance$c($$self, $$props, $$invalidate) {
6791
+ let positionTransform;
6792
+ let rotateTransform;
6793
+ let { five } = $$props;
6794
+ let { pxmm } = $$props;
6795
+ let { floorplanData } = $$props;
6796
+ let { cameraImageUrl } = $$props;
6797
+ let panoIndex = five.getCurrentState().panoIndex;
6798
+ let longitude = five.getCurrentState().longitude;
6799
+
6800
+ /** 获取相机在当前 Five 状态下的位移 */
6801
+ function getCameraPositionTransform(floorplanData, panoIndex) {
6802
+ const bounding = floorplanData.bounding;
6803
+ const floorplanObserver = floorplanData.observers[panoIndex];
6804
+ if (!floorplanObserver) return '';
6805
+ const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
6806
+ const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
6807
+ const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
6808
+ const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
6809
+ return `translate(${left}px, ${top}px)`;
6810
+ }
6811
+
6812
+ function onFivePanoWillArrive(_panoIndex) {
6813
+ $$invalidate(6, panoIndex = _panoIndex);
6814
+ }
6815
+
6816
+ const onFiveCameraDirectionUpdate = throttle(
6817
+ pose => {
6818
+ $$invalidate(7, longitude = pose.longitude);
6819
+ },
6820
+ 1000 / 60
6821
+ );
6822
+
6823
+ svelte.onMount(() => {
6824
+ five.on('panoWillArrive', onFivePanoWillArrive);
6825
+ five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
6826
+
6827
+ return function dispose() {
6828
+ five.off('panoWillArrive', onFivePanoWillArrive);
6829
+ five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
6830
+ };
6831
+ });
6832
+
6833
+ $$self.$$set = $$props => {
6834
+ if ('five' in $$props) $$invalidate(3, five = $$props.five);
6835
+ if ('pxmm' in $$props) $$invalidate(4, pxmm = $$props.pxmm);
6836
+ if ('floorplanData' in $$props) $$invalidate(5, floorplanData = $$props.floorplanData);
6837
+ if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
6838
+ };
6839
+
6840
+ $$self.$$.update = () => {
6841
+ if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
6842
+ // 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
6843
+ $$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
6844
+ }
6845
+
6846
+ if ($$self.$$.dirty & /*longitude*/ 128) {
6847
+ $$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
6848
+ }
6849
+ };
6850
+
6851
+ return [
6852
+ cameraImageUrl,
6853
+ rotateTransform,
6854
+ positionTransform,
6855
+ five,
6856
+ pxmm,
6857
+ floorplanData,
6858
+ panoIndex,
6859
+ longitude
6860
+ ];
6861
+ }
6862
+
6863
+ class Camera extends internal.SvelteComponent {
6864
+ constructor(options) {
6865
+ super();
6866
+
6867
+ internal.init(
6868
+ this,
6869
+ options,
6870
+ instance$c,
6871
+ create_fragment$c,
6872
+ internal.safe_not_equal,
6873
+ {
6874
+ five: 3,
6875
+ pxmm: 4,
6876
+ floorplanData: 5,
6877
+ cameraImageUrl: 0
6878
+ },
6879
+ add_css$a
6880
+ );
6881
+ }
6882
+ }
6883
+
6884
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte generated by Svelte v3.49.0 */
6885
+
6886
+ function add_css$9(target) {
6887
+ internal.append_styles(target, "svelte-1i87fz7", ".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}");
6888
+ }
6889
+
6890
+ function get_each_context$5(ctx, list, i) {
6891
+ const child_ctx = ctx.slice();
6892
+ child_ctx[1] = list[i];
6893
+ return child_ctx;
6894
+ }
6895
+
6896
+ // (5:2) {#each extraObjects as extraObject (extraObject.id)}
6897
+ function create_each_block$5(key_1, ctx) {
6898
+ let div1;
6899
+ let div0;
6900
+ let style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`;
6901
+ let style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`;
6902
+ let t;
6903
+ let style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`;
6904
+ let style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`;
6905
+
6906
+ return {
6907
+ key: key_1,
6908
+ first: null,
6909
+ c() {
6910
+ div1 = internal.element("div");
6911
+ div0 = internal.element("div");
6912
+ t = internal.space();
6913
+ internal.attr(div0, "class", "plugin-pano-floorplan__extra-object-item svelte-1i87fz7");
6914
+ internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
6915
+ internal.set_style(div0, "width", style_width, false);
6916
+ internal.set_style(div0, "height", style_height, false);
6917
+ internal.attr(div1, "class", "plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7");
6918
+ internal.set_style(div1, "top", style_top, false);
6919
+ internal.set_style(div1, "left", style_left, false);
6920
+ this.first = div1;
6921
+ },
6922
+ m(target, anchor) {
6923
+ internal.insert(target, div1, anchor);
6924
+ internal.append(div1, div0);
6925
+ internal.append(div1, t);
6926
+ },
6927
+ p(new_ctx, dirty) {
6928
+ ctx = new_ctx;
6929
+
6930
+ if (dirty & /*extraObjects*/ 1) {
6931
+ internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
6932
+ }
6933
+
6934
+ if (dirty & /*extraObjects*/ 1 && style_width !== (style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`)) {
6935
+ internal.set_style(div0, "width", style_width, false);
6936
+ }
6937
+
6938
+ if (dirty & /*extraObjects*/ 1 && style_height !== (style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`)) {
6939
+ internal.set_style(div0, "height", style_height, false);
6940
+ }
6941
+
6942
+ if (dirty & /*extraObjects*/ 1 && style_top !== (style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`)) {
6943
+ internal.set_style(div1, "top", style_top, false);
6944
+ }
6945
+
6946
+ if (dirty & /*extraObjects*/ 1 && style_left !== (style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`)) {
6947
+ internal.set_style(div1, "left", style_left, false);
6948
+ }
6949
+ },
6950
+ d(detaching) {
6951
+ if (detaching) internal.detach(div1);
6952
+ }
6953
+ };
6954
+ }
6955
+
6956
+ function create_fragment$b(ctx) {
6957
+ let div;
6958
+ let each_blocks = [];
6959
+ let each_1_lookup = new Map();
6960
+ let each_value = /*extraObjects*/ ctx[0];
6961
+ const get_key = ctx => /*extraObject*/ ctx[1].id;
6962
+
6963
+ for (let i = 0; i < each_value.length; i += 1) {
6964
+ let child_ctx = get_each_context$5(ctx, each_value, i);
6965
+ let key = get_key(child_ctx);
6966
+ each_1_lookup.set(key, each_blocks[i] = create_each_block$5(key, child_ctx));
6967
+ }
6968
+
6969
+ return {
6970
+ c() {
6971
+ div = internal.element("div");
6972
+
6973
+ for (let i = 0; i < each_blocks.length; i += 1) {
6974
+ each_blocks[i].c();
6975
+ }
6976
+
6977
+ internal.attr(div, "class", "plugin-pano-floorplan__extra-objects svelte-1i87fz7");
6978
+ },
6979
+ m(target, anchor) {
6980
+ internal.insert(target, div, anchor);
6981
+
6982
+ for (let i = 0; i < each_blocks.length; i += 1) {
6983
+ each_blocks[i].m(div, null);
6984
+ }
6985
+ },
6986
+ p(ctx, [dirty]) {
6987
+ if (dirty & /*extraObjects*/ 1) {
6988
+ each_value = /*extraObjects*/ ctx[0];
6989
+ each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, internal.destroy_block, create_each_block$5, null, get_each_context$5);
6990
+ }
6991
+ },
6992
+ i: internal.noop,
6993
+ o: internal.noop,
6994
+ d(detaching) {
6995
+ if (detaching) internal.detach(div);
6996
+
6997
+ for (let i = 0; i < each_blocks.length; i += 1) {
6998
+ each_blocks[i].d();
6999
+ }
7000
+ }
7001
+ };
7002
+ }
7003
+
7004
+ function instance$b($$self, $$props, $$invalidate) {
7005
+ let { extraObjects = [] } = $$props;
7006
+
7007
+ $$self.$$set = $$props => {
7008
+ if ('extraObjects' in $$props) $$invalidate(0, extraObjects = $$props.extraObjects);
7009
+ };
7010
+
7011
+ return [extraObjects];
7012
+ }
7013
+
7014
+ class ExtraObjects extends internal.SvelteComponent {
7015
+ constructor(options) {
7016
+ super();
7017
+ internal.init(this, options, instance$b, create_fragment$b, internal.safe_not_equal, { extraObjects: 0 }, add_css$9);
7018
+ }
7019
+ }
7020
+
7021
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte generated by Svelte v3.49.0 */
7022
+
7023
+ function create_if_block$4(ctx) {
7024
+ let highlight;
7025
+ let current;
7026
+
7027
+ const highlight_spread_levels = [
7028
+ {
7029
+ five: /*five*/ ctx[0],
7030
+ pxmm: /*pxmm*/ ctx[1],
7031
+ floorIndex: /*floorIndex*/ ctx[2],
7032
+ floorplanData: /*floorplanData*/ ctx[4],
7033
+ onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
7034
+ }
7035
+ ];
7036
+
7037
+ let highlight_props = {};
7038
+
7039
+ for (let i = 0; i < highlight_spread_levels.length; i += 1) {
7040
+ highlight_props = internal.assign(highlight_props, highlight_spread_levels[i]);
7041
+ }
7042
+
7043
+ highlight = new RoomHighlight({ props: highlight_props });
7044
+
7045
+ return {
7046
+ c() {
7047
+ internal.create_component(highlight.$$.fragment);
7048
+ },
7049
+ m(target, anchor) {
7050
+ internal.mount_component(highlight, target, anchor);
7051
+ current = true;
7052
+ },
7053
+ p(ctx, dirty) {
7054
+ const highlight_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, onRoomHeightClick*/ 87)
7055
+ ? internal.get_spread_update(highlight_spread_levels, [
7056
+ {
7057
+ five: /*five*/ ctx[0],
7058
+ pxmm: /*pxmm*/ ctx[1],
7059
+ floorIndex: /*floorIndex*/ ctx[2],
7060
+ floorplanData: /*floorplanData*/ ctx[4],
7061
+ onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
7062
+ }
7063
+ ])
7064
+ : {};
7065
+
7066
+ highlight.$set(highlight_changes);
7067
+ },
7068
+ i(local) {
7069
+ if (current) return;
7070
+ internal.transition_in(highlight.$$.fragment, local);
7071
+ current = true;
7072
+ },
7073
+ o(local) {
7074
+ internal.transition_out(highlight.$$.fragment, local);
7075
+ current = false;
7076
+ },
7077
+ d(detaching) {
7078
+ internal.destroy_component(highlight, detaching);
7079
+ }
7080
+ };
7081
+ }
7082
+
7083
+ function create_fragment$a(ctx) {
7084
+ let baseimage;
7085
+ let t0;
7086
+ let extraobjects;
7087
+ let t1;
7088
+ let if_block_anchor;
7089
+ let current;
7090
+
7091
+ const baseimage_spread_levels = [
7092
+ {
7093
+ floorIndex: /*floorIndex*/ ctx[2],
7094
+ floorplanData: /*floorplanData*/ ctx[4]
7095
+ }
7096
+ ];
7097
+
7098
+ let baseimage_props = {};
7099
+
7100
+ for (let i = 0; i < baseimage_spread_levels.length; i += 1) {
7101
+ baseimage_props = internal.assign(baseimage_props, baseimage_spread_levels[i]);
7102
+ }
7103
+
7104
+ baseimage = new BaseImage({ props: baseimage_props });
7105
+
7106
+ extraobjects = new ExtraObjects({
7107
+ props: {
7108
+ extraObjects: /*currentFloorExtraObjects*/ ctx[5]
7109
+ }
7110
+ });
7111
+
7112
+ let if_block = /*hoverEnable*/ ctx[3] && create_if_block$4(ctx);
7113
+
7114
+ return {
7115
+ c() {
7116
+ internal.create_component(baseimage.$$.fragment);
7117
+ t0 = internal.space();
7118
+ internal.create_component(extraobjects.$$.fragment);
7119
+ t1 = internal.space();
7120
+ if (if_block) if_block.c();
7121
+ if_block_anchor = internal.empty();
7122
+ },
7123
+ m(target, anchor) {
7124
+ internal.mount_component(baseimage, target, anchor);
7125
+ internal.insert(target, t0, anchor);
7126
+ internal.mount_component(extraobjects, target, anchor);
7127
+ internal.insert(target, t1, anchor);
7128
+ if (if_block) if_block.m(target, anchor);
7129
+ internal.insert(target, if_block_anchor, anchor);
7130
+ current = true;
7131
+ },
7132
+ p(ctx, [dirty]) {
7133
+ const baseimage_changes = (dirty & /*floorIndex, floorplanData*/ 20)
7134
+ ? internal.get_spread_update(baseimage_spread_levels, [
7135
+ {
7136
+ floorIndex: /*floorIndex*/ ctx[2],
7137
+ floorplanData: /*floorplanData*/ ctx[4]
7138
+ }
7139
+ ])
7140
+ : {};
7141
+
7142
+ baseimage.$set(baseimage_changes);
7143
+ const extraobjects_changes = {};
7144
+ if (dirty & /*currentFloorExtraObjects*/ 32) extraobjects_changes.extraObjects = /*currentFloorExtraObjects*/ ctx[5];
7145
+ extraobjects.$set(extraobjects_changes);
7146
+
7147
+ if (/*hoverEnable*/ ctx[3]) {
7148
+ if (if_block) {
7149
+ if_block.p(ctx, dirty);
7150
+
7151
+ if (dirty & /*hoverEnable*/ 8) {
7152
+ internal.transition_in(if_block, 1);
7153
+ }
7154
+ } else {
7155
+ if_block = create_if_block$4(ctx);
7156
+ if_block.c();
7157
+ internal.transition_in(if_block, 1);
7158
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
7159
+ }
7160
+ } else if (if_block) {
7161
+ internal.group_outros();
7162
+
7163
+ internal.transition_out(if_block, 1, 1, () => {
7164
+ if_block = null;
7165
+ });
7166
+
7167
+ internal.check_outros();
7168
+ }
7169
+ },
7170
+ i(local) {
7171
+ if (current) return;
7172
+ internal.transition_in(baseimage.$$.fragment, local);
7173
+ internal.transition_in(extraobjects.$$.fragment, local);
7174
+ internal.transition_in(if_block);
7175
+ current = true;
7176
+ },
7177
+ o(local) {
7178
+ internal.transition_out(baseimage.$$.fragment, local);
7179
+ internal.transition_out(extraobjects.$$.fragment, local);
7180
+ internal.transition_out(if_block);
7181
+ current = false;
7182
+ },
7183
+ d(detaching) {
7184
+ internal.destroy_component(baseimage, detaching);
7185
+ if (detaching) internal.detach(t0);
7186
+ internal.destroy_component(extraobjects, detaching);
7187
+ if (detaching) internal.detach(t1);
7188
+ if (if_block) if_block.d(detaching);
7189
+ if (detaching) internal.detach(if_block_anchor);
7190
+ }
7191
+ };
7192
+ }
7193
+
7194
+ function instance$a($$self, $$props, $$invalidate) {
7195
+ let currentFloorExtraObjects;
7196
+ let { five } = $$props;
7197
+ let { pxmm } = $$props;
7198
+ let { floorIndex } = $$props;
7199
+ let { hoverEnable } = $$props;
7200
+ let { floorplanData } = $$props;
7201
+ let { extraObjects = [] } = $$props;
7202
+ const onRoomHeightClick = undefined;
7203
+
7204
+ $$self.$$set = $$props => {
7205
+ if ('five' in $$props) $$invalidate(0, five = $$props.five);
7206
+ if ('pxmm' in $$props) $$invalidate(1, pxmm = $$props.pxmm);
7207
+ if ('floorIndex' in $$props) $$invalidate(2, floorIndex = $$props.floorIndex);
7208
+ if ('hoverEnable' in $$props) $$invalidate(3, hoverEnable = $$props.hoverEnable);
7209
+ if ('floorplanData' in $$props) $$invalidate(4, floorplanData = $$props.floorplanData);
7210
+ if ('extraObjects' in $$props) $$invalidate(7, extraObjects = $$props.extraObjects);
7211
+ };
7212
+
7213
+ $$self.$$.update = () => {
7214
+ if ($$self.$$.dirty & /*extraObjects, floorIndex*/ 132) {
7215
+ $$invalidate(5, currentFloorExtraObjects = extraObjects === null || extraObjects === void 0
7216
+ ? void 0
7217
+ : extraObjects.filter(object => object.floorIndex === floorIndex));
7218
+ }
7219
+ };
7220
+
7221
+ return [
7222
+ five,
7223
+ pxmm,
7224
+ floorIndex,
7225
+ hoverEnable,
7226
+ floorplanData,
7227
+ currentFloorExtraObjects,
7228
+ onRoomHeightClick,
7229
+ extraObjects
7230
+ ];
7231
+ }
7232
+
7233
+ class CurrentFloor extends internal.SvelteComponent {
7234
+ constructor(options) {
7235
+ super();
7236
+
7237
+ internal.init(this, options, instance$a, create_fragment$a, internal.safe_not_equal, {
7238
+ five: 0,
7239
+ pxmm: 1,
7240
+ floorIndex: 2,
7241
+ hoverEnable: 3,
7242
+ floorplanData: 4,
7243
+ extraObjects: 7
7244
+ });
7245
+ }
7246
+ }
7247
+
7248
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte generated by Svelte v3.49.0 */
7249
+
7250
+ function add_css$8(target) {
7251
+ internal.append_styles(target, "svelte-1mvqyqq", ".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}");
7252
+ }
7253
+
7254
+ // (41:0) {#if visible}
7255
+ function create_if_block$3(ctx) {
7256
+ let div;
7257
+ let div_resize_listener;
7258
+ let current;
7259
+ let if_block = /*clientWidth*/ ctx[6] !== 0 && create_if_block_1$1(ctx);
7260
+
7261
+ return {
7262
+ c() {
7263
+ div = internal.element("div");
7264
+ if (if_block) if_block.c();
7265
+ internal.attr(div, "class", "plugin-floorplan-radar svelte-1mvqyqq");
7266
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
7267
+ },
7268
+ m(target, anchor) {
7269
+ internal.insert(target, div, anchor);
7270
+ if (if_block) if_block.m(div, null);
7271
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
7272
+ current = true;
7273
+ },
7274
+ p(ctx, dirty) {
7275
+ if (/*clientWidth*/ ctx[6] !== 0) {
7276
+ if (if_block) {
7277
+ if_block.p(ctx, dirty);
7278
+
7279
+ if (dirty & /*clientWidth*/ 64) {
7280
+ internal.transition_in(if_block, 1);
7281
+ }
7282
+ } else {
7283
+ if_block = create_if_block_1$1(ctx);
7284
+ if_block.c();
7285
+ internal.transition_in(if_block, 1);
7286
+ if_block.m(div, null);
7287
+ }
7288
+ } else if (if_block) {
7289
+ internal.group_outros();
7290
+
7291
+ internal.transition_out(if_block, 1, 1, () => {
7292
+ if_block = null;
7293
+ });
7294
+
7295
+ internal.check_outros();
7296
+ }
7297
+ },
7298
+ i(local) {
7299
+ if (current) return;
7300
+ internal.transition_in(if_block);
7301
+ current = true;
7302
+ },
7303
+ o(local) {
7304
+ internal.transition_out(if_block);
7305
+ current = false;
7306
+ },
7307
+ d(detaching) {
7308
+ if (detaching) internal.detach(div);
7309
+ if (if_block) if_block.d();
7310
+ div_resize_listener();
7311
+ }
7312
+ };
7313
+ }
7314
+
7315
+ // (43:4) {#if clientWidth !== 0}
7316
+ function create_if_block_1$1(ctx) {
7317
+ let div;
7318
+ let currentfloor;
7319
+ let t;
7320
+ let camera;
7321
+ let style_width = `${/*contentWidth*/ ctx[8]}px`;
7322
+ let style_height = `${/*contentHeight*/ ctx[11]}px`;
7323
+ let current;
7324
+
7325
+ const currentfloor_spread_levels = [
7326
+ {
7327
+ five: /*five*/ ctx[0],
7328
+ pxmm: /*pxmm*/ ctx[9],
7329
+ floorIndex: /*floorIndex*/ ctx[10],
7330
+ floorplanData: /*floorplanData*/ ctx[3],
7331
+ hoverEnable: /*hoverEnable*/ ctx[2],
7332
+ extraObjects: /*extraObjects*/ ctx[5]
7333
+ }
7334
+ ];
7335
+
7336
+ let currentfloor_props = {};
7337
+
7338
+ for (let i = 0; i < currentfloor_spread_levels.length; i += 1) {
7339
+ currentfloor_props = internal.assign(currentfloor_props, currentfloor_spread_levels[i]);
7340
+ }
7341
+
7342
+ currentfloor = new CurrentFloor({ props: currentfloor_props });
7343
+
7344
+ const camera_spread_levels = [
7345
+ {
7346
+ pxmm: /*pxmm*/ ctx[9],
7347
+ five: /*five*/ ctx[0],
7348
+ floorplanData: /*floorplanData*/ ctx[3],
7349
+ cameraImageUrl: /*cameraImageUrl*/ ctx[4]
7350
+ }
7351
+ ];
7352
+
7353
+ let camera_props = {};
7354
+
7355
+ for (let i = 0; i < camera_spread_levels.length; i += 1) {
7356
+ camera_props = internal.assign(camera_props, camera_spread_levels[i]);
7357
+ }
7358
+
7359
+ camera = new Camera({ props: camera_props });
7360
+
7361
+ return {
7362
+ c() {
7363
+ div = internal.element("div");
7364
+ internal.create_component(currentfloor.$$.fragment);
7365
+ t = internal.space();
7366
+ internal.create_component(camera.$$.fragment);
7367
+ internal.attr(div, "class", "plugin-floorplan-radar-container svelte-1mvqyqq");
7368
+ internal.set_style(div, "width", style_width, false);
7369
+ internal.set_style(div, "height", style_height, false);
7370
+ },
7371
+ m(target, anchor) {
7372
+ internal.insert(target, div, anchor);
7373
+ internal.mount_component(currentfloor, div, null);
7374
+ internal.append(div, t);
7375
+ internal.mount_component(camera, div, null);
7376
+ current = true;
7377
+ },
7378
+ p(ctx, dirty) {
7379
+ const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, hoverEnable, extraObjects*/ 1581)
7380
+ ? internal.get_spread_update(currentfloor_spread_levels, [
7381
+ {
7382
+ five: /*five*/ ctx[0],
7383
+ pxmm: /*pxmm*/ ctx[9],
7384
+ floorIndex: /*floorIndex*/ ctx[10],
7385
+ floorplanData: /*floorplanData*/ ctx[3],
7386
+ hoverEnable: /*hoverEnable*/ ctx[2],
7387
+ extraObjects: /*extraObjects*/ ctx[5]
7388
+ }
7389
+ ])
7390
+ : {};
7391
+
7392
+ currentfloor.$set(currentfloor_changes);
7393
+
7394
+ const camera_changes = (dirty & /*pxmm, five, floorplanData, cameraImageUrl*/ 537)
7395
+ ? internal.get_spread_update(camera_spread_levels, [
7396
+ {
7397
+ pxmm: /*pxmm*/ ctx[9],
7398
+ five: /*five*/ ctx[0],
7399
+ floorplanData: /*floorplanData*/ ctx[3],
7400
+ cameraImageUrl: /*cameraImageUrl*/ ctx[4]
7401
+ }
7402
+ ])
7403
+ : {};
7404
+
7405
+ camera.$set(camera_changes);
7406
+
7407
+ if (dirty & /*contentWidth*/ 256 && style_width !== (style_width = `${/*contentWidth*/ ctx[8]}px`)) {
7408
+ internal.set_style(div, "width", style_width, false);
7409
+ }
7410
+
7411
+ if (dirty & /*contentHeight*/ 2048 && style_height !== (style_height = `${/*contentHeight*/ ctx[11]}px`)) {
7412
+ internal.set_style(div, "height", style_height, false);
7413
+ }
7414
+ },
7415
+ i(local) {
7416
+ if (current) return;
7417
+ internal.transition_in(currentfloor.$$.fragment, local);
7418
+ internal.transition_in(camera.$$.fragment, local);
7419
+ current = true;
7420
+ },
7421
+ o(local) {
7422
+ internal.transition_out(currentfloor.$$.fragment, local);
7423
+ internal.transition_out(camera.$$.fragment, local);
7424
+ current = false;
7425
+ },
7426
+ d(detaching) {
7427
+ if (detaching) internal.detach(div);
7428
+ internal.destroy_component(currentfloor);
7429
+ internal.destroy_component(camera);
7430
+ }
7431
+ };
7432
+ }
7433
+
7434
+ function create_fragment$9(ctx) {
7435
+ let if_block_anchor;
7436
+ let current;
7437
+ let if_block = /*visible*/ ctx[1] && create_if_block$3(ctx);
7438
+
7439
+ return {
7440
+ c() {
7441
+ if (if_block) if_block.c();
7442
+ if_block_anchor = internal.empty();
7443
+ },
7444
+ m(target, anchor) {
7445
+ if (if_block) if_block.m(target, anchor);
7446
+ internal.insert(target, if_block_anchor, anchor);
7447
+ current = true;
7448
+ },
7449
+ p(ctx, [dirty]) {
7450
+ if (/*visible*/ ctx[1]) {
7451
+ if (if_block) {
7452
+ if_block.p(ctx, dirty);
7453
+
7454
+ if (dirty & /*visible*/ 2) {
7455
+ internal.transition_in(if_block, 1);
7456
+ }
7457
+ } else {
7458
+ if_block = create_if_block$3(ctx);
7459
+ if_block.c();
7460
+ internal.transition_in(if_block, 1);
7461
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
7462
+ }
7463
+ } else if (if_block) {
7464
+ internal.group_outros();
7465
+
7466
+ internal.transition_out(if_block, 1, 1, () => {
7467
+ if_block = null;
7468
+ });
7469
+
7470
+ internal.check_outros();
7471
+ }
7472
+ },
7473
+ i(local) {
7474
+ if (current) return;
7475
+ internal.transition_in(if_block);
7476
+ current = true;
7477
+ },
7478
+ o(local) {
7479
+ internal.transition_out(if_block);
7480
+ current = false;
7481
+ },
7482
+ d(detaching) {
7483
+ if (if_block) if_block.d(detaching);
7484
+ if (detaching) internal.detach(if_block_anchor);
7485
+ }
7486
+ };
7487
+ }
7488
+
7489
+ function instance$9($$self, $$props, $$invalidate) {
7490
+ let { five } = $$props;
7491
+ let { visible } = $$props;
7492
+ let { hoverEnable } = $$props;
7493
+ let { floorplanData } = $$props;
7494
+ let { cameraImageUrl } = $$props;
7495
+ let { extraObjects = [] } = $$props;
7496
+ let pxmm = 0;
7497
+ let floorIndex = 0;
7498
+ let clientWidth = 0;
7499
+ let clientHeight = 0;
7500
+ let contentWidth = 0;
7501
+ let contentHeight = 0;
7502
+
7503
+ function handlePanoArrived(panoIndex) {
7504
+ $$invalidate(10, floorIndex = five.work.observers[panoIndex].floorIndex);
7505
+ }
7506
+
7507
+ svelte.onMount(() => {
7508
+ five.on('panoArrived', handlePanoArrived);
7509
+
7510
+ return () => {
7511
+ five.off('panoArrived', handlePanoArrived);
7512
+ };
7513
+ });
7514
+
7515
+ function div_elementresize_handler() {
7516
+ clientWidth = this.clientWidth;
7517
+ clientHeight = this.clientHeight;
7518
+ $$invalidate(6, clientWidth);
7519
+ $$invalidate(7, clientHeight);
7520
+ }
7521
+
7522
+ $$self.$$set = $$props => {
7523
+ if ('five' in $$props) $$invalidate(0, five = $$props.five);
7524
+ if ('visible' in $$props) $$invalidate(1, visible = $$props.visible);
7525
+ if ('hoverEnable' in $$props) $$invalidate(2, hoverEnable = $$props.hoverEnable);
7526
+ if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
7527
+ if ('cameraImageUrl' in $$props) $$invalidate(4, cameraImageUrl = $$props.cameraImageUrl);
7528
+ if ('extraObjects' in $$props) $$invalidate(5, extraObjects = $$props.extraObjects);
7529
+ };
7530
+
7531
+ $$self.$$.update = () => {
7532
+ if ($$self.$$.dirty & /*clientWidth, clientHeight, floorplanData, contentWidth*/ 456) {
7533
+ {
7534
+ const size = Math.min(clientWidth, clientHeight);
7535
+ const { max, min } = floorplanData.bounding;
7536
+ const boundingWidth = max.x - min.x;
7537
+ const boundingHeight = max.y - min.y;
7538
+
7539
+ const contentSize = (function getSize() {
7540
+ if (boundingWidth > boundingHeight) return [size, size / boundingWidth * boundingHeight];
7541
+ return [size / boundingHeight * boundingWidth, size];
7542
+ })();
7543
+
7544
+ $$invalidate(8, contentWidth = contentSize[0]);
7545
+ $$invalidate(11, contentHeight = contentSize[1]);
7546
+ $$invalidate(9, pxmm = contentWidth / boundingWidth);
7547
+ }
7548
+ }
7549
+ };
7550
+
7551
+ return [
7552
+ five,
7553
+ visible,
7554
+ hoverEnable,
7555
+ floorplanData,
7556
+ cameraImageUrl,
7557
+ extraObjects,
7558
+ clientWidth,
7559
+ clientHeight,
7560
+ contentWidth,
7561
+ pxmm,
7562
+ floorIndex,
7563
+ contentHeight,
7564
+ div_elementresize_handler
7565
+ ];
7566
+ }
7567
+
7568
+ class Main extends internal.SvelteComponent {
7569
+ constructor(options) {
7570
+ super();
7571
+
7572
+ internal.init(
7573
+ this,
7574
+ options,
7575
+ instance$9,
7576
+ create_fragment$9,
7577
+ internal.safe_not_equal,
7578
+ {
7579
+ five: 0,
7580
+ visible: 1,
7581
+ hoverEnable: 2,
7582
+ floorplanData: 3,
7583
+ cameraImageUrl: 4,
7584
+ extraObjects: 5
7585
+ },
7586
+ add_css$8
7587
+ );
7588
+ }
7589
+ }
7590
+
7591
+ class Controller$1 extends Controller$5 {
7592
+ constructor(five, params) {
7593
+ super(five);
7594
+ // =============== public properties =================
7595
+ Object.defineProperty(this, "name", {
6821
7596
  enumerable: true,
6822
7597
  configurable: true,
6823
7598
  writable: true,
6824
- value: () => {
6825
- if (this.state.enabled === false)
6826
- return;
6827
- if (this.wrapper)
6828
- return;
6829
- if (!this.selector)
6830
- return;
6831
- const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
6832
- if (!wrapper)
6833
- throw new Error('不正确的父容器选择器');
6834
- this.wrapper = wrapper;
6835
- wrapper.append(this.container);
6836
- }
7599
+ value: 'panoFloorplanRadarPlugin'
6837
7600
  });
6838
- /** 更改模型时,自动隐藏户型图 */
6839
- Object.defineProperty(this, "onFiveModeChange", {
7601
+ Object.defineProperty(this, "state", {
6840
7602
  enumerable: true,
6841
7603
  configurable: true,
6842
7604
  writable: true,
6843
- value: (mode) => {
6844
- // 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
6845
- if (mode !== this.showState.mode) {
6846
- this.updateState({ visible: false }, false);
6847
- this._hide({ userAction: false });
6848
- }
6849
- }
7605
+ value: void 0
6850
7606
  });
6851
- /** 惯性结束后,判断能否自动展示户型图 */
6852
- Object.defineProperty(this, "onFiveInteriaPan", {
7607
+ // =============== protected properties =================
7608
+ Object.defineProperty(this, "data", {
6853
7609
  enumerable: true,
6854
7610
  configurable: true,
6855
7611
  writable: true,
6856
- value: (_, isFinal) => {
6857
- if (!isFinal)
6858
- return;
6859
- if (this.state.config.autoShowEnable === false)
6860
- return;
6861
- // 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
6862
- if (this.isHiddenByHideFunc)
6863
- return;
6864
- const fiveCurrentState = this.five.getCurrentState();
6865
- if (fiveCurrentState.mode !== 'Floorplan')
6866
- return;
6867
- if (this.state.visible)
6868
- return;
6869
- if (shouldFloorplanShowWithPose(fiveCurrentState)) {
6870
- this.updateState({ visible: true }, true);
6871
- this._show({ isAutoShow: true });
6872
- }
6873
- }
7612
+ value: void 0
6874
7613
  });
6875
- /** panoIndex 改变时,更新 floorIndex */
6876
- Object.defineProperty(this, "onFivePanoArrived", {
7614
+ // =============== private properties =================
7615
+ Object.defineProperty(this, "app", {
6877
7616
  enumerable: true,
6878
7617
  configurable: true,
6879
7618
  writable: true,
6880
- value: (index) => {
6881
- var _a;
6882
- if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
6883
- return;
6884
- this.panoIndex = index;
6885
- this.floorIndex = this.five.work.observers[index].floorIndex;
6886
- }
7619
+ value: void 0
6887
7620
  });
6888
- /** cameraUpdate 时判断户型图是否应该自动隐藏 */
6889
- Object.defineProperty(this, "onFiveCameraUpdate", {
7621
+ Object.defineProperty(this, "wrapperSelector", {
6890
7622
  enumerable: true,
6891
7623
  configurable: true,
6892
7624
  writable: true,
6893
- value: (_, userAction) => {
6894
- if (!this.state.visible)
6895
- return;
6896
- // 展示过程中不处理自动隐藏逻辑
6897
- if (this.showPromise)
6898
- return;
6899
- const fiveCurrentState = this.five.getCurrentState();
6900
- if (shouldFloorplanHideWithPose(fiveCurrentState)) {
6901
- this.updateState({ visible: false }, userAction);
6902
- this._hide({ userAction, isAutoHide: true });
6903
- }
6904
- }
7625
+ value: ''
6905
7626
  });
6906
- /** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
6907
- Object.defineProperty(this, "onFiveWantsGesture", {
6908
- enumerable: true,
6909
- configurable: true,
6910
- writable: true,
6911
- value: (type, pointers) => {
6912
- if (!this.state.visible)
6913
- return;
6914
- // 阻止多指操作
6915
- if (pointers.length > 1)
6916
- return false;
6917
- // 阻止鼠标滚轮行为
6918
- if (type === 'mouseWheel')
6919
- return false;
6920
- }
7627
+ Object.defineProperty(this, "wrapper", {
7628
+ enumerable: true,
7629
+ configurable: true,
7630
+ writable: true,
7631
+ value: null
6921
7632
  });
6922
- /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
6923
- Object.defineProperty(this, "onFiveWantsPanGesture", {
7633
+ Object.defineProperty(this, "disposed", {
6924
7634
  enumerable: true,
6925
7635
  configurable: true,
6926
7636
  writable: true,
6927
- value: (_, isFinal) => {
6928
- if (this.five.getCurrentState().mode !== 'Floorplan')
6929
- return;
6930
- if (this.state.config.autoShowEnable === false)
6931
- return;
6932
- if (isFinal && this.state.visible) {
6933
- this.five.updateCamera(this.showState, 0);
6934
- // 禁用掉 isFinal 的 panGesture 行为
6935
- // 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
6936
- // 此行为也会禁用 pan 结束后的惯性处理
6937
- return false;
6938
- }
6939
- }
7637
+ value: false
6940
7638
  });
6941
- /** 阻止点击分间走点 */
6942
- Object.defineProperty(this, "onFiveWantsTapGesture", {
7639
+ Object.defineProperty(this, "extraObjects", {
6943
7640
  enumerable: true,
6944
7641
  configurable: true,
6945
7642
  writable: true,
6946
- value: () => this.handleClick()
7643
+ value: []
6947
7644
  });
6948
- /** Panorama 切换到其他模态时,记录当前的相机水平视角 */
6949
- Object.defineProperty(this, "onFiveWantsChangeMode", {
7645
+ Object.defineProperty(this, "dispose", {
6950
7646
  enumerable: true,
6951
7647
  configurable: true,
6952
7648
  writable: true,
6953
- value: (mode, prevMode) => {
6954
- if (prevMode === 'Panorama' && mode === 'Floorplan') {
6955
- this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
6956
- }
6957
- // if (mode !== 'Floorplan') this.hide()
7649
+ value: () => {
7650
+ var _a;
7651
+ this.disposed = true;
7652
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
7653
+ this.wrapper = null;
7654
+ this.wrapperSelector = '';
7655
+ this.hooks.emit('dispose');
6958
7656
  }
6959
7657
  });
6960
- /** 模型楼层高亮改变时,自动进行楼层切换 */
6961
- Object.defineProperty(this, "onModelShownFloorChange", {
7658
+ Object.defineProperty(this, "_disable", {
6962
7659
  enumerable: true,
6963
7660
  configurable: true,
6964
7661
  writable: true,
6965
- value: (shownFloor) => {
6966
- if (this.floorIndex === shownFloor)
6967
- return;
6968
- if (shownFloor === null) {
6969
- const panoIndex = this.five.getCurrentState().panoIndex;
6970
- this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
6971
- return;
6972
- }
6973
- this.floorIndex = shownFloor;
6974
- this.updateSize();
6975
- this.render();
7662
+ value: (options) => {
7663
+ var _a;
7664
+ const { userAction } = options;
7665
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
7666
+ this.app = undefined;
7667
+ this.hooks.emit('disable', { userAction });
6976
7668
  }
6977
7669
  });
6978
- if (params === null || params === void 0 ? void 0 : params.selector) {
6979
- this.selector = params.selector;
6980
- console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6981
- }
6982
- // =============== init Show State ===============
6983
- this.showState = {
6984
- mode: 'Floorplan',
6985
- longitude: 0,
6986
- latitude: Math.PI / 2,
6987
- fov: FIVE_CAMERA_DEFAULT_FOV / ((_a = params === null || params === void 0 ? void 0 : params.scale) !== null && _a !== void 0 ? _a : 1),
6988
- };
7670
+ this.five = five;
6989
7671
  // =============== init State ===============
6990
7672
  const baseConfig = {
6991
- northDesc: '北',
6992
- modelOpacity: 1,
6993
- hoverEnable: true,
6994
- compassEnable: true,
6995
- autoShowEnable: true,
6996
- ruleLabelsEnable: true,
6997
- roomLabelsEnable: true,
7673
+ hoverEnable: false,
6998
7674
  cameraImageUrl: CAMERA_IMAGE,
6999
- attachedTo: exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
7000
- getLabelElement: undefined,
7001
- adaptiveRoomLabelVisibleEnable: true,
7002
7675
  };
7003
- const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
7676
+ const paramsConfig = (params === null || params === void 0 ? void 0 : params.configs) ? params.configs : {};
7004
7677
  const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
7005
- this.state = {
7006
- enabled: true,
7007
- visible: false,
7008
- config,
7009
- };
7010
- // =============== init Container ===============
7011
- this.initContainer();
7678
+ this.state = { enabled: true, visible: true, config };
7679
+ // =============== init wrapper ===============
7680
+ if (params === null || params === void 0 ? void 0 : params.wrapper)
7681
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
7682
+ if (typeof (params === null || params === void 0 ? void 0 : params.wrapper) === 'string')
7683
+ this.wrapperSelector = params.wrapper;
7684
+ else if ((params === null || params === void 0 ? void 0 : params.wrapper) instanceof Element)
7685
+ this.wrapper = params.wrapper;
7012
7686
  // =============== init Listener ===============
7013
- // 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
7014
- // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
7015
- five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
7016
7687
  five.once('dispose', this.dispose);
7017
- this.addEventListener();
7018
7688
  }
7019
7689
  async load(serverData, state, userAction = true) {
7690
+ // const loadImage = async () => {
7691
+ // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
7692
+ // // 当有 svgString 时,没有加载过程
7693
+ // if (floorplanData.outlines[floorIndex]?.svgContent) return
7694
+ // // 如果当前楼层图片不存在,不存在加载过程
7695
+ // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
7696
+ // if (!nowFloorImageSrc) return
7697
+ // // 图片加载完成时再 render
7698
+ // await new Promise<void>((resolve) => {
7699
+ // const nowFloorImage = new Image()
7700
+ // nowFloorImage.src = nowFloorImageSrc
7701
+ // nowFloorImage.onload = () => resolve()
7702
+ // })
7703
+ // }
7704
+ // await loadImage()
7020
7705
  function isPluginServerData(serverData) {
7021
7706
  return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
7022
7707
  }
7023
- const _data = serverData;
7024
- if (_data && !_data.version)
7025
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
7026
7708
  const copyData = JSON.parse(JSON.stringify(serverData));
7027
7709
  const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
7028
7710
  const prevData = this.data;
@@ -7033,17 +7715,21 @@ class Controller$1 extends Controller$4 {
7033
7715
  this.updateState(state, userAction);
7034
7716
  this.render();
7035
7717
  }
7036
- /** 把插件的渲染DOM插入到对应的容器中去 */
7037
- appendTo(wrapper) {
7038
- this.wrapper = wrapper;
7039
- // 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
7040
- if (!this.state.enabled)
7718
+ async show(options = {}) {
7719
+ // 已经展示完成了,不做任何操作
7720
+ if (this.state.visible)
7041
7721
  return;
7042
- wrapper.appendChild(this.container);
7043
- this.render();
7044
- return this;
7722
+ const userAction = options.userAction !== undefined ? options.userAction : true;
7723
+ this.updateState({ visible: true }, userAction);
7724
+ this._show({ userAction });
7725
+ }
7726
+ async hide(options = {}) {
7727
+ if (!this.state.visible)
7728
+ return;
7729
+ const userAction = options.userAction !== undefined ? options.userAction : true;
7730
+ this.updateState({ visible: false }, userAction);
7731
+ this._hide({ userAction });
7045
7732
  }
7046
- /** 启用插件 */
7047
7733
  enable(options = {}) {
7048
7734
  if (this.state.enabled)
7049
7735
  return;
@@ -7051,7 +7737,6 @@ class Controller$1 extends Controller$4 {
7051
7737
  this.updateState({ enabled: true }, options.userAction || userAction);
7052
7738
  this._enable({ userAction });
7053
7739
  }
7054
- /** 禁用插件 */
7055
7740
  disable(options = {}) {
7056
7741
  if (!this.state.enabled)
7057
7742
  return;
@@ -7065,23 +7750,56 @@ class Controller$1 extends Controller$4 {
7065
7750
  const userAction = options.userAction !== undefined ? options.userAction : true;
7066
7751
  this.updateState(state, userAction);
7067
7752
  if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
7068
- state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
7753
+ const options = { userAction };
7754
+ state.enabled ? this._enable(options) : this._disable(options);
7069
7755
  }
7070
7756
  if (state.visible !== undefined && prevState.visible !== state.visible) {
7071
7757
  const options = { userAction };
7072
7758
  state.visible ? this._show(options) : this._hide(options);
7073
7759
  }
7074
7760
  }
7075
- changeConfigs(_config, userAction = true) {
7076
- const config = Object.assign(Object.assign({}, this.state.config), _config);
7077
- this.updateState({ config }, userAction);
7078
- if (!this.container)
7761
+ /** 把插件的渲染DOM插入到对应的容器中去 */
7762
+ appendTo(wrapper) {
7763
+ this.wrapper = wrapper;
7764
+ this.render();
7765
+ }
7766
+ changeConfigs(config, userAction = true) {
7767
+ this.setState({ config }, { userAction });
7768
+ this.render();
7769
+ }
7770
+ setExtraObjectsWith3DPositions(data) {
7771
+ if (!this.data)
7079
7772
  return;
7773
+ this.extraObjects = formatExtraObjects(data, this.five, this.data);
7080
7774
  this.render();
7081
7775
  }
7082
7776
  async formatData(serverData) {
7083
7777
  return await formatData(serverData.data);
7084
7778
  }
7779
+ _enable(options) {
7780
+ const { userAction } = options;
7781
+ this.hooks.emit('enable', { userAction });
7782
+ if (this.state.visible)
7783
+ this._show({ userAction });
7784
+ }
7785
+ _show(options) {
7786
+ if (this.disposed)
7787
+ return;
7788
+ if (!this.state.enabled)
7789
+ return;
7790
+ const { userAction } = options;
7791
+ this.hooks.emit('show', { userAction });
7792
+ this.render();
7793
+ }
7794
+ _hide(options) {
7795
+ if (this.disposed)
7796
+ return;
7797
+ if (!this.state.enabled)
7798
+ return;
7799
+ const { userAction } = options;
7800
+ this.hooks.emit('hide', { userAction });
7801
+ this.render();
7802
+ }
7085
7803
  updateState(state, userAction) {
7086
7804
  const prevState = this.state;
7087
7805
  this.state = Object.assign(Object.assign({}, this.state), state);
@@ -7089,68 +7807,24 @@ class Controller$1 extends Controller$4 {
7089
7807
  return;
7090
7808
  this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
7091
7809
  }
7092
- /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
7093
- *
7094
- * - TODO: 等 selector 功能下掉之后删除这个逻辑
7095
- */
7096
- initContainer() {
7097
- this.container.classList.add('floorplan-plugin');
7098
- Object.assign(this.container.style, {
7099
- position: 'absolute',
7100
- left: '50%',
7101
- top: '50%',
7102
- transform: 'translate(-50%, -50%)',
7103
- zIndex: 10,
7104
- pointerEvents: 'none',
7105
- });
7106
- this.five.addExtraElement(this.container);
7107
- }
7108
- addEventListener() {
7109
- if (!this.state.enabled)
7110
- return;
7111
- if (this.hasAddedEventListener)
7810
+ render() {
7811
+ if (this.disposed)
7112
7812
  return;
7113
- const five = this.five;
7114
- five.on('modeChange', this.onFiveModeChange);
7115
- five.on('interiaPan', this.onFiveInteriaPan);
7116
- five.on('panoArrived', this.onFivePanoArrived);
7117
- five.on('cameraUpdate', this.onFiveCameraUpdate);
7118
- five.on('wantsGesture', this.onFiveWantsGesture);
7119
- five.on('wantsPanGesture', this.onFiveWantsPanGesture);
7120
- five.on('wantsTapGesture', this.onFiveWantsTapGesture);
7121
- five.on('wantsChangeMode', this.onFiveWantsChangeMode);
7122
- five.on('modelShownFloorChange', this.onModelShownFloorChange);
7123
- }
7124
- removeEventListener() {
7125
- const five = this.five;
7126
- this.hasAddedEventListener = false;
7127
- // 注意这里并没有消除 dispose 的监听
7128
- five.off('modelLoaded', this.onFiveModelLoaded);
7129
- five.off('modeChange', this.onFiveModeChange);
7130
- five.off('interiaPan', this.onFiveInteriaPan);
7131
- five.off('panoArrived', this.onFivePanoArrived);
7132
- five.off('cameraUpdate', this.onFiveCameraUpdate);
7133
- five.off('wantsGesture', this.onFiveWantsGesture);
7134
- five.off('wantsPanGesture', this.onFiveWantsPanGesture);
7135
- five.off('wantsTapGesture', this.onFiveWantsTapGesture);
7136
- five.off('wantsChangeMode', this.onFiveWantsChangeMode);
7137
- five.off('modelShownFloorChange', this.onModelShownFloorChange);
7138
- }
7139
- render(duration) {
7140
7813
  if (!this.state.enabled)
7141
7814
  return;
7142
- if (!this.container || !this.data)
7143
- return;
7144
- if (this.size.width === 0)
7815
+ // 处理 wrapper
7816
+ if (!this.wrapper && this.wrapperSelector) {
7817
+ const _wrapper = document.querySelector(this.wrapperSelector);
7818
+ this.wrapper = _wrapper;
7819
+ }
7820
+ if (!this.data || !this.wrapper)
7145
7821
  return;
7146
- const props = Object.assign(Object.assign({}, this.state.config), { visible: this.state.visible, duration: duration !== null && duration !== void 0 ? duration : 0, panoIndex: this.panoIndex, floorIndex: this.floorIndex, floorplanData: this.data, lastPanoramaLongitude: this.lastPanoramaLongitude });
7147
- if (this.app)
7148
- return this.app.$set(props);
7149
- this.app = new Main$1({ target: this.container, intro: true, props });
7822
+ const props = Object.assign(Object.assign({}, this.state.config), { five: this.five, floorplanData: this.data, visible: this.state.visible, extraObjects: this.extraObjects });
7823
+ this.app ? this.app.$set(props) : (this.app = new Main({ target: this.wrapper, props }));
7150
7824
  }
7151
7825
  }
7152
7826
 
7153
- const ModelFloorplanPlugin = (five, params) => {
7827
+ const PanoFloorplanRadarPlugin = (five, params) => {
7154
7828
  return new Controller$1(five, params);
7155
7829
  };
7156
7830
 
@@ -9257,7 +9931,7 @@ function tweenProgress(duration, easing = TWEEN__default["default"].Easing.Linea
9257
9931
  }
9258
9932
 
9259
9933
  const defaultBaseOptions$1 = { userAction: true };
9260
- class PanoCompassController extends Controller$4 {
9934
+ class PanoCompassController extends Controller$5 {
9261
9935
  constructor(five$1, config) {
9262
9936
  super(five$1);
9263
9937
  /**
@@ -15666,10 +16340,10 @@ const ModelTVVideoPlugin = (five, { videoElement }) => {
15666
16340
  five.on('wantsTapGesture', (raycaster) => {
15667
16341
  if (!state.enabled)
15668
16342
  return;
15669
- const targetMesh = five.scene.children.find(item => /^ModelTVVideoPlugin/.test(item.name));
16343
+ const targetMesh = five.scene.children.filter(item => /^ModelTVVideoPlugin/.test(item.name));
15670
16344
  if (!targetMesh)
15671
16345
  return;
15672
- const intersectObjects = raycaster.intersectObjects([targetMesh]);
16346
+ const intersectObjects = raycaster.intersectObjects(targetMesh);
15673
16347
  if (intersectObjects.length === 0)
15674
16348
  return;
15675
16349
  if (state.videoTexture)
@@ -16709,7 +17383,7 @@ const itemLabelPluginServerParams = {
16709
17383
  * pano plugin controller 基类
16710
17384
  * @author kyleju
16711
17385
  */
16712
- class BasePanoPluginController extends Controller$5 {
17386
+ class BasePanoPluginController extends Controller$6 {
16713
17387
  constructor(five) {
16714
17388
  super(five);
16715
17389
  Object.defineProperty(this, "state", {
@@ -17012,7 +17686,7 @@ class PanoDoorLabelPluginController extends BasePanoPluginController {
17012
17686
  enumerable: true,
17013
17687
  configurable: true,
17014
17688
  writable: true,
17015
- value: 2.3
17689
+ value: 1.8
17016
17690
  });
17017
17691
  Object.defineProperty(this, "MaxVisibledistance", {
17018
17692
  enumerable: true,
@@ -17076,7 +17750,12 @@ class PanoDoorLabelPluginController extends BasePanoPluginController {
17076
17750
  enumerable: true,
17077
17751
  configurable: true,
17078
17752
  writable: true,
17079
- value: (floorplanServerData) => {
17753
+ value: (floorplanServerData, doorLabelConfig) => {
17754
+ if (doorLabelConfig) {
17755
+ this.MaxVisibledistance = doorLabelConfig.MaxVisibledistance;
17756
+ this.MinVisibledistance = doorLabelConfig.MinVisibledistance;
17757
+ this.OffsetHeight = doorLabelConfig.OffsetHeight;
17758
+ }
17080
17759
  if (this.doorLabelItems && this.doorLabelItems.length > 0) {
17081
17760
  this.doorLabelItems.forEach((doorItem) => {
17082
17761
  doorItem.$destroy();
@@ -17435,7 +18114,7 @@ const PanoDoorLabelPlugin = (five) => {
17435
18114
  return new PanoDoorLabelPluginController(five);
17436
18115
  };
17437
18116
 
17438
- const DnalogelVersion = '2.0.0-alpha.43';
18117
+ const DnalogelVersion = '2.0.0-alpha.49';
17439
18118
 
17440
18119
  exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
17441
18120
  exports.CameraMovementPlugin = CameraMovementPlugin;
@@ -17443,6 +18122,7 @@ exports.DnalogelVersion = DnalogelVersion;
17443
18122
  exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
17444
18123
  exports.ItemLabelPlugin = Plugin;
17445
18124
  exports.Magnifier = Magnifier;
18125
+ exports.MapviewFloorplanPlugin = MapviewFloorplanPlugin;
17446
18126
  exports.ModelChassisCompassPlugin = ModelChassisCompassPlugin;
17447
18127
  exports.ModelEntryDoorGuidePlugin = ModelEntryDoorGuidePlugin;
17448
18128
  exports.ModelFloorplanPlugin = ModelFloorplanPlugin;