@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.umd.js CHANGED
@@ -1011,6 +1011,24 @@
1011
1011
  FLOOR_PLAN_ATTACHED_TO[FLOOR_PLAN_ATTACHED_TO["BOUNDING_CENTER"] = 3] = "BOUNDING_CENTER";
1012
1012
  })(exports.FLOOR_PLAN_ATTACHED_TO || (exports.FLOOR_PLAN_ATTACHED_TO = {}));
1013
1013
 
1014
+ /**
1015
+ * 传入一个 Promise
1016
+ * 无异常,返回 [null, data]
1017
+ * 有异常,则返回 [Error, undefined]
1018
+ * 用于替代 try&catch 处理 await 异常的方案
1019
+ */
1020
+ async function to(promise) {
1021
+ try {
1022
+ const data = await promise;
1023
+ return [null, data];
1024
+ }
1025
+ catch (error) {
1026
+ if (error instanceof Error)
1027
+ return [error, null];
1028
+ return [new Error(''), null];
1029
+ }
1030
+ }
1031
+
1014
1032
  /**
1015
1033
  * 检查一个值是否是狭义上的对象
1016
1034
  * @param {any} value 要检查的值
@@ -4636,10 +4654,48 @@
4636
4654
  });
4637
4655
  }
4638
4656
 
4657
+ /** 获取当前楼层地面的 Y 值 */
4658
+ function getFloorY(five, floorIndex) {
4659
+ const maxFloorIndex = Math.max(...five.work.observers.map((ob) => ob.floorIndex));
4660
+ return floorIndex > maxFloorIndex
4661
+ ? five.model.bounding.max.y
4662
+ : Math.max(...five.work.observers
4663
+ .filter((ob) => ob.floorIndex === floorIndex)
4664
+ .map((ob) => ob.standingPosition.y));
4665
+ }
4666
+ /** 获取当前吸附类型的 Y 值
4667
+ * * FLOOR_PLAN_ATTACHED_TO.FLOOR:当前楼层地板的 Y
4668
+ * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前模型中心的 Y
4669
+ * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前楼层天花板的 Y
4670
+ */
4671
+ function getAttachedY(five, floorIndex, attachedTo = exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER) {
4672
+ const currentFloorY = getFloorY(five, floorIndex);
4673
+ const nextFloorY = getFloorY(five, floorIndex + 1);
4674
+ if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
4675
+ return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
4676
+ else if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.CEILING)
4677
+ return nextFloorY;
4678
+ else
4679
+ return currentFloorY;
4680
+ }
4681
+ /**
4682
+ * 获取「在俯视图」状态下,模型 mm 与屏幕像素 px 的对应关系,即每 mm 对应多少 px
4683
+ * @param five five
4684
+ */
4685
+ function getPxmm(five, container, floorIndex, options) {
4686
+ const y = getAttachedY(five, floorIndex, options === null || options === void 0 ? void 0 : options.attachedTo);
4687
+ const originPosition = new THREE__namespace.Vector3(0, y, 0);
4688
+ const originPositionXUnit = new THREE__namespace.Vector3(1, y, 0);
4689
+ const mouse = originPosition.clone().project(five.camera);
4690
+ const xUnitMouse = originPositionXUnit.clone().project(five.camera);
4691
+ const pxmm = Math.abs((xUnitMouse.x - mouse.x) / 1000) * (container.getBoundingClientRect().width / 2);
4692
+ return pxmm;
4693
+ }
4694
+
4639
4695
  /**
4640
4696
  * plugin 的基本控制器
4641
4697
  */
4642
- class Controller$5 {
4698
+ class Controller$6 {
4643
4699
  constructor(five$1) {
4644
4700
  Object.defineProperty(this, "five", {
4645
4701
  enumerable: true,
@@ -4666,9 +4722,31 @@
4666
4722
  }
4667
4723
  }
4668
4724
 
4669
- class Controller$4 extends Controller$5 {
4725
+ class Controller$5 extends Controller$6 {
4670
4726
  }
4671
4727
 
4728
+ var FloorplanErrorType;
4729
+ (function (FloorplanErrorType) {
4730
+ /** 意料之外的错误 */
4731
+ FloorplanErrorType["UnknownError"] = "UnknownError";
4732
+ /** 数据未加载 */
4733
+ FloorplanErrorType["DataNotLoaded"] = "DataNotLoaded";
4734
+ /** 展示过程被隐藏打断 */
4735
+ FloorplanErrorType["BreakOffByHide"] = "BreakOffByHide";
4736
+ /** 展示过程中插件被禁用 */
4737
+ FloorplanErrorType["BreakOffByDisable"] = "BreakOffByDisable";
4738
+ /** 模型未加载完成 */
4739
+ FloorplanErrorType["ModelNotLoaded"] = "ModelNotLoaded";
4740
+ /** Five changeMode 行为不符合预期 */
4741
+ FloorplanErrorType["ChangeModeError"] = "ChangeModeError";
4742
+ /** Five updateCamera 行为不符合预期 */
4743
+ FloorplanErrorType["UpdateCameraError"] = "UpdateCameraError";
4744
+ })(FloorplanErrorType || (FloorplanErrorType = {}));
4745
+ /** 户型图展示 & 模型消失的默认时间 */
4746
+ const SHOW_ANIME_DURATION = 500;
4747
+ /** Five camera 默认 fov */
4748
+ const FIVE_CAMERA_DEFAULT_FOV = 80;
4749
+
4672
4750
  /**
4673
4751
  * 比较两个数字近似相等
4674
4752
  * @param num1 数字1
@@ -4715,42 +4793,47 @@
4715
4793
  });
4716
4794
  }
4717
4795
 
4718
- /** 获取当前楼层地面的 Y 值 */
4719
- function getFloorY(five, floorIndex) {
4720
- const maxFloorIndex = Math.max(...five.work.observers.map((ob) => ob.floorIndex));
4721
- return floorIndex > maxFloorIndex
4722
- ? five.model.bounding.max.y
4723
- : Math.max(...five.work.observers
4724
- .filter((ob) => ob.floorIndex === floorIndex)
4725
- .map((ob) => ob.standingPosition.y));
4726
- }
4727
- /** 获取当前吸附类型的 Y
4728
- * * FLOOR_PLAN_ATTACHED_TO.FLOOR:当前楼层地板的 Y
4729
- * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前模型中心的 Y
4730
- * * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前楼层天花板的 Y
4731
- */
4732
- function getAttachedY(five, floorIndex, attachedTo = exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER) {
4733
- const currentFloorY = getFloorY(five, floorIndex);
4734
- const nextFloorY = getFloorY(five, floorIndex + 1);
4735
- if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
4736
- return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
4737
- else if (attachedTo === exports.FLOOR_PLAN_ATTACHED_TO.CEILING)
4738
- return nextFloorY;
4739
- else
4740
- return currentFloorY;
4796
+ /** 判断当前状态是否可以展示户型图 */
4797
+ function checkShowState(five, showState) {
4798
+ if (five.currentMode !== showState.mode)
4799
+ return false;
4800
+ const { latitude, longitude, fov } = showState;
4801
+ const { latitude: _latitude, longitude: _longitude } = five.getCurrentState();
4802
+ const _fov = five.camera.fov;
4803
+ if (!nearlyEqual(latitude, _latitude, 2))
4804
+ return false;
4805
+ if (!nearlyEqual(longitude, _longitude, 2))
4806
+ return false;
4807
+ if (fov !== _fov)
4808
+ return false;
4809
+ return true;
4741
4810
  }
4742
- /**
4743
- * 获取「在俯视图」状态下,模型 mm 与屏幕像素 px 的对应关系,即每 mm 对应多少 px
4744
- * @param five five
4811
+ /** 更改 Five 状态到展示户型图的状态
4812
+ * 1. 判断状态不符合时,会纠正到正确的状态
4813
+ * 2. 内置了相应的动画时间计算
4814
+ * 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
4745
4815
  */
4746
- function getPxmm(five, container, floorIndex, options) {
4747
- const y = getAttachedY(five, floorIndex, options === null || options === void 0 ? void 0 : options.attachedTo);
4748
- const originPosition = new THREE__namespace.Vector3(0, y, 0);
4749
- const originPositionXUnit = new THREE__namespace.Vector3(1, y, 0);
4750
- const mouse = originPosition.clone().project(five.camera);
4751
- const xUnitMouse = originPositionXUnit.clone().project(five.camera);
4752
- const pxmm = Math.abs((xUnitMouse.x - mouse.x) / 1000) * (container.getBoundingClientRect().width / 2);
4753
- return pxmm;
4816
+ async function correctFiveState(five, showState, userAction = true) {
4817
+ // 当前已满足状态,不需要变更
4818
+ const result = checkShowState(five, showState);
4819
+ if (result === true)
4820
+ return;
4821
+ const currentFiveState = five.getCurrentState();
4822
+ // 纠正 mode
4823
+ if (currentFiveState.mode !== showState.mode) {
4824
+ const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
4825
+ if (changeModeError)
4826
+ throw new Error(FloorplanErrorType.ChangeModeError);
4827
+ return;
4828
+ }
4829
+ // 纠正相机状态
4830
+ // 根据 latitude、longitude、fov 计算动画时间,最多 1s
4831
+ const { latitude, longitude, fov } = currentFiveState;
4832
+ 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));
4833
+ const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
4834
+ if (updateCameraError)
4835
+ throw new Error(FloorplanErrorType.UpdateCameraError);
4836
+ return;
4754
4837
  }
4755
4838
 
4756
4839
  function changeModelCanvasOpacity(five, opacity, duration = 300) {
@@ -4769,15 +4852,38 @@
4769
4852
  });
4770
4853
  }
4771
4854
 
4772
- class Controller$3 extends Controller$4 {
4855
+ /** 当前 five 的相机视角是否满足户型图自动隐藏条件
4856
+ *
4857
+ * @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
4858
+ *
4859
+ */
4860
+ function shouldFloorplanHideWithPose$1(pose) {
4861
+ const { latitude, longitude } = pose;
4862
+ const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
4863
+ const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
4864
+ return latitudeHide || longitudeHide;
4865
+ }
4866
+ /** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
4867
+ *
4868
+ * @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
4869
+ *
4870
+ */
4871
+ function shouldFloorplanShowWithPose$1(pose) {
4872
+ const { latitude, longitude } = pose;
4873
+ const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
4874
+ const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
4875
+ return latitudeVisible && longitudeVisible;
4876
+ }
4877
+ class Controller$4 extends Controller$5 {
4773
4878
  constructor(five, params) {
4879
+ var _a;
4774
4880
  super(five);
4775
4881
  // =============== public properties =================
4776
4882
  Object.defineProperty(this, "name", {
4777
4883
  enumerable: true,
4778
4884
  configurable: true,
4779
4885
  writable: true,
4780
- value: 'topviewFloorplanPlugin'
4886
+ value: 'modelFloorplanPlugin'
4781
4887
  });
4782
4888
  Object.defineProperty(this, "state", {
4783
4889
  enumerable: true,
@@ -4792,18 +4898,26 @@
4792
4898
  writable: true,
4793
4899
  value: void 0
4794
4900
  });
4795
- Object.defineProperty(this, "app", {
4901
+ /** 展示户型图时,需要正确的状态 */
4902
+ Object.defineProperty(this, "showState", {
4796
4903
  enumerable: true,
4797
4904
  configurable: true,
4798
4905
  writable: true,
4799
- value: undefined
4906
+ value: void 0
4800
4907
  });
4801
- Object.defineProperty(this, "selector", {
4908
+ /** show 动画的公共 Promise */
4909
+ Object.defineProperty(this, "showPromise", {
4802
4910
  enumerable: true,
4803
4911
  configurable: true,
4804
4912
  writable: true,
4805
4913
  value: void 0
4806
4914
  });
4915
+ Object.defineProperty(this, "app", {
4916
+ enumerable: true,
4917
+ configurable: true,
4918
+ writable: true,
4919
+ value: undefined
4920
+ });
4807
4921
  Object.defineProperty(this, "panoIndex", {
4808
4922
  enumerable: true,
4809
4923
  configurable: true,
@@ -4816,6 +4930,19 @@
4816
4930
  writable: true,
4817
4931
  value: 0
4818
4932
  });
4933
+ Object.defineProperty(this, "selector", {
4934
+ enumerable: true,
4935
+ configurable: true,
4936
+ writable: true,
4937
+ value: void 0
4938
+ });
4939
+ /** 公共 Promise 的 reject 方法 */
4940
+ Object.defineProperty(this, "showRejection", {
4941
+ enumerable: true,
4942
+ configurable: true,
4943
+ writable: true,
4944
+ value: void 0
4945
+ });
4819
4946
  /** 户型图父容器 */
4820
4947
  Object.defineProperty(this, "wrapper", {
4821
4948
  enumerable: true,
@@ -4858,34 +4985,6 @@
4858
4985
  writable: true,
4859
4986
  value: false
4860
4987
  });
4861
- /** 更新户型图大小 */
4862
- Object.defineProperty(this, "updateSize", {
4863
- enumerable: true,
4864
- configurable: true,
4865
- writable: true,
4866
- value: () => {
4867
- if (!this.data)
4868
- return;
4869
- if (!this.container || !this.wrapper)
4870
- return;
4871
- if (this.five.getCurrentState().mode !== 'Topview')
4872
- return;
4873
- // 计算户型图展示大小
4874
- const { min, max } = this.data.bounding;
4875
- const width = max.x - min.x;
4876
- const height = max.y - min.y;
4877
- // 每毫米对应的 px 值
4878
- const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
4879
- const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
4880
- const _width = Math.ceil(width * pxmm);
4881
- const _height = Math.ceil(height * pxmm);
4882
- if (this.size.width === _width && this.size.height === _height)
4883
- return;
4884
- this.container.style.width = _width + 'px';
4885
- this.container.style.height = _height + 'px';
4886
- this.size = { width: _width, height: _height };
4887
- }
4888
- });
4889
4988
  /** 销毁插件 */
4890
4989
  Object.defineProperty(this, "dispose", {
4891
4990
  enumerable: true,
@@ -4903,21 +5002,213 @@
4903
5002
  this.hooks.emit('dispose');
4904
5003
  }
4905
5004
  });
4906
- Object.defineProperty(this, "_disable", {
5005
+ /** 展示户型图
5006
+ * 1. show 函数大部分情况下需要耗时
5007
+ * 2. 如果当前已经在展示中,将不会触发任何事件
5008
+ * 3. 如果展示过程被中断,将抛出错误
5009
+ * 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
5010
+ * 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
5011
+ * @param opts.floorIndex 楼层
5012
+ * @param opts.modelOpacity 模型透明度
5013
+ * @param opts.immediately 是否立即展示
5014
+ * @param opts.isAutoShow 是否是自动展示
5015
+ * @param opts.userAction 是否是用户行为
5016
+ */
5017
+ Object.defineProperty(this, "show", {
4907
5018
  enumerable: true,
4908
5019
  configurable: true,
4909
5020
  writable: true,
4910
- value: (options) => {
4911
- var _a, _b;
4912
- const { userAction } = options;
4913
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
4914
- this.app = undefined;
4915
- (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
4916
- this.removeEventListener();
4917
- this.hooks.emit('disable', { userAction });
4918
- }
4919
- });
4920
- /** modelLoaded 之后自动执行 append container 操作 */
5021
+ value: async (options = {}) => {
5022
+ if (!this.state.enabled)
5023
+ return;
5024
+ // 已经展示完成了,不做任何操作
5025
+ if (!this.showPromise && this.state.visible)
5026
+ return;
5027
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5028
+ this.updateState({ visible: true }, userAction);
5029
+ this._show(options);
5030
+ }
5031
+ });
5032
+ /** 隐藏户型图 */
5033
+ Object.defineProperty(this, "hide", {
5034
+ enumerable: true,
5035
+ configurable: true,
5036
+ writable: true,
5037
+ value: async (options = {}) => {
5038
+ if (!this.state.enabled)
5039
+ return;
5040
+ this.isHiddenByHideFunc = true;
5041
+ if (this.state.visible === false)
5042
+ return;
5043
+ this.updateState({ visible: false }, options.userAction || true);
5044
+ this._hide(options);
5045
+ }
5046
+ });
5047
+ /** 更新户型图大小 */
5048
+ Object.defineProperty(this, "updateSize", {
5049
+ enumerable: true,
5050
+ configurable: true,
5051
+ writable: true,
5052
+ value: () => {
5053
+ if (!this.data)
5054
+ return;
5055
+ if (!checkShowState(this.five, this.showState))
5056
+ return;
5057
+ if (!this.container || !this.wrapper)
5058
+ return;
5059
+ // 计算户型图展示大小
5060
+ const { min, max } = this.data.bounding;
5061
+ const width = max.x - min.x;
5062
+ const height = max.y - min.y;
5063
+ // 每毫米对应的 px 值
5064
+ const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
5065
+ const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
5066
+ const _width = Math.ceil(width * pxmm);
5067
+ const _height = Math.ceil(height * pxmm);
5068
+ if (this.size.width === _width && this.size.height === _height)
5069
+ return;
5070
+ this.container.style.width = _width + 'px';
5071
+ this.container.style.height = _height + 'px';
5072
+ this.size = { width: _width, height: _height };
5073
+ }
5074
+ });
5075
+ Object.defineProperty(this, "_disable", {
5076
+ enumerable: true,
5077
+ configurable: true,
5078
+ writable: true,
5079
+ value: (options) => {
5080
+ var _a, _b, _c;
5081
+ const { userAction } = options;
5082
+ this.hooks.emit('disable', { userAction });
5083
+ // ===== 处理展示过程中 disable =====
5084
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
5085
+ this.showPromise = undefined;
5086
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
5087
+ this.app = undefined;
5088
+ (_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
5089
+ this.removeEventListener();
5090
+ }
5091
+ });
5092
+ Object.defineProperty(this, "_enable", {
5093
+ enumerable: true,
5094
+ configurable: true,
5095
+ writable: true,
5096
+ value: (options) => {
5097
+ const { userAction } = options;
5098
+ this.addEventListener();
5099
+ if (!this.wrapper)
5100
+ return;
5101
+ this.wrapper.append(this.container);
5102
+ this.hooks.emit('enable', { userAction });
5103
+ if (this.state.visible)
5104
+ this._show({ userAction });
5105
+ }
5106
+ });
5107
+ Object.defineProperty(this, "_show", {
5108
+ enumerable: true,
5109
+ configurable: true,
5110
+ writable: true,
5111
+ value: async (options) => {
5112
+ var _a;
5113
+ if (!this.state.enabled)
5114
+ return;
5115
+ if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
5116
+ throw new Error(FloorplanErrorType.ModelNotLoaded);
5117
+ if (!this.data)
5118
+ throw new Error(FloorplanErrorType.DataNotLoaded);
5119
+ this.isHiddenByHideFunc = false;
5120
+ // ===== 参数合并 =====
5121
+ const baseShowOpts = {
5122
+ floorIndex: this.floorIndex,
5123
+ modelOpacity: this.state.config.modelOpacity,
5124
+ immediately: false,
5125
+ isAutoShow: false,
5126
+ userAction: true,
5127
+ };
5128
+ const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
5129
+ const getShowPromise = async () => {
5130
+ this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
5131
+ let hasRejected = false;
5132
+ let externalErrorMsg;
5133
+ this.showRejection = (errorMsg) => {
5134
+ hasRejected = true;
5135
+ externalErrorMsg = errorMsg;
5136
+ };
5137
+ const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
5138
+ if (correctError)
5139
+ throw correctError;
5140
+ // 异步结束要判断当前是不是被中断了
5141
+ if (hasRejected)
5142
+ throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
5143
+ // 更新户型图大小
5144
+ this.updateSize();
5145
+ // 高亮当前楼层,有两个目的
5146
+ // 1. 点击模型时,可以跳转到当前楼层的点位上
5147
+ // 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
5148
+ this.floorIndex = mergedOptions.floorIndex;
5149
+ this.five.model.show(this.floorIndex);
5150
+ // 模型消失, 渲染户型图
5151
+ const modelOpacity = mergedOptions.modelOpacity;
5152
+ const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
5153
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5154
+ this.render(renderDuration);
5155
+ };
5156
+ this.showPromise = getShowPromise()
5157
+ .then(() => {
5158
+ this.hooks.emit('showAnimationEnded', {
5159
+ auto: mergedOptions.isAutoShow,
5160
+ userAction: mergedOptions.userAction,
5161
+ });
5162
+ })
5163
+ .catch((error) => {
5164
+ this.updateState({ visible: false }, mergedOptions.userAction);
5165
+ // 自动展示的报错内部处理
5166
+ if (mergedOptions.isAutoShow)
5167
+ return;
5168
+ // 非自动展示的报错继续向外抛出
5169
+ if (error instanceof Error)
5170
+ throw error;
5171
+ })
5172
+ .finally(() => {
5173
+ this.showPromise = undefined;
5174
+ this.showRejection = undefined;
5175
+ });
5176
+ return this.showPromise;
5177
+ }
5178
+ });
5179
+ Object.defineProperty(this, "_hide", {
5180
+ enumerable: true,
5181
+ configurable: true,
5182
+ writable: true,
5183
+ value: (options) => {
5184
+ var _a;
5185
+ // ===== 处理展示过程中 hide =====
5186
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
5187
+ this.showPromise = undefined;
5188
+ // ===== 合并参数 =====
5189
+ const baseOptions = {
5190
+ userAction: true,
5191
+ isAutoHide: false,
5192
+ };
5193
+ const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
5194
+ changeModelCanvasOpacity(this.five, 1, 0);
5195
+ this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
5196
+ this.render();
5197
+ }
5198
+ });
5199
+ Object.defineProperty(this, "handleClick", {
5200
+ enumerable: true,
5201
+ configurable: true,
5202
+ writable: true,
5203
+ value: () => {
5204
+ if (!this.state.visible)
5205
+ return;
5206
+ const preventDefault = this.hooks.emit('click');
5207
+ if (preventDefault)
5208
+ return false;
5209
+ }
5210
+ });
5211
+ /** modelLoaded 之后自动执行 append container 操作 */
4921
5212
  Object.defineProperty(this, "onFiveModelLoaded", {
4922
5213
  enumerable: true,
4923
5214
  configurable: true,
@@ -4936,18 +5227,44 @@
4936
5227
  wrapper.append(this.container);
4937
5228
  }
4938
5229
  });
4939
- /** Topview 态隐藏户型图 */
5230
+ /** 更改模型时,自动隐藏户型图 */
4940
5231
  Object.defineProperty(this, "onFiveModeChange", {
4941
5232
  enumerable: true,
4942
5233
  configurable: true,
4943
5234
  writable: true,
4944
- value: (...[mode, , , , userAction]) => {
4945
- if (mode !== 'Topview' && this.state.visible) {
4946
- this.updateState({ visible: false }, userAction);
4947
- this._hide({ userAction });
5235
+ value: (mode) => {
5236
+ // 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
5237
+ if (mode !== this.showState.mode) {
5238
+ this.updateState({ visible: false }, false);
5239
+ this._hide({ userAction: false });
5240
+ }
5241
+ }
5242
+ });
5243
+ /** 惯性结束后,判断能否自动展示户型图 */
5244
+ Object.defineProperty(this, "onFiveInteriaPan", {
5245
+ enumerable: true,
5246
+ configurable: true,
5247
+ writable: true,
5248
+ value: (_, isFinal) => {
5249
+ if (!isFinal)
5250
+ return;
5251
+ if (this.state.config.autoShowEnable === false)
5252
+ return;
5253
+ // 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
5254
+ if (this.isHiddenByHideFunc)
5255
+ return;
5256
+ const fiveCurrentState = this.five.getCurrentState();
5257
+ if (fiveCurrentState.mode !== 'Floorplan')
5258
+ return;
5259
+ if (this.state.visible)
5260
+ return;
5261
+ if (shouldFloorplanShowWithPose$1(fiveCurrentState)) {
5262
+ this.updateState({ visible: true }, true);
5263
+ this._show({ isAutoShow: true });
4948
5264
  }
4949
5265
  }
4950
5266
  });
5267
+ /** panoIndex 改变时,更新 floorIndex */
4951
5268
  Object.defineProperty(this, "onFivePanoArrived", {
4952
5269
  enumerable: true,
4953
5270
  configurable: true,
@@ -4960,6 +5277,7 @@
4960
5277
  this.floorIndex = this.five.work.observers[index].floorIndex;
4961
5278
  }
4962
5279
  });
5280
+ /** cameraUpdate 时判断户型图是否应该自动隐藏 */
4963
5281
  Object.defineProperty(this, "onFiveCameraUpdate", {
4964
5282
  enumerable: true,
4965
5283
  configurable: true,
@@ -4967,43 +5285,71 @@
4967
5285
  value: (_, userAction) => {
4968
5286
  if (!this.state.visible)
4969
5287
  return;
4970
- this.updatePosition();
4971
- this.updateSize();
5288
+ // 展示过程中不处理自动隐藏逻辑
5289
+ if (this.showPromise)
5290
+ return;
5291
+ const fiveCurrentState = this.five.getCurrentState();
5292
+ if (shouldFloorplanHideWithPose$1(fiveCurrentState)) {
5293
+ this.updateState({ visible: false }, userAction);
5294
+ this._hide({ userAction, isAutoHide: true });
5295
+ }
4972
5296
  }
4973
5297
  });
5298
+ /** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
4974
5299
  Object.defineProperty(this, "onFiveWantsGesture", {
4975
5300
  enumerable: true,
4976
5301
  configurable: true,
4977
5302
  writable: true,
4978
- value: (type) => {
4979
- if (type !== 'pan' && type !== 'pinch' && type !== 'mouseWheel')
5303
+ value: (type, pointers) => {
5304
+ if (!this.state.visible)
4980
5305
  return;
4981
- if (this.state.visible && !this.state.config.gestureEnable)
5306
+ // 阻止多指操作
5307
+ if (pointers.length > 1)
5308
+ return false;
5309
+ // 阻止鼠标滚轮行为
5310
+ if (type === 'mouseWheel')
4982
5311
  return false;
4983
5312
  }
4984
5313
  });
4985
- Object.defineProperty(this, "onFiveWantsMoveToPano", {
5314
+ /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
5315
+ Object.defineProperty(this, "onFiveWantsPanGesture", {
4986
5316
  enumerable: true,
4987
5317
  configurable: true,
4988
5318
  writable: true,
4989
- value: () => {
4990
- if (this.state.visible && this.state.config.preventRoomClick)
4991
- return false;
4992
- }
4993
- });
4994
- /** 动画结束后是 Topview 态就展示户型图 */
4995
- Object.defineProperty(this, "onFiveInitAnimationEnded", {
5319
+ value: (_, isFinal) => {
5320
+ if (this.five.getCurrentState().mode !== 'Floorplan')
5321
+ return;
5322
+ if (this.state.config.autoShowEnable === false)
5323
+ return;
5324
+ if (isFinal && this.state.visible) {
5325
+ this.five.updateCamera(this.showState, 0);
5326
+ // 禁用掉 isFinal 的 panGesture 行为
5327
+ // 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
5328
+ // 此行为也会禁用 pan 结束后的惯性处理
5329
+ return false;
5330
+ }
5331
+ }
5332
+ });
5333
+ /** 阻止点击分间走点 */
5334
+ Object.defineProperty(this, "onFiveWantsTapGesture", {
4996
5335
  enumerable: true,
4997
5336
  configurable: true,
4998
5337
  writable: true,
4999
- value: (...[, , userAction]) => {
5000
- const { mode } = this.five.getCurrentState();
5001
- if (mode === 'Topview' && !this.isHiddenByHideFunc && !this.state.visible && this.state.config.autoShowEnable) {
5002
- this.updateState({ visible: true }, userAction);
5003
- this._show({ userAction });
5338
+ value: () => this.handleClick()
5339
+ });
5340
+ /** Panorama 切换到其他模态时,记录当前的相机水平视角 */
5341
+ Object.defineProperty(this, "onFiveWantsChangeMode", {
5342
+ enumerable: true,
5343
+ configurable: true,
5344
+ writable: true,
5345
+ value: (mode, prevMode) => {
5346
+ if (prevMode === 'Panorama' && mode === 'Floorplan') {
5347
+ this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
5004
5348
  }
5349
+ // if (mode !== 'Floorplan') this.hide()
5005
5350
  }
5006
5351
  });
5352
+ /** 模型楼层高亮改变时,自动进行楼层切换 */
5007
5353
  Object.defineProperty(this, "onModelShownFloorChange", {
5008
5354
  enumerable: true,
5009
5355
  configurable: true,
@@ -5016,7 +5362,6 @@
5016
5362
  this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
5017
5363
  return;
5018
5364
  }
5019
- // 模型楼层高亮改变时,自动进行楼层切换
5020
5365
  this.floorIndex = shownFloor;
5021
5366
  this.updateSize();
5022
5367
  this.render();
@@ -5026,13 +5371,19 @@
5026
5371
  this.selector = params.selector;
5027
5372
  console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
5028
5373
  }
5374
+ // =============== init Show State ===============
5375
+ this.showState = {
5376
+ mode: 'Floorplan',
5377
+ longitude: 0,
5378
+ latitude: Math.PI / 2,
5379
+ fov: FIVE_CAMERA_DEFAULT_FOV / ((_a = params === null || params === void 0 ? void 0 : params.scale) !== null && _a !== void 0 ? _a : 1),
5380
+ };
5029
5381
  // =============== init State ===============
5030
5382
  const baseConfig = {
5031
5383
  northDesc: '北',
5032
5384
  modelOpacity: 1,
5033
5385
  hoverEnable: true,
5034
5386
  compassEnable: true,
5035
- gestureEnable: false,
5036
5387
  autoShowEnable: true,
5037
5388
  ruleLabelsEnable: true,
5038
5389
  roomLabelsEnable: true,
@@ -5074,19 +5425,6 @@
5074
5425
  this.updateState(state, userAction);
5075
5426
  this.render();
5076
5427
  }
5077
- /** 更新户型图位置 */
5078
- updatePosition() {
5079
- var _a;
5080
- const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
5081
- const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE__namespace.Vector3()).setY(y);
5082
- if (!modelPosition)
5083
- return;
5084
- const ndcPosition = modelPosition.clone().project(this.five.camera);
5085
- const left = (ndcPosition.x + 1) / 2;
5086
- const top = -(ndcPosition.y - 1) / 2;
5087
- this.container.style.left = left * 100 + '%';
5088
- this.container.style.top = top * 100 + '%';
5089
- }
5090
5428
  /** 把插件的渲染DOM插入到对应的容器中去 */
5091
5429
  appendTo(wrapper) {
5092
5430
  this.wrapper = wrapper;
@@ -5097,22 +5435,7 @@
5097
5435
  this.render();
5098
5436
  return this;
5099
5437
  }
5100
- async show(options = {}) {
5101
- // 已经展示完成了,不做任何操作
5102
- if (this.state.visible)
5103
- return;
5104
- const userAction = options.userAction !== undefined ? options.userAction : true;
5105
- this.updateState({ visible: true }, userAction);
5106
- this._show({ userAction });
5107
- }
5108
- async hide(options = {}) {
5109
- this.isHiddenByHideFunc = true;
5110
- if (!this.state.visible)
5111
- return;
5112
- const userAction = options.userAction !== undefined ? options.userAction : true;
5113
- this.updateState({ visible: false }, userAction);
5114
- this._hide({ userAction });
5115
- }
5438
+ /** 启用插件 */
5116
5439
  enable(options = {}) {
5117
5440
  if (this.state.enabled)
5118
5441
  return;
@@ -5120,6 +5443,7 @@
5120
5443
  this.updateState({ enabled: true }, options.userAction || userAction);
5121
5444
  this._enable({ userAction });
5122
5445
  }
5446
+ /** 禁用插件 */
5123
5447
  disable(options = {}) {
5124
5448
  if (!this.state.enabled)
5125
5449
  return;
@@ -5133,53 +5457,22 @@
5133
5457
  const userAction = options.userAction !== undefined ? options.userAction : true;
5134
5458
  this.updateState(state, userAction);
5135
5459
  if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
5136
- const options = { userAction };
5137
- state.enabled ? this._enable(options) : this._disable(options);
5460
+ state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
5138
5461
  }
5139
5462
  if (state.visible !== undefined && prevState.visible !== state.visible) {
5140
5463
  const options = { userAction };
5141
5464
  state.visible ? this._show(options) : this._hide(options);
5142
5465
  }
5143
5466
  }
5144
- async formatData(serverData) {
5145
- return await formatData(serverData.data);
5146
- }
5147
- async _show(options) {
5148
- if (!this.state.enabled)
5149
- return;
5150
- this.isHiddenByHideFunc = false;
5151
- const { userAction } = options;
5152
- this.hooks.emit('show', { userAction });
5153
- if (this.five.getCurrentState().mode !== 'Topview') {
5154
- await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
5155
- }
5156
- this.five.model.show(this.floorIndex);
5157
- this.updatePosition();
5158
- this.updateSize();
5159
- const renderDuration = 500;
5160
- const modelOpacity = this.state.config.modelOpacity;
5161
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5162
- this.hooks.emit('showAnimationEnded', { userAction });
5163
- this.render();
5164
- }
5165
- async _hide(options) {
5166
- if (!this.state.enabled)
5467
+ changeConfigs(_config, userAction = true) {
5468
+ const config = Object.assign(Object.assign({}, this.state.config), _config);
5469
+ this.updateState({ config }, userAction);
5470
+ if (!this.container)
5167
5471
  return;
5168
- const { userAction } = options;
5169
- this.hooks.emit('hide', { userAction });
5170
- const modelOpacity = 1;
5171
- const renderDuration = 0;
5172
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5173
5472
  this.render();
5174
5473
  }
5175
- _enable(options) {
5176
- const { userAction } = options;
5177
- this.addEventListener();
5178
- if (this.wrapper)
5179
- this.wrapper.append(this.container);
5180
- this.hooks.emit('enable', { userAction });
5181
- if (this.state.visible)
5182
- this._show({ userAction });
5474
+ async formatData(serverData) {
5475
+ return await formatData(serverData.data);
5183
5476
  }
5184
5477
  updateState(state, userAction) {
5185
5478
  const prevState = this.state;
@@ -5188,6 +5481,22 @@
5188
5481
  return;
5189
5482
  this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
5190
5483
  }
5484
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
5485
+ *
5486
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
5487
+ */
5488
+ initContainer() {
5489
+ this.container.classList.add('floorplan-plugin');
5490
+ Object.assign(this.container.style, {
5491
+ position: 'absolute',
5492
+ left: '50%',
5493
+ top: '50%',
5494
+ transform: 'translate(-50%, -50%)',
5495
+ zIndex: 10,
5496
+ pointerEvents: 'none',
5497
+ });
5498
+ this.five.addExtraElement(this.container);
5499
+ }
5191
5500
  addEventListener() {
5192
5501
  if (!this.state.enabled)
5193
5502
  return;
@@ -5195,42 +5504,30 @@
5195
5504
  return;
5196
5505
  const five = this.five;
5197
5506
  five.on('modeChange', this.onFiveModeChange);
5507
+ five.on('interiaPan', this.onFiveInteriaPan);
5198
5508
  five.on('panoArrived', this.onFivePanoArrived);
5199
5509
  five.on('cameraUpdate', this.onFiveCameraUpdate);
5200
5510
  five.on('wantsGesture', this.onFiveWantsGesture);
5201
- five.on('wantsMoveToPano', this.onFiveWantsMoveToPano);
5202
- five.on('initAnimationEnded', this.onFiveInitAnimationEnded);
5511
+ five.on('wantsPanGesture', this.onFiveWantsPanGesture);
5512
+ five.on('wantsTapGesture', this.onFiveWantsTapGesture);
5513
+ five.on('wantsChangeMode', this.onFiveWantsChangeMode);
5203
5514
  five.on('modelShownFloorChange', this.onModelShownFloorChange);
5204
5515
  }
5205
5516
  removeEventListener() {
5206
5517
  const five = this.five;
5207
5518
  this.hasAddedEventListener = false;
5208
5519
  // 注意这里并没有消除 dispose 的监听
5520
+ five.off('modelLoaded', this.onFiveModelLoaded);
5209
5521
  five.off('modeChange', this.onFiveModeChange);
5522
+ five.off('interiaPan', this.onFiveInteriaPan);
5210
5523
  five.off('panoArrived', this.onFivePanoArrived);
5211
5524
  five.off('cameraUpdate', this.onFiveCameraUpdate);
5212
5525
  five.off('wantsGesture', this.onFiveWantsGesture);
5213
- five.off('wantsMoveToPano', this.onFiveWantsMoveToPano);
5214
- five.off('initAnimationEnded', this.onFiveInitAnimationEnded);
5526
+ five.off('wantsPanGesture', this.onFiveWantsPanGesture);
5527
+ five.off('wantsTapGesture', this.onFiveWantsTapGesture);
5528
+ five.off('wantsChangeMode', this.onFiveWantsChangeMode);
5215
5529
  five.off('modelShownFloorChange', this.onModelShownFloorChange);
5216
5530
  }
5217
- /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
5218
- *
5219
- * - TODO: 等 selector 功能下掉之后删除这个逻辑
5220
- */
5221
- initContainer() {
5222
- this.container.classList.add('floorplan-plugin');
5223
- Object.assign(this.container.style, {
5224
- position: 'absolute',
5225
- left: '50%',
5226
- top: '50%',
5227
- transform: 'translate3d(-50%, -50%, 10px)',
5228
- zIndex: 10,
5229
- pointerEvents: 'none',
5230
- 'will-change': 'width, height',
5231
- });
5232
- this.five.addExtraElement(this.container);
5233
- }
5234
5531
  render(duration) {
5235
5532
  if (!this.state.enabled)
5236
5533
  return;
@@ -5245,887 +5542,33 @@
5245
5542
  }
5246
5543
  }
5247
5544
 
5248
- const TopviewFloorplanPlugin = (five, params) => {
5249
- return new Controller$3(five, params);
5545
+ const ModelFloorplanPlugin = (five, params) => {
5546
+ return new Controller$4(five, params);
5250
5547
  };
5251
5548
 
5252
- /**
5253
- * 创建一个防抖动函数,该函数在高频调用时会每隔 wait 毫秒后调用 func 方法
5254
- * `throttle` 会在第一次调用时立刻调用一次
5255
- * @param func - 要防抖动的函数
5256
- * @param wait - 需要延迟的毫秒数
5549
+ /** 当前 five 的相机视角是否满足户型图自动隐藏条件
5550
+ *
5551
+ * @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
5552
+ *
5257
5553
  */
5258
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5259
- function throttle(func, wait = 200) {
5260
- let last;
5261
- return function (...args) {
5262
- if (last)
5263
- return;
5264
- func(...args);
5265
- last = setTimeout(function () {
5266
- last = null;
5267
- }, wait);
5268
- };
5269
- }
5270
-
5271
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte generated by Svelte v3.49.0 */
5272
-
5273
- function add_css$a(target) {
5274
- 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%}");
5554
+ function shouldFloorplanHideWithPose(pose) {
5555
+ const { latitude, longitude } = pose;
5556
+ const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
5557
+ const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
5558
+ return latitudeHide || longitudeHide;
5275
5559
  }
5276
-
5277
- function create_fragment$c(ctx) {
5278
- let div2;
5279
- let div1;
5280
- let div0;
5281
-
5282
- return {
5283
- c() {
5284
- div2 = internal.element("div");
5285
- div1 = internal.element("div");
5286
- div0 = internal.element("div");
5287
- internal.attr(div0, "class", "plugin-radar__camera-rotate svelte-1ty3s4p");
5288
- internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
5289
- internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
5290
- internal.attr(div1, "class", "plugin-radar__camera-position svelte-1ty3s4p");
5291
- internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
5292
- internal.attr(div2, "class", "plugin-radar__camera-wrapper svelte-1ty3s4p");
5293
- },
5294
- m(target, anchor) {
5295
- internal.insert(target, div2, anchor);
5296
- internal.append(div2, div1);
5297
- internal.append(div1, div0);
5298
- },
5299
- p(ctx, [dirty]) {
5300
- if (dirty & /*cameraImageUrl*/ 1) {
5301
- internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
5302
- }
5303
-
5304
- if (dirty & /*rotateTransform*/ 2) {
5305
- internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
5306
- }
5307
-
5308
- if (dirty & /*positionTransform*/ 4) {
5309
- internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
5310
- }
5311
- },
5312
- i: internal.noop,
5313
- o: internal.noop,
5314
- d(detaching) {
5315
- if (detaching) internal.detach(div2);
5316
- }
5317
- };
5560
+ /** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
5561
+ *
5562
+ * @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
5563
+ *
5564
+ */
5565
+ function shouldFloorplanShowWithPose(pose) {
5566
+ const { latitude, longitude } = pose;
5567
+ const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
5568
+ const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
5569
+ return latitudeVisible && longitudeVisible;
5318
5570
  }
5319
-
5320
- function getCameraRotateTransform(longitude) {
5321
- // 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
5322
- const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
5323
-
5324
- return `rotate(${rotate}deg)`;
5325
- }
5326
-
5327
- function instance$c($$self, $$props, $$invalidate) {
5328
- let positionTransform;
5329
- let rotateTransform;
5330
- let { five } = $$props;
5331
- let { pxmm } = $$props;
5332
- let { floorplanData } = $$props;
5333
- let { cameraImageUrl } = $$props;
5334
- let panoIndex = five.getCurrentState().panoIndex;
5335
- let longitude = five.getCurrentState().longitude;
5336
-
5337
- /** 获取相机在当前 Five 状态下的位移 */
5338
- function getCameraPositionTransform(floorplanData, panoIndex) {
5339
- const bounding = floorplanData.bounding;
5340
- const floorplanObserver = floorplanData.observers[panoIndex];
5341
- if (!floorplanObserver) return '';
5342
- const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
5343
- const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
5344
- const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
5345
- const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
5346
- return `translate(${left}px, ${top}px)`;
5347
- }
5348
-
5349
- function onFivePanoWillArrive(_panoIndex) {
5350
- $$invalidate(6, panoIndex = _panoIndex);
5351
- }
5352
-
5353
- const onFiveCameraDirectionUpdate = throttle(
5354
- pose => {
5355
- $$invalidate(7, longitude = pose.longitude);
5356
- },
5357
- 1000 / 60
5358
- );
5359
-
5360
- svelte.onMount(() => {
5361
- five.on('panoWillArrive', onFivePanoWillArrive);
5362
- five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
5363
-
5364
- return function dispose() {
5365
- five.off('panoWillArrive', onFivePanoWillArrive);
5366
- five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
5367
- };
5368
- });
5369
-
5370
- $$self.$$set = $$props => {
5371
- if ('five' in $$props) $$invalidate(3, five = $$props.five);
5372
- if ('pxmm' in $$props) $$invalidate(4, pxmm = $$props.pxmm);
5373
- if ('floorplanData' in $$props) $$invalidate(5, floorplanData = $$props.floorplanData);
5374
- if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
5375
- };
5376
-
5377
- $$self.$$.update = () => {
5378
- if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
5379
- // 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
5380
- $$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
5381
- }
5382
-
5383
- if ($$self.$$.dirty & /*longitude*/ 128) {
5384
- $$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
5385
- }
5386
- };
5387
-
5388
- return [
5389
- cameraImageUrl,
5390
- rotateTransform,
5391
- positionTransform,
5392
- five,
5393
- pxmm,
5394
- floorplanData,
5395
- panoIndex,
5396
- longitude
5397
- ];
5398
- }
5399
-
5400
- class Camera extends internal.SvelteComponent {
5401
- constructor(options) {
5402
- super();
5403
-
5404
- internal.init(
5405
- this,
5406
- options,
5407
- instance$c,
5408
- create_fragment$c,
5409
- internal.safe_not_equal,
5410
- {
5411
- five: 3,
5412
- pxmm: 4,
5413
- floorplanData: 5,
5414
- cameraImageUrl: 0
5415
- },
5416
- add_css$a
5417
- );
5418
- }
5419
- }
5420
-
5421
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte generated by Svelte v3.49.0 */
5422
-
5423
- function add_css$9(target) {
5424
- 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%)}");
5425
- }
5426
-
5427
- function get_each_context$5(ctx, list, i) {
5428
- const child_ctx = ctx.slice();
5429
- child_ctx[1] = list[i];
5430
- return child_ctx;
5431
- }
5432
-
5433
- // (5:2) {#each extraObjects as extraObject (extraObject.id)}
5434
- function create_each_block$5(key_1, ctx) {
5435
- let div1;
5436
- let div0;
5437
- let style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`;
5438
- let style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`;
5439
- let t;
5440
- let style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`;
5441
- let style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`;
5442
-
5443
- return {
5444
- key: key_1,
5445
- first: null,
5446
- c() {
5447
- div1 = internal.element("div");
5448
- div0 = internal.element("div");
5449
- t = internal.space();
5450
- internal.attr(div0, "class", "plugin-pano-floorplan__extra-object-item svelte-1i87fz7");
5451
- internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
5452
- internal.set_style(div0, "width", style_width, false);
5453
- internal.set_style(div0, "height", style_height, false);
5454
- internal.attr(div1, "class", "plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7");
5455
- internal.set_style(div1, "top", style_top, false);
5456
- internal.set_style(div1, "left", style_left, false);
5457
- this.first = div1;
5458
- },
5459
- m(target, anchor) {
5460
- internal.insert(target, div1, anchor);
5461
- internal.append(div1, div0);
5462
- internal.append(div1, t);
5463
- },
5464
- p(new_ctx, dirty) {
5465
- ctx = new_ctx;
5466
-
5467
- if (dirty & /*extraObjects*/ 1) {
5468
- internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
5469
- }
5470
-
5471
- if (dirty & /*extraObjects*/ 1 && style_width !== (style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`)) {
5472
- internal.set_style(div0, "width", style_width, false);
5473
- }
5474
-
5475
- if (dirty & /*extraObjects*/ 1 && style_height !== (style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`)) {
5476
- internal.set_style(div0, "height", style_height, false);
5477
- }
5478
-
5479
- if (dirty & /*extraObjects*/ 1 && style_top !== (style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`)) {
5480
- internal.set_style(div1, "top", style_top, false);
5481
- }
5482
-
5483
- if (dirty & /*extraObjects*/ 1 && style_left !== (style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`)) {
5484
- internal.set_style(div1, "left", style_left, false);
5485
- }
5486
- },
5487
- d(detaching) {
5488
- if (detaching) internal.detach(div1);
5489
- }
5490
- };
5491
- }
5492
-
5493
- function create_fragment$b(ctx) {
5494
- let div;
5495
- let each_blocks = [];
5496
- let each_1_lookup = new Map();
5497
- let each_value = /*extraObjects*/ ctx[0];
5498
- const get_key = ctx => /*extraObject*/ ctx[1].id;
5499
-
5500
- for (let i = 0; i < each_value.length; i += 1) {
5501
- let child_ctx = get_each_context$5(ctx, each_value, i);
5502
- let key = get_key(child_ctx);
5503
- each_1_lookup.set(key, each_blocks[i] = create_each_block$5(key, child_ctx));
5504
- }
5505
-
5506
- return {
5507
- c() {
5508
- div = internal.element("div");
5509
-
5510
- for (let i = 0; i < each_blocks.length; i += 1) {
5511
- each_blocks[i].c();
5512
- }
5513
-
5514
- internal.attr(div, "class", "plugin-pano-floorplan__extra-objects svelte-1i87fz7");
5515
- },
5516
- m(target, anchor) {
5517
- internal.insert(target, div, anchor);
5518
-
5519
- for (let i = 0; i < each_blocks.length; i += 1) {
5520
- each_blocks[i].m(div, null);
5521
- }
5522
- },
5523
- p(ctx, [dirty]) {
5524
- if (dirty & /*extraObjects*/ 1) {
5525
- each_value = /*extraObjects*/ ctx[0];
5526
- 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);
5527
- }
5528
- },
5529
- i: internal.noop,
5530
- o: internal.noop,
5531
- d(detaching) {
5532
- if (detaching) internal.detach(div);
5533
-
5534
- for (let i = 0; i < each_blocks.length; i += 1) {
5535
- each_blocks[i].d();
5536
- }
5537
- }
5538
- };
5539
- }
5540
-
5541
- function instance$b($$self, $$props, $$invalidate) {
5542
- let { extraObjects = [] } = $$props;
5543
-
5544
- $$self.$$set = $$props => {
5545
- if ('extraObjects' in $$props) $$invalidate(0, extraObjects = $$props.extraObjects);
5546
- };
5547
-
5548
- return [extraObjects];
5549
- }
5550
-
5551
- class ExtraObjects extends internal.SvelteComponent {
5552
- constructor(options) {
5553
- super();
5554
- internal.init(this, options, instance$b, create_fragment$b, internal.safe_not_equal, { extraObjects: 0 }, add_css$9);
5555
- }
5556
- }
5557
-
5558
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte generated by Svelte v3.49.0 */
5559
-
5560
- function create_if_block$4(ctx) {
5561
- let highlight;
5562
- let current;
5563
-
5564
- const highlight_spread_levels = [
5565
- {
5566
- five: /*five*/ ctx[0],
5567
- pxmm: /*pxmm*/ ctx[1],
5568
- floorIndex: /*floorIndex*/ ctx[2],
5569
- floorplanData: /*floorplanData*/ ctx[4],
5570
- onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
5571
- }
5572
- ];
5573
-
5574
- let highlight_props = {};
5575
-
5576
- for (let i = 0; i < highlight_spread_levels.length; i += 1) {
5577
- highlight_props = internal.assign(highlight_props, highlight_spread_levels[i]);
5578
- }
5579
-
5580
- highlight = new RoomHighlight({ props: highlight_props });
5581
-
5582
- return {
5583
- c() {
5584
- internal.create_component(highlight.$$.fragment);
5585
- },
5586
- m(target, anchor) {
5587
- internal.mount_component(highlight, target, anchor);
5588
- current = true;
5589
- },
5590
- p(ctx, dirty) {
5591
- const highlight_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, onRoomHeightClick*/ 87)
5592
- ? internal.get_spread_update(highlight_spread_levels, [
5593
- {
5594
- five: /*five*/ ctx[0],
5595
- pxmm: /*pxmm*/ ctx[1],
5596
- floorIndex: /*floorIndex*/ ctx[2],
5597
- floorplanData: /*floorplanData*/ ctx[4],
5598
- onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
5599
- }
5600
- ])
5601
- : {};
5602
-
5603
- highlight.$set(highlight_changes);
5604
- },
5605
- i(local) {
5606
- if (current) return;
5607
- internal.transition_in(highlight.$$.fragment, local);
5608
- current = true;
5609
- },
5610
- o(local) {
5611
- internal.transition_out(highlight.$$.fragment, local);
5612
- current = false;
5613
- },
5614
- d(detaching) {
5615
- internal.destroy_component(highlight, detaching);
5616
- }
5617
- };
5618
- }
5619
-
5620
- function create_fragment$a(ctx) {
5621
- let baseimage;
5622
- let t0;
5623
- let extraobjects;
5624
- let t1;
5625
- let if_block_anchor;
5626
- let current;
5627
-
5628
- const baseimage_spread_levels = [
5629
- {
5630
- floorIndex: /*floorIndex*/ ctx[2],
5631
- floorplanData: /*floorplanData*/ ctx[4]
5632
- }
5633
- ];
5634
-
5635
- let baseimage_props = {};
5636
-
5637
- for (let i = 0; i < baseimage_spread_levels.length; i += 1) {
5638
- baseimage_props = internal.assign(baseimage_props, baseimage_spread_levels[i]);
5639
- }
5640
-
5641
- baseimage = new BaseImage({ props: baseimage_props });
5642
-
5643
- extraobjects = new ExtraObjects({
5644
- props: {
5645
- extraObjects: /*currentFloorExtraObjects*/ ctx[5]
5646
- }
5647
- });
5648
-
5649
- let if_block = /*hoverEnable*/ ctx[3] && create_if_block$4(ctx);
5650
-
5651
- return {
5652
- c() {
5653
- internal.create_component(baseimage.$$.fragment);
5654
- t0 = internal.space();
5655
- internal.create_component(extraobjects.$$.fragment);
5656
- t1 = internal.space();
5657
- if (if_block) if_block.c();
5658
- if_block_anchor = internal.empty();
5659
- },
5660
- m(target, anchor) {
5661
- internal.mount_component(baseimage, target, anchor);
5662
- internal.insert(target, t0, anchor);
5663
- internal.mount_component(extraobjects, target, anchor);
5664
- internal.insert(target, t1, anchor);
5665
- if (if_block) if_block.m(target, anchor);
5666
- internal.insert(target, if_block_anchor, anchor);
5667
- current = true;
5668
- },
5669
- p(ctx, [dirty]) {
5670
- const baseimage_changes = (dirty & /*floorIndex, floorplanData*/ 20)
5671
- ? internal.get_spread_update(baseimage_spread_levels, [
5672
- {
5673
- floorIndex: /*floorIndex*/ ctx[2],
5674
- floorplanData: /*floorplanData*/ ctx[4]
5675
- }
5676
- ])
5677
- : {};
5678
-
5679
- baseimage.$set(baseimage_changes);
5680
- const extraobjects_changes = {};
5681
- if (dirty & /*currentFloorExtraObjects*/ 32) extraobjects_changes.extraObjects = /*currentFloorExtraObjects*/ ctx[5];
5682
- extraobjects.$set(extraobjects_changes);
5683
-
5684
- if (/*hoverEnable*/ ctx[3]) {
5685
- if (if_block) {
5686
- if_block.p(ctx, dirty);
5687
-
5688
- if (dirty & /*hoverEnable*/ 8) {
5689
- internal.transition_in(if_block, 1);
5690
- }
5691
- } else {
5692
- if_block = create_if_block$4(ctx);
5693
- if_block.c();
5694
- internal.transition_in(if_block, 1);
5695
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
5696
- }
5697
- } else if (if_block) {
5698
- internal.group_outros();
5699
-
5700
- internal.transition_out(if_block, 1, 1, () => {
5701
- if_block = null;
5702
- });
5703
-
5704
- internal.check_outros();
5705
- }
5706
- },
5707
- i(local) {
5708
- if (current) return;
5709
- internal.transition_in(baseimage.$$.fragment, local);
5710
- internal.transition_in(extraobjects.$$.fragment, local);
5711
- internal.transition_in(if_block);
5712
- current = true;
5713
- },
5714
- o(local) {
5715
- internal.transition_out(baseimage.$$.fragment, local);
5716
- internal.transition_out(extraobjects.$$.fragment, local);
5717
- internal.transition_out(if_block);
5718
- current = false;
5719
- },
5720
- d(detaching) {
5721
- internal.destroy_component(baseimage, detaching);
5722
- if (detaching) internal.detach(t0);
5723
- internal.destroy_component(extraobjects, detaching);
5724
- if (detaching) internal.detach(t1);
5725
- if (if_block) if_block.d(detaching);
5726
- if (detaching) internal.detach(if_block_anchor);
5727
- }
5728
- };
5729
- }
5730
-
5731
- function instance$a($$self, $$props, $$invalidate) {
5732
- let currentFloorExtraObjects;
5733
- let { five } = $$props;
5734
- let { pxmm } = $$props;
5735
- let { floorIndex } = $$props;
5736
- let { hoverEnable } = $$props;
5737
- let { floorplanData } = $$props;
5738
- let { extraObjects = [] } = $$props;
5739
- const onRoomHeightClick = undefined;
5740
-
5741
- $$self.$$set = $$props => {
5742
- if ('five' in $$props) $$invalidate(0, five = $$props.five);
5743
- if ('pxmm' in $$props) $$invalidate(1, pxmm = $$props.pxmm);
5744
- if ('floorIndex' in $$props) $$invalidate(2, floorIndex = $$props.floorIndex);
5745
- if ('hoverEnable' in $$props) $$invalidate(3, hoverEnable = $$props.hoverEnable);
5746
- if ('floorplanData' in $$props) $$invalidate(4, floorplanData = $$props.floorplanData);
5747
- if ('extraObjects' in $$props) $$invalidate(7, extraObjects = $$props.extraObjects);
5748
- };
5749
-
5750
- $$self.$$.update = () => {
5751
- if ($$self.$$.dirty & /*extraObjects, floorIndex*/ 132) {
5752
- $$invalidate(5, currentFloorExtraObjects = extraObjects === null || extraObjects === void 0
5753
- ? void 0
5754
- : extraObjects.filter(object => object.floorIndex === floorIndex));
5755
- }
5756
- };
5757
-
5758
- return [
5759
- five,
5760
- pxmm,
5761
- floorIndex,
5762
- hoverEnable,
5763
- floorplanData,
5764
- currentFloorExtraObjects,
5765
- onRoomHeightClick,
5766
- extraObjects
5767
- ];
5768
- }
5769
-
5770
- class CurrentFloor extends internal.SvelteComponent {
5771
- constructor(options) {
5772
- super();
5773
-
5774
- internal.init(this, options, instance$a, create_fragment$a, internal.safe_not_equal, {
5775
- five: 0,
5776
- pxmm: 1,
5777
- floorIndex: 2,
5778
- hoverEnable: 3,
5779
- floorplanData: 4,
5780
- extraObjects: 7
5781
- });
5782
- }
5783
- }
5784
-
5785
- /* src/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte generated by Svelte v3.49.0 */
5786
-
5787
- function add_css$8(target) {
5788
- 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}");
5789
- }
5790
-
5791
- // (41:0) {#if visible}
5792
- function create_if_block$3(ctx) {
5793
- let div;
5794
- let div_resize_listener;
5795
- let current;
5796
- let if_block = /*clientWidth*/ ctx[6] !== 0 && create_if_block_1$1(ctx);
5797
-
5798
- return {
5799
- c() {
5800
- div = internal.element("div");
5801
- if (if_block) if_block.c();
5802
- internal.attr(div, "class", "plugin-floorplan-radar svelte-1mvqyqq");
5803
- internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
5804
- },
5805
- m(target, anchor) {
5806
- internal.insert(target, div, anchor);
5807
- if (if_block) if_block.m(div, null);
5808
- div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
5809
- current = true;
5810
- },
5811
- p(ctx, dirty) {
5812
- if (/*clientWidth*/ ctx[6] !== 0) {
5813
- if (if_block) {
5814
- if_block.p(ctx, dirty);
5815
-
5816
- if (dirty & /*clientWidth*/ 64) {
5817
- internal.transition_in(if_block, 1);
5818
- }
5819
- } else {
5820
- if_block = create_if_block_1$1(ctx);
5821
- if_block.c();
5822
- internal.transition_in(if_block, 1);
5823
- if_block.m(div, null);
5824
- }
5825
- } else if (if_block) {
5826
- internal.group_outros();
5827
-
5828
- internal.transition_out(if_block, 1, 1, () => {
5829
- if_block = null;
5830
- });
5831
-
5832
- internal.check_outros();
5833
- }
5834
- },
5835
- i(local) {
5836
- if (current) return;
5837
- internal.transition_in(if_block);
5838
- current = true;
5839
- },
5840
- o(local) {
5841
- internal.transition_out(if_block);
5842
- current = false;
5843
- },
5844
- d(detaching) {
5845
- if (detaching) internal.detach(div);
5846
- if (if_block) if_block.d();
5847
- div_resize_listener();
5848
- }
5849
- };
5850
- }
5851
-
5852
- // (43:4) {#if clientWidth !== 0}
5853
- function create_if_block_1$1(ctx) {
5854
- let div;
5855
- let currentfloor;
5856
- let t;
5857
- let camera;
5858
- let style_width = `${/*contentWidth*/ ctx[8]}px`;
5859
- let style_height = `${/*contentHeight*/ ctx[11]}px`;
5860
- let current;
5861
-
5862
- const currentfloor_spread_levels = [
5863
- {
5864
- five: /*five*/ ctx[0],
5865
- pxmm: /*pxmm*/ ctx[9],
5866
- floorIndex: /*floorIndex*/ ctx[10],
5867
- floorplanData: /*floorplanData*/ ctx[3],
5868
- hoverEnable: /*hoverEnable*/ ctx[2],
5869
- extraObjects: /*extraObjects*/ ctx[5]
5870
- }
5871
- ];
5872
-
5873
- let currentfloor_props = {};
5874
-
5875
- for (let i = 0; i < currentfloor_spread_levels.length; i += 1) {
5876
- currentfloor_props = internal.assign(currentfloor_props, currentfloor_spread_levels[i]);
5877
- }
5878
-
5879
- currentfloor = new CurrentFloor({ props: currentfloor_props });
5880
-
5881
- const camera_spread_levels = [
5882
- {
5883
- pxmm: /*pxmm*/ ctx[9],
5884
- five: /*five*/ ctx[0],
5885
- floorplanData: /*floorplanData*/ ctx[3],
5886
- cameraImageUrl: /*cameraImageUrl*/ ctx[4]
5887
- }
5888
- ];
5889
-
5890
- let camera_props = {};
5891
-
5892
- for (let i = 0; i < camera_spread_levels.length; i += 1) {
5893
- camera_props = internal.assign(camera_props, camera_spread_levels[i]);
5894
- }
5895
-
5896
- camera = new Camera({ props: camera_props });
5897
-
5898
- return {
5899
- c() {
5900
- div = internal.element("div");
5901
- internal.create_component(currentfloor.$$.fragment);
5902
- t = internal.space();
5903
- internal.create_component(camera.$$.fragment);
5904
- internal.attr(div, "class", "plugin-floorplan-radar-container svelte-1mvqyqq");
5905
- internal.set_style(div, "width", style_width, false);
5906
- internal.set_style(div, "height", style_height, false);
5907
- },
5908
- m(target, anchor) {
5909
- internal.insert(target, div, anchor);
5910
- internal.mount_component(currentfloor, div, null);
5911
- internal.append(div, t);
5912
- internal.mount_component(camera, div, null);
5913
- current = true;
5914
- },
5915
- p(ctx, dirty) {
5916
- const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, hoverEnable, extraObjects*/ 1581)
5917
- ? internal.get_spread_update(currentfloor_spread_levels, [
5918
- {
5919
- five: /*five*/ ctx[0],
5920
- pxmm: /*pxmm*/ ctx[9],
5921
- floorIndex: /*floorIndex*/ ctx[10],
5922
- floorplanData: /*floorplanData*/ ctx[3],
5923
- hoverEnable: /*hoverEnable*/ ctx[2],
5924
- extraObjects: /*extraObjects*/ ctx[5]
5925
- }
5926
- ])
5927
- : {};
5928
-
5929
- currentfloor.$set(currentfloor_changes);
5930
-
5931
- const camera_changes = (dirty & /*pxmm, five, floorplanData, cameraImageUrl*/ 537)
5932
- ? internal.get_spread_update(camera_spread_levels, [
5933
- {
5934
- pxmm: /*pxmm*/ ctx[9],
5935
- five: /*five*/ ctx[0],
5936
- floorplanData: /*floorplanData*/ ctx[3],
5937
- cameraImageUrl: /*cameraImageUrl*/ ctx[4]
5938
- }
5939
- ])
5940
- : {};
5941
-
5942
- camera.$set(camera_changes);
5943
-
5944
- if (dirty & /*contentWidth*/ 256 && style_width !== (style_width = `${/*contentWidth*/ ctx[8]}px`)) {
5945
- internal.set_style(div, "width", style_width, false);
5946
- }
5947
-
5948
- if (dirty & /*contentHeight*/ 2048 && style_height !== (style_height = `${/*contentHeight*/ ctx[11]}px`)) {
5949
- internal.set_style(div, "height", style_height, false);
5950
- }
5951
- },
5952
- i(local) {
5953
- if (current) return;
5954
- internal.transition_in(currentfloor.$$.fragment, local);
5955
- internal.transition_in(camera.$$.fragment, local);
5956
- current = true;
5957
- },
5958
- o(local) {
5959
- internal.transition_out(currentfloor.$$.fragment, local);
5960
- internal.transition_out(camera.$$.fragment, local);
5961
- current = false;
5962
- },
5963
- d(detaching) {
5964
- if (detaching) internal.detach(div);
5965
- internal.destroy_component(currentfloor);
5966
- internal.destroy_component(camera);
5967
- }
5968
- };
5969
- }
5970
-
5971
- function create_fragment$9(ctx) {
5972
- let if_block_anchor;
5973
- let current;
5974
- let if_block = /*visible*/ ctx[1] && create_if_block$3(ctx);
5975
-
5976
- return {
5977
- c() {
5978
- if (if_block) if_block.c();
5979
- if_block_anchor = internal.empty();
5980
- },
5981
- m(target, anchor) {
5982
- if (if_block) if_block.m(target, anchor);
5983
- internal.insert(target, if_block_anchor, anchor);
5984
- current = true;
5985
- },
5986
- p(ctx, [dirty]) {
5987
- if (/*visible*/ ctx[1]) {
5988
- if (if_block) {
5989
- if_block.p(ctx, dirty);
5990
-
5991
- if (dirty & /*visible*/ 2) {
5992
- internal.transition_in(if_block, 1);
5993
- }
5994
- } else {
5995
- if_block = create_if_block$3(ctx);
5996
- if_block.c();
5997
- internal.transition_in(if_block, 1);
5998
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
5999
- }
6000
- } else if (if_block) {
6001
- internal.group_outros();
6002
-
6003
- internal.transition_out(if_block, 1, 1, () => {
6004
- if_block = null;
6005
- });
6006
-
6007
- internal.check_outros();
6008
- }
6009
- },
6010
- i(local) {
6011
- if (current) return;
6012
- internal.transition_in(if_block);
6013
- current = true;
6014
- },
6015
- o(local) {
6016
- internal.transition_out(if_block);
6017
- current = false;
6018
- },
6019
- d(detaching) {
6020
- if (if_block) if_block.d(detaching);
6021
- if (detaching) internal.detach(if_block_anchor);
6022
- }
6023
- };
6024
- }
6025
-
6026
- function instance$9($$self, $$props, $$invalidate) {
6027
- let { five } = $$props;
6028
- let { visible } = $$props;
6029
- let { hoverEnable } = $$props;
6030
- let { floorplanData } = $$props;
6031
- let { cameraImageUrl } = $$props;
6032
- let { extraObjects = [] } = $$props;
6033
- let pxmm = 0;
6034
- let floorIndex = 0;
6035
- let clientWidth = 0;
6036
- let clientHeight = 0;
6037
- let contentWidth = 0;
6038
- let contentHeight = 0;
6039
-
6040
- function handlePanoArrived(panoIndex) {
6041
- $$invalidate(10, floorIndex = five.work.observers[panoIndex].floorIndex);
6042
- }
6043
-
6044
- svelte.onMount(() => {
6045
- five.on('panoArrived', handlePanoArrived);
6046
-
6047
- return () => {
6048
- five.off('panoArrived', handlePanoArrived);
6049
- };
6050
- });
6051
-
6052
- function div_elementresize_handler() {
6053
- clientWidth = this.clientWidth;
6054
- clientHeight = this.clientHeight;
6055
- $$invalidate(6, clientWidth);
6056
- $$invalidate(7, clientHeight);
6057
- }
6058
-
6059
- $$self.$$set = $$props => {
6060
- if ('five' in $$props) $$invalidate(0, five = $$props.five);
6061
- if ('visible' in $$props) $$invalidate(1, visible = $$props.visible);
6062
- if ('hoverEnable' in $$props) $$invalidate(2, hoverEnable = $$props.hoverEnable);
6063
- if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
6064
- if ('cameraImageUrl' in $$props) $$invalidate(4, cameraImageUrl = $$props.cameraImageUrl);
6065
- if ('extraObjects' in $$props) $$invalidate(5, extraObjects = $$props.extraObjects);
6066
- };
6067
-
6068
- $$self.$$.update = () => {
6069
- if ($$self.$$.dirty & /*clientWidth, clientHeight, floorplanData, contentWidth*/ 456) {
6070
- {
6071
- const size = Math.min(clientWidth, clientHeight);
6072
- const { max, min } = floorplanData.bounding;
6073
- const boundingWidth = max.x - min.x;
6074
- const boundingHeight = max.y - min.y;
6075
-
6076
- const contentSize = (function getSize() {
6077
- if (boundingWidth > boundingHeight) return [size, size / boundingWidth * boundingHeight];
6078
- return [size / boundingHeight * boundingWidth, size];
6079
- })();
6080
-
6081
- $$invalidate(8, contentWidth = contentSize[0]);
6082
- $$invalidate(11, contentHeight = contentSize[1]);
6083
- $$invalidate(9, pxmm = contentWidth / boundingWidth);
6084
- }
6085
- }
6086
- };
6087
-
6088
- return [
6089
- five,
6090
- visible,
6091
- hoverEnable,
6092
- floorplanData,
6093
- cameraImageUrl,
6094
- extraObjects,
6095
- clientWidth,
6096
- clientHeight,
6097
- contentWidth,
6098
- pxmm,
6099
- floorIndex,
6100
- contentHeight,
6101
- div_elementresize_handler
6102
- ];
6103
- }
6104
-
6105
- class Main extends internal.SvelteComponent {
6106
- constructor(options) {
6107
- super();
6108
-
6109
- internal.init(
6110
- this,
6111
- options,
6112
- instance$9,
6113
- create_fragment$9,
6114
- internal.safe_not_equal,
6115
- {
6116
- five: 0,
6117
- visible: 1,
6118
- hoverEnable: 2,
6119
- floorplanData: 3,
6120
- cameraImageUrl: 4,
6121
- extraObjects: 5
6122
- },
6123
- add_css$8
6124
- );
6125
- }
6126
- }
6127
-
6128
- class Controller$2 extends Controller$4 {
5571
+ class Controller$3 extends Controller$5 {
6129
5572
  constructor(five, params) {
6130
5573
  super(five);
6131
5574
  // =============== public properties =================
@@ -6133,115 +5576,517 @@
6133
5576
  enumerable: true,
6134
5577
  configurable: true,
6135
5578
  writable: true,
6136
- value: 'panoFloorplanRadarPlugin'
5579
+ value: 'modelFloorplanPlugin'
5580
+ });
5581
+ Object.defineProperty(this, "state", {
5582
+ enumerable: true,
5583
+ configurable: true,
5584
+ writable: true,
5585
+ value: void 0
5586
+ });
5587
+ // =============== private properties =================
5588
+ Object.defineProperty(this, "data", {
5589
+ enumerable: true,
5590
+ configurable: true,
5591
+ writable: true,
5592
+ value: void 0
5593
+ });
5594
+ /** 展示户型图时,需要正确的状态 */
5595
+ Object.defineProperty(this, "showState", {
5596
+ enumerable: true,
5597
+ configurable: true,
5598
+ writable: true,
5599
+ value: void 0
5600
+ });
5601
+ /** show 动画的公共 Promise */
5602
+ Object.defineProperty(this, "showPromise", {
5603
+ enumerable: true,
5604
+ configurable: true,
5605
+ writable: true,
5606
+ value: void 0
5607
+ });
5608
+ Object.defineProperty(this, "app", {
5609
+ enumerable: true,
5610
+ configurable: true,
5611
+ writable: true,
5612
+ value: undefined
5613
+ });
5614
+ Object.defineProperty(this, "panoIndex", {
5615
+ enumerable: true,
5616
+ configurable: true,
5617
+ writable: true,
5618
+ value: 0
5619
+ });
5620
+ Object.defineProperty(this, "floorIndex", {
5621
+ enumerable: true,
5622
+ configurable: true,
5623
+ writable: true,
5624
+ value: 0
5625
+ });
5626
+ Object.defineProperty(this, "selector", {
5627
+ enumerable: true,
5628
+ configurable: true,
5629
+ writable: true,
5630
+ value: void 0
5631
+ });
5632
+ /** 公共 Promise 的 reject 方法 */
5633
+ Object.defineProperty(this, "showRejection", {
5634
+ enumerable: true,
5635
+ configurable: true,
5636
+ writable: true,
5637
+ value: void 0
5638
+ });
5639
+ /** 户型图父容器 */
5640
+ Object.defineProperty(this, "wrapper", {
5641
+ enumerable: true,
5642
+ configurable: true,
5643
+ writable: true,
5644
+ value: void 0
5645
+ });
5646
+ /** 户型图主容器 */
5647
+ Object.defineProperty(this, "container", {
5648
+ enumerable: true,
5649
+ configurable: true,
5650
+ writable: true,
5651
+ value: document.createElement('div')
5652
+ });
5653
+ /** 展示户型图图前,Five 的 Panorama Longitude */
5654
+ Object.defineProperty(this, "lastPanoramaLongitude", {
5655
+ enumerable: true,
5656
+ configurable: true,
5657
+ writable: true,
5658
+ value: 0
5659
+ });
5660
+ /** 户型图大小 */
5661
+ Object.defineProperty(this, "size", {
5662
+ enumerable: true,
5663
+ configurable: true,
5664
+ writable: true,
5665
+ value: { width: 0, height: 0 }
5666
+ });
5667
+ /** 是否已经执行过事件监听 */
5668
+ Object.defineProperty(this, "hasAddedEventListener", {
5669
+ enumerable: true,
5670
+ configurable: true,
5671
+ writable: true,
5672
+ value: false
5673
+ });
5674
+ /** 上一次隐藏是否是用户调用了 hide 导致的 */
5675
+ Object.defineProperty(this, "isHiddenByHideFunc", {
5676
+ enumerable: true,
5677
+ configurable: true,
5678
+ writable: true,
5679
+ value: false
5680
+ });
5681
+ /** 销毁插件 */
5682
+ Object.defineProperty(this, "dispose", {
5683
+ enumerable: true,
5684
+ configurable: true,
5685
+ writable: true,
5686
+ value: () => {
5687
+ var _a, _b;
5688
+ this.removeEventListener();
5689
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
5690
+ this.app = undefined;
5691
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
5692
+ this.data = undefined;
5693
+ this.wrapper = undefined;
5694
+ this.selector = undefined;
5695
+ this.hooks.emit('dispose');
5696
+ }
5697
+ });
5698
+ /** 展示户型图
5699
+ * 1. show 函数大部分情况下需要耗时
5700
+ * 2. 如果当前已经在展示中,将不会触发任何事件
5701
+ * 3. 如果展示过程被中断,将抛出错误
5702
+ * 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
5703
+ * 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
5704
+ * @param opts.floorIndex 楼层
5705
+ * @param opts.modelOpacity 模型透明度
5706
+ * @param opts.immediately 是否立即展示
5707
+ * @param opts.isAutoShow 是否是自动展示
5708
+ * @param opts.userAction 是否是用户行为
5709
+ */
5710
+ Object.defineProperty(this, "show", {
5711
+ enumerable: true,
5712
+ configurable: true,
5713
+ writable: true,
5714
+ value: async (options = {}) => {
5715
+ if (!this.state.enabled)
5716
+ return;
5717
+ // 已经展示完成了,不做任何操作
5718
+ if (!this.showPromise && this.state.visible)
5719
+ return;
5720
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5721
+ this.updateState({ visible: true }, userAction);
5722
+ this._show(options);
5723
+ }
5724
+ });
5725
+ /** 隐藏户型图 */
5726
+ Object.defineProperty(this, "hide", {
5727
+ enumerable: true,
5728
+ configurable: true,
5729
+ writable: true,
5730
+ value: async (options = {}) => {
5731
+ if (!this.state.enabled)
5732
+ return;
5733
+ this.isHiddenByHideFunc = true;
5734
+ if (this.state.visible === false)
5735
+ return;
5736
+ this.updateState({ visible: false }, options.userAction || true);
5737
+ this._hide(options);
5738
+ }
5739
+ });
5740
+ /** 更新户型图大小 */
5741
+ Object.defineProperty(this, "updateSize", {
5742
+ enumerable: true,
5743
+ configurable: true,
5744
+ writable: true,
5745
+ value: () => {
5746
+ if (!this.data)
5747
+ return;
5748
+ if (!checkShowState(this.five, this.showState))
5749
+ return;
5750
+ if (!this.container || !this.wrapper)
5751
+ return;
5752
+ // 计算户型图展示大小
5753
+ const { min, max } = this.data.bounding;
5754
+ const width = max.x - min.x;
5755
+ const height = max.y - min.y;
5756
+ // 每毫米对应的 px 值
5757
+ const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
5758
+ const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
5759
+ const _width = Math.ceil(width * pxmm);
5760
+ const _height = Math.ceil(height * pxmm);
5761
+ if (this.size.width === _width && this.size.height === _height)
5762
+ return;
5763
+ this.container.style.width = _width + 'px';
5764
+ this.container.style.height = _height + 'px';
5765
+ this.size = { width: _width, height: _height };
5766
+ }
5767
+ });
5768
+ Object.defineProperty(this, "_disable", {
5769
+ enumerable: true,
5770
+ configurable: true,
5771
+ writable: true,
5772
+ value: (options) => {
5773
+ var _a, _b, _c;
5774
+ const { userAction } = options;
5775
+ this.hooks.emit('disable', { userAction });
5776
+ // ===== 处理展示过程中 disable =====
5777
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
5778
+ this.showPromise = undefined;
5779
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
5780
+ this.app = undefined;
5781
+ (_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
5782
+ this.removeEventListener();
5783
+ }
6137
5784
  });
6138
- Object.defineProperty(this, "state", {
5785
+ Object.defineProperty(this, "_enable", {
6139
5786
  enumerable: true,
6140
5787
  configurable: true,
6141
5788
  writable: true,
6142
- value: void 0
5789
+ value: (options) => {
5790
+ const { userAction } = options;
5791
+ this.addEventListener();
5792
+ if (!this.wrapper)
5793
+ return;
5794
+ this.wrapper.append(this.container);
5795
+ this.hooks.emit('enable', { userAction });
5796
+ if (this.state.visible)
5797
+ this._show({ userAction });
5798
+ }
6143
5799
  });
6144
- // =============== protected properties =================
6145
- Object.defineProperty(this, "data", {
5800
+ Object.defineProperty(this, "_show", {
6146
5801
  enumerable: true,
6147
5802
  configurable: true,
6148
5803
  writable: true,
6149
- value: void 0
5804
+ value: async (options) => {
5805
+ var _a;
5806
+ if (!this.state.enabled)
5807
+ return;
5808
+ if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
5809
+ throw new Error(FloorplanErrorType.ModelNotLoaded);
5810
+ if (!this.data)
5811
+ throw new Error(FloorplanErrorType.DataNotLoaded);
5812
+ this.isHiddenByHideFunc = false;
5813
+ // ===== 参数合并 =====
5814
+ const baseShowOpts = {
5815
+ floorIndex: this.floorIndex,
5816
+ modelOpacity: this.state.config.modelOpacity,
5817
+ immediately: false,
5818
+ isAutoShow: false,
5819
+ userAction: true,
5820
+ };
5821
+ const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
5822
+ const getShowPromise = async () => {
5823
+ this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
5824
+ let hasRejected = false;
5825
+ let externalErrorMsg;
5826
+ this.showRejection = (errorMsg) => {
5827
+ hasRejected = true;
5828
+ externalErrorMsg = errorMsg;
5829
+ };
5830
+ const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
5831
+ if (correctError)
5832
+ throw correctError;
5833
+ // 异步结束要判断当前是不是被中断了
5834
+ if (hasRejected)
5835
+ throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
5836
+ // 更新户型图大小
5837
+ this.updateSize();
5838
+ this.updatePosition();
5839
+ // 高亮当前楼层,有两个目的
5840
+ // 1. 点击模型时,可以跳转到当前楼层的点位上
5841
+ // 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
5842
+ this.floorIndex = mergedOptions.floorIndex;
5843
+ this.five.model.show(this.floorIndex);
5844
+ // 模型消失, 渲染户型图
5845
+ const modelOpacity = mergedOptions.modelOpacity;
5846
+ const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
5847
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5848
+ this.render(renderDuration);
5849
+ };
5850
+ this.showPromise = getShowPromise()
5851
+ .then(() => {
5852
+ this.hooks.emit('showAnimationEnded', {
5853
+ auto: mergedOptions.isAutoShow,
5854
+ userAction: mergedOptions.userAction,
5855
+ });
5856
+ })
5857
+ .catch((error) => {
5858
+ this.updateState({ visible: false }, mergedOptions.userAction);
5859
+ // 自动展示的报错内部处理
5860
+ if (mergedOptions.isAutoShow)
5861
+ return;
5862
+ // 非自动展示的报错继续向外抛出
5863
+ if (error instanceof Error)
5864
+ throw error;
5865
+ })
5866
+ .finally(() => {
5867
+ this.showPromise = undefined;
5868
+ this.showRejection = undefined;
5869
+ });
5870
+ return this.showPromise;
5871
+ }
6150
5872
  });
6151
- // =============== private properties =================
6152
- Object.defineProperty(this, "app", {
5873
+ Object.defineProperty(this, "_hide", {
6153
5874
  enumerable: true,
6154
5875
  configurable: true,
6155
5876
  writable: true,
6156
- value: void 0
5877
+ value: (options) => {
5878
+ var _a;
5879
+ // ===== 处理展示过程中 hide =====
5880
+ (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
5881
+ this.showPromise = undefined;
5882
+ // ===== 合并参数 =====
5883
+ const baseOptions = {
5884
+ userAction: true,
5885
+ isAutoHide: false,
5886
+ };
5887
+ const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
5888
+ changeModelCanvasOpacity(this.five, 1, 0);
5889
+ this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
5890
+ this.render();
5891
+ }
6157
5892
  });
6158
- Object.defineProperty(this, "wrapperSelector", {
5893
+ Object.defineProperty(this, "handleClick", {
6159
5894
  enumerable: true,
6160
5895
  configurable: true,
6161
5896
  writable: true,
6162
- value: ''
5897
+ value: () => {
5898
+ if (!this.state.visible)
5899
+ return;
5900
+ const preventDefault = this.hooks.emit('click');
5901
+ if (preventDefault)
5902
+ return false;
5903
+ }
6163
5904
  });
6164
- Object.defineProperty(this, "wrapper", {
5905
+ /** modelLoaded 之后自动执行 append container 操作 */
5906
+ Object.defineProperty(this, "onFiveModelLoaded", {
6165
5907
  enumerable: true,
6166
5908
  configurable: true,
6167
5909
  writable: true,
6168
- value: null
5910
+ value: () => {
5911
+ if (this.state.enabled === false)
5912
+ return;
5913
+ if (this.wrapper)
5914
+ return;
5915
+ if (!this.selector)
5916
+ return;
5917
+ const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
5918
+ if (!wrapper)
5919
+ throw new Error('不正确的父容器选择器');
5920
+ this.wrapper = wrapper;
5921
+ wrapper.append(this.container);
5922
+ }
6169
5923
  });
6170
- Object.defineProperty(this, "disposed", {
5924
+ /** 更改模型时,自动隐藏户型图 */
5925
+ Object.defineProperty(this, "onFiveModeChange", {
6171
5926
  enumerable: true,
6172
5927
  configurable: true,
6173
5928
  writable: true,
6174
- value: false
5929
+ value: (mode) => {
5930
+ // 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
5931
+ if (mode !== this.showState.mode) {
5932
+ this.updateState({ visible: false }, false);
5933
+ this._hide({ userAction: false });
5934
+ }
5935
+ }
6175
5936
  });
6176
- Object.defineProperty(this, "extraObjects", {
5937
+ /** panoIndex 改变时,更新 floorIndex */
5938
+ Object.defineProperty(this, "onFivePanoArrived", {
6177
5939
  enumerable: true,
6178
5940
  configurable: true,
6179
5941
  writable: true,
6180
- value: []
5942
+ value: (index) => {
5943
+ var _a;
5944
+ if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
5945
+ return;
5946
+ this.panoIndex = index;
5947
+ this.floorIndex = this.five.work.observers[index].floorIndex;
5948
+ }
6181
5949
  });
6182
- Object.defineProperty(this, "dispose", {
5950
+ /** cameraUpdate 时判断户型图是否应该自动隐藏 */
5951
+ Object.defineProperty(this, "onFiveCameraUpdate", {
6183
5952
  enumerable: true,
6184
5953
  configurable: true,
6185
5954
  writable: true,
6186
- value: () => {
6187
- var _a;
6188
- this.disposed = true;
6189
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6190
- this.wrapper = null;
6191
- this.wrapperSelector = '';
6192
- this.hooks.emit('dispose');
5955
+ value: (_, userAction) => {
5956
+ if (!this.state.visible)
5957
+ return;
5958
+ // 展示过程中不处理自动隐藏逻辑
5959
+ if (this.showPromise)
5960
+ return;
5961
+ const fiveCurrentState = this.five.getCurrentState();
5962
+ this.updatePosition();
5963
+ this.updateSize();
5964
+ if (shouldFloorplanHideWithPose(fiveCurrentState)) {
5965
+ this.updateState({ visible: false }, userAction);
5966
+ this._hide({ userAction });
5967
+ }
6193
5968
  }
6194
5969
  });
6195
- Object.defineProperty(this, "_disable", {
5970
+ /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
5971
+ Object.defineProperty(this, "onFiveWantsPanGesture", {
6196
5972
  enumerable: true,
6197
5973
  configurable: true,
6198
5974
  writable: true,
6199
- value: (options) => {
6200
- var _a;
6201
- const { userAction } = options;
6202
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6203
- this.app = undefined;
6204
- this.hooks.emit('disable', { userAction });
5975
+ value: (_, isFinal) => {
5976
+ if (this.five.getCurrentState().mode !== this.showState.mode)
5977
+ return;
5978
+ if (this.state.config.autoShowEnable === false)
5979
+ return;
5980
+ if (isFinal && this.state.visible) {
5981
+ this.five.updateCamera(this.showState, 0);
5982
+ // 禁用掉 isFinal 的 panGesture 行为
5983
+ // 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
5984
+ // 此行为也会禁用 pan 结束后的惯性处理
5985
+ return false;
5986
+ }
5987
+ // 自动展示户型图
5988
+ // Five 没有惯性滚动,所以把自动展示的逻辑做在 WantsPanGesture 了
5989
+ if (isFinal && !this.state.visible) {
5990
+ // 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
5991
+ if (this.isHiddenByHideFunc)
5992
+ return;
5993
+ const fiveCurrentState = this.five.getCurrentState();
5994
+ if (fiveCurrentState.mode !== this.showState.mode)
5995
+ return;
5996
+ if (this.state.visible)
5997
+ return;
5998
+ if (shouldFloorplanShowWithPose(fiveCurrentState)) {
5999
+ this.updateState({ visible: true }, true);
6000
+ this._show({ isAutoShow: true });
6001
+ }
6002
+ return false;
6003
+ }
6205
6004
  }
6206
6005
  });
6207
- this.five = five;
6006
+ /** 阻止点击分间走点 */
6007
+ Object.defineProperty(this, "onFiveWantsTapGesture", {
6008
+ enumerable: true,
6009
+ configurable: true,
6010
+ writable: true,
6011
+ value: () => this.handleClick()
6012
+ });
6013
+ /** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
6014
+ Object.defineProperty(this, "onFiveWantsChangeMode", {
6015
+ enumerable: true,
6016
+ configurable: true,
6017
+ writable: true,
6018
+ value: (mode, prevMode) => {
6019
+ if (prevMode === 'Panorama' && mode === this.showState.mode) {
6020
+ this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
6021
+ }
6022
+ }
6023
+ });
6024
+ /** 模型楼层高亮改变时,自动进行楼层切换 */
6025
+ Object.defineProperty(this, "onModelShownFloorChange", {
6026
+ enumerable: true,
6027
+ configurable: true,
6028
+ writable: true,
6029
+ value: (shownFloor) => {
6030
+ if (this.floorIndex === shownFloor)
6031
+ return;
6032
+ if (shownFloor === null) {
6033
+ const panoIndex = this.five.getCurrentState().panoIndex;
6034
+ this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
6035
+ return;
6036
+ }
6037
+ this.floorIndex = shownFloor;
6038
+ this.updateSize();
6039
+ this.render();
6040
+ }
6041
+ });
6042
+ if (params === null || params === void 0 ? void 0 : params.selector) {
6043
+ this.selector = params.selector;
6044
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6045
+ }
6046
+ // =============== init Show State ===============
6047
+ this.showState = {
6048
+ mode: 'Mapview',
6049
+ longitude: 0,
6050
+ latitude: Math.PI / 2,
6051
+ fov: 90,
6052
+ };
6208
6053
  // =============== init State ===============
6209
6054
  const baseConfig = {
6210
- hoverEnable: false,
6055
+ northDesc: '北',
6056
+ modelOpacity: 1,
6057
+ hoverEnable: true,
6058
+ compassEnable: true,
6059
+ autoShowEnable: true,
6060
+ ruleLabelsEnable: true,
6061
+ roomLabelsEnable: true,
6211
6062
  cameraImageUrl: CAMERA_IMAGE,
6063
+ attachedTo: exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
6064
+ getLabelElement: undefined,
6065
+ adaptiveRoomLabelVisibleEnable: true,
6212
6066
  };
6213
- const paramsConfig = (params === null || params === void 0 ? void 0 : params.configs) ? params.configs : {};
6067
+ const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
6214
6068
  const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
6215
- this.state = { enabled: true, visible: true, config };
6216
- // =============== init wrapper ===============
6217
- if (params === null || params === void 0 ? void 0 : params.wrapper)
6218
- console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6219
- if (typeof (params === null || params === void 0 ? void 0 : params.wrapper) === 'string')
6220
- this.wrapperSelector = params.wrapper;
6221
- else if ((params === null || params === void 0 ? void 0 : params.wrapper) instanceof Element)
6222
- this.wrapper = params.wrapper;
6069
+ this.state = {
6070
+ enabled: true,
6071
+ visible: false,
6072
+ config,
6073
+ };
6074
+ // =============== init Container ===============
6075
+ this.initContainer();
6223
6076
  // =============== init Listener ===============
6077
+ // 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
6078
+ // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
6079
+ five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
6224
6080
  five.once('dispose', this.dispose);
6081
+ this.addEventListener();
6225
6082
  }
6226
6083
  async load(serverData, state, userAction = true) {
6227
- // const loadImage = async () => {
6228
- // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
6229
- // // 当有 svgString 时,没有加载过程
6230
- // if (floorplanData.outlines[floorIndex]?.svgContent) return
6231
- // // 如果当前楼层图片不存在,不存在加载过程
6232
- // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
6233
- // if (!nowFloorImageSrc) return
6234
- // // 图片加载完成时再 render
6235
- // await new Promise<void>((resolve) => {
6236
- // const nowFloorImage = new Image()
6237
- // nowFloorImage.src = nowFloorImageSrc
6238
- // nowFloorImage.onload = () => resolve()
6239
- // })
6240
- // }
6241
- // await loadImage()
6242
6084
  function isPluginServerData(serverData) {
6243
6085
  return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6244
6086
  }
6087
+ const _data = serverData;
6088
+ if (_data && !_data.version)
6089
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
6245
6090
  const copyData = JSON.parse(JSON.stringify(serverData));
6246
6091
  const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6247
6092
  const prevData = this.data;
@@ -6252,21 +6097,17 @@
6252
6097
  this.updateState(state, userAction);
6253
6098
  this.render();
6254
6099
  }
6255
- async show(options = {}) {
6256
- // 已经展示完成了,不做任何操作
6257
- if (this.state.visible)
6258
- return;
6259
- const userAction = options.userAction !== undefined ? options.userAction : true;
6260
- this.updateState({ visible: true }, userAction);
6261
- this._show({ userAction });
6262
- }
6263
- async hide(options = {}) {
6264
- if (!this.state.visible)
6100
+ /** 把插件的渲染DOM插入到对应的容器中去 */
6101
+ appendTo(wrapper) {
6102
+ this.wrapper = wrapper;
6103
+ // 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
6104
+ if (!this.state.enabled)
6265
6105
  return;
6266
- const userAction = options.userAction !== undefined ? options.userAction : true;
6267
- this.updateState({ visible: false }, userAction);
6268
- this._hide({ userAction });
6106
+ wrapper.appendChild(this.container);
6107
+ this.render();
6108
+ return this;
6269
6109
  }
6110
+ /** 启用插件 */
6270
6111
  enable(options = {}) {
6271
6112
  if (this.state.enabled)
6272
6113
  return;
@@ -6274,6 +6115,7 @@
6274
6115
  this.updateState({ enabled: true }, options.userAction || userAction);
6275
6116
  this._enable({ userAction });
6276
6117
  }
6118
+ /** 禁用插件 */
6277
6119
  disable(options = {}) {
6278
6120
  if (!this.state.enabled)
6279
6121
  return;
@@ -6287,56 +6129,29 @@
6287
6129
  const userAction = options.userAction !== undefined ? options.userAction : true;
6288
6130
  this.updateState(state, userAction);
6289
6131
  if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
6290
- const options = { userAction };
6291
- state.enabled ? this._enable(options) : this._disable(options);
6132
+ state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
6292
6133
  }
6293
6134
  if (state.visible !== undefined && prevState.visible !== state.visible) {
6294
6135
  const options = { userAction };
6295
6136
  state.visible ? this._show(options) : this._hide(options);
6296
6137
  }
6297
6138
  }
6298
- /** 把插件的渲染DOM插入到对应的容器中去 */
6299
- appendTo(wrapper) {
6300
- this.wrapper = wrapper;
6301
- this.render();
6302
- }
6303
- changeConfigs(config, userAction = true) {
6304
- this.setState({ config }, { userAction });
6305
- this.render();
6306
- }
6307
- setExtraObjectsWith3DPositions(data) {
6308
- if (!this.data)
6139
+ /** 更新户型图位置 */
6140
+ updatePosition() {
6141
+ var _a;
6142
+ const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
6143
+ const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE__namespace.Vector3()).setY(y);
6144
+ if (!modelPosition)
6309
6145
  return;
6310
- this.extraObjects = formatExtraObjects(data, this.five, this.data);
6311
- this.render();
6146
+ const ndcPosition = modelPosition.clone().project(this.five.camera);
6147
+ const left = (ndcPosition.x + 1) / 2;
6148
+ const top = -(ndcPosition.y - 1) / 2;
6149
+ this.container.style.left = left * 100 + '%';
6150
+ this.container.style.top = top * 100 + '%';
6312
6151
  }
6313
6152
  async formatData(serverData) {
6314
6153
  return await formatData(serverData.data);
6315
6154
  }
6316
- _enable(options) {
6317
- const { userAction } = options;
6318
- this.hooks.emit('enable', { userAction });
6319
- if (this.state.visible)
6320
- this._show({ userAction });
6321
- }
6322
- _show(options) {
6323
- if (this.disposed)
6324
- return;
6325
- if (!this.state.enabled)
6326
- return;
6327
- const { userAction } = options;
6328
- this.hooks.emit('show', { userAction });
6329
- this.render();
6330
- }
6331
- _hide(options) {
6332
- if (this.disposed)
6333
- return;
6334
- if (!this.state.enabled)
6335
- return;
6336
- const { userAction } = options;
6337
- this.hooks.emit('hide', { userAction });
6338
- this.render();
6339
- }
6340
6155
  updateState(state, userAction) {
6341
6156
  const prevState = this.state;
6342
6157
  this.state = Object.assign(Object.assign({}, this.state), state);
@@ -6344,142 +6159,76 @@
6344
6159
  return;
6345
6160
  this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
6346
6161
  }
6347
- render() {
6348
- if (this.disposed)
6349
- return;
6162
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
6163
+ *
6164
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
6165
+ */
6166
+ initContainer() {
6167
+ this.container.classList.add('floorplan-plugin');
6168
+ Object.assign(this.container.style, {
6169
+ position: 'absolute',
6170
+ left: '50%',
6171
+ top: '50%',
6172
+ transform: 'translate(-50%, -50%)',
6173
+ zIndex: 10,
6174
+ pointerEvents: 'none',
6175
+ });
6176
+ this.five.addExtraElement(this.container);
6177
+ }
6178
+ addEventListener() {
6350
6179
  if (!this.state.enabled)
6351
6180
  return;
6352
- // 处理 wrapper
6353
- if (!this.wrapper && this.wrapperSelector) {
6354
- const _wrapper = document.querySelector(this.wrapperSelector);
6355
- this.wrapper = _wrapper;
6356
- }
6357
- if (!this.data || !this.wrapper)
6181
+ if (this.hasAddedEventListener)
6358
6182
  return;
6359
- const props = Object.assign(Object.assign({}, this.state.config), { five: this.five, floorplanData: this.data, visible: this.state.visible, extraObjects: this.extraObjects });
6360
- this.app ? this.app.$set(props) : (this.app = new Main({ target: this.wrapper, props }));
6361
- }
6362
- }
6363
-
6364
- const PanoFloorplanRadarPlugin = (five, params) => {
6365
- return new Controller$2(five, params);
6366
- };
6367
-
6368
- /**
6369
- * 传入一个 Promise
6370
- * 无异常,返回 [null, data]
6371
- * 有异常,则返回 [Error, undefined]
6372
- * 用于替代 try&catch 处理 await 异常的方案
6373
- */
6374
- async function to(promise) {
6375
- try {
6376
- const data = await promise;
6377
- return [null, data];
6183
+ const five = this.five;
6184
+ five.on('modeChange', this.onFiveModeChange);
6185
+ five.on('panoArrived', this.onFivePanoArrived);
6186
+ five.on('cameraUpdate', this.onFiveCameraUpdate);
6187
+ five.on('wantsPanGesture', this.onFiveWantsPanGesture);
6188
+ five.on('wantsTapGesture', this.onFiveWantsTapGesture);
6189
+ five.on('wantsChangeMode', this.onFiveWantsChangeMode);
6190
+ five.on('modelShownFloorChange', this.onModelShownFloorChange);
6378
6191
  }
6379
- catch (error) {
6380
- if (error instanceof Error)
6381
- return [error, null];
6382
- return [new Error(''), null];
6192
+ removeEventListener() {
6193
+ const five = this.five;
6194
+ this.hasAddedEventListener = false;
6195
+ // 注意这里并没有消除 dispose 的监听
6196
+ five.off('modelLoaded', this.onFiveModelLoaded);
6197
+ five.off('modeChange', this.onFiveModeChange);
6198
+ five.off('panoArrived', this.onFivePanoArrived);
6199
+ five.off('cameraUpdate', this.onFiveCameraUpdate);
6200
+ five.off('wantsPanGesture', this.onFiveWantsPanGesture);
6201
+ five.off('wantsTapGesture', this.onFiveWantsTapGesture);
6202
+ five.off('wantsChangeMode', this.onFiveWantsChangeMode);
6203
+ five.off('modelShownFloorChange', this.onModelShownFloorChange);
6383
6204
  }
6384
- }
6385
-
6386
- var FloorplanErrorType;
6387
- (function (FloorplanErrorType) {
6388
- /** 意料之外的错误 */
6389
- FloorplanErrorType["UnknownError"] = "UnknownError";
6390
- /** 数据未加载 */
6391
- FloorplanErrorType["DataNotLoaded"] = "DataNotLoaded";
6392
- /** 展示过程被隐藏打断 */
6393
- FloorplanErrorType["BreakOffByHide"] = "BreakOffByHide";
6394
- /** 展示过程中插件被禁用 */
6395
- FloorplanErrorType["BreakOffByDisable"] = "BreakOffByDisable";
6396
- /** 模型未加载完成 */
6397
- FloorplanErrorType["ModelNotLoaded"] = "ModelNotLoaded";
6398
- /** Five changeMode 行为不符合预期 */
6399
- FloorplanErrorType["ChangeModeError"] = "ChangeModeError";
6400
- /** Five updateCamera 行为不符合预期 */
6401
- FloorplanErrorType["UpdateCameraError"] = "UpdateCameraError";
6402
- })(FloorplanErrorType || (FloorplanErrorType = {}));
6403
- /** 户型图展示 & 模型消失的默认时间 */
6404
- const SHOW_ANIME_DURATION = 500;
6405
- /** Five camera 默认 fov */
6406
- const FIVE_CAMERA_DEFAULT_FOV = 80;
6407
-
6408
- /** 判断当前状态是否可以展示户型图 */
6409
- function checkShowState(five, showState) {
6410
- if (five.currentMode !== showState.mode)
6411
- return false;
6412
- const { latitude, longitude, fov } = showState;
6413
- const { latitude: _latitude, longitude: _longitude } = five.getCurrentState();
6414
- const _fov = five.camera.fov;
6415
- if (!nearlyEqual(latitude, _latitude, 2))
6416
- return false;
6417
- if (!nearlyEqual(longitude, _longitude, 2))
6418
- return false;
6419
- if (fov !== _fov)
6420
- return false;
6421
- return true;
6422
- }
6423
- /** 更改 Five 状态到展示户型图的状态
6424
- * 1. 判断状态不符合时,会纠正到正确的状态
6425
- * 2. 内置了相应的动画时间计算
6426
- * 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
6427
- */
6428
- async function correctFiveState(five, showState, userAction = true) {
6429
- // 当前已满足状态,不需要变更
6430
- const result = checkShowState(five, showState);
6431
- if (result === true)
6432
- return;
6433
- const currentFiveState = five.getCurrentState();
6434
- // 纠正 mode
6435
- if (currentFiveState.mode !== showState.mode) {
6436
- const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
6437
- if (changeModeError)
6438
- throw new Error(FloorplanErrorType.ChangeModeError);
6439
- return;
6205
+ render(duration) {
6206
+ if (!this.state.enabled)
6207
+ return;
6208
+ if (!this.container || !this.data)
6209
+ return;
6210
+ if (this.size.width === 0)
6211
+ return;
6212
+ 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 });
6213
+ if (this.app)
6214
+ return this.app.$set(props);
6215
+ this.app = new Main$1({ target: this.container, intro: true, props });
6440
6216
  }
6441
- // 纠正相机状态
6442
- // 根据 latitude、longitude、fov 计算动画时间,最多 1s
6443
- const { latitude, longitude, fov } = currentFiveState;
6444
- 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));
6445
- const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
6446
- if (updateCameraError)
6447
- throw new Error(FloorplanErrorType.UpdateCameraError);
6448
- return;
6449
6217
  }
6450
6218
 
6451
- /** 当前 five 的相机视角是否满足户型图自动隐藏条件
6452
- *
6453
- * @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
6454
- *
6455
- */
6456
- function shouldFloorplanHideWithPose(pose) {
6457
- const { latitude, longitude } = pose;
6458
- const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
6459
- const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
6460
- return latitudeHide || longitudeHide;
6461
- }
6462
- /** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
6463
- *
6464
- * @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
6465
- *
6466
- */
6467
- function shouldFloorplanShowWithPose(pose) {
6468
- const { latitude, longitude } = pose;
6469
- const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
6470
- const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
6471
- return latitudeVisible && longitudeVisible;
6472
- }
6473
- class Controller$1 extends Controller$4 {
6219
+ const MapviewFloorplanPlugin = (five, params) => {
6220
+ return new Controller$3(five, params);
6221
+ };
6222
+
6223
+ class Controller$2 extends Controller$5 {
6474
6224
  constructor(five, params) {
6475
- var _a;
6476
6225
  super(five);
6477
6226
  // =============== public properties =================
6478
6227
  Object.defineProperty(this, "name", {
6479
6228
  enumerable: true,
6480
6229
  configurable: true,
6481
6230
  writable: true,
6482
- value: 'modelFloorplanPlugin'
6231
+ value: 'topviewFloorplanPlugin'
6483
6232
  });
6484
6233
  Object.defineProperty(this, "state", {
6485
6234
  enumerable: true,
@@ -6494,26 +6243,18 @@
6494
6243
  writable: true,
6495
6244
  value: void 0
6496
6245
  });
6497
- /** 展示户型图时,需要正确的状态 */
6498
- Object.defineProperty(this, "showState", {
6246
+ Object.defineProperty(this, "app", {
6499
6247
  enumerable: true,
6500
6248
  configurable: true,
6501
6249
  writable: true,
6502
- value: void 0
6250
+ value: undefined
6503
6251
  });
6504
- /** show 动画的公共 Promise */
6505
- Object.defineProperty(this, "showPromise", {
6252
+ Object.defineProperty(this, "selector", {
6506
6253
  enumerable: true,
6507
6254
  configurable: true,
6508
6255
  writable: true,
6509
6256
  value: void 0
6510
6257
  });
6511
- Object.defineProperty(this, "app", {
6512
- enumerable: true,
6513
- configurable: true,
6514
- writable: true,
6515
- value: undefined
6516
- });
6517
6258
  Object.defineProperty(this, "panoIndex", {
6518
6259
  enumerable: true,
6519
6260
  configurable: true,
@@ -6526,19 +6267,6 @@
6526
6267
  writable: true,
6527
6268
  value: 0
6528
6269
  });
6529
- Object.defineProperty(this, "selector", {
6530
- enumerable: true,
6531
- configurable: true,
6532
- writable: true,
6533
- value: void 0
6534
- });
6535
- /** 公共 Promise 的 reject 方法 */
6536
- Object.defineProperty(this, "showRejection", {
6537
- enumerable: true,
6538
- configurable: true,
6539
- writable: true,
6540
- value: void 0
6541
- });
6542
6270
  /** 户型图父容器 */
6543
6271
  Object.defineProperty(this, "wrapper", {
6544
6272
  enumerable: true,
@@ -6581,65 +6309,6 @@
6581
6309
  writable: true,
6582
6310
  value: false
6583
6311
  });
6584
- /** 销毁插件 */
6585
- Object.defineProperty(this, "dispose", {
6586
- enumerable: true,
6587
- configurable: true,
6588
- writable: true,
6589
- value: () => {
6590
- var _a, _b;
6591
- this.removeEventListener();
6592
- (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6593
- this.app = undefined;
6594
- (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
6595
- this.data = undefined;
6596
- this.wrapper = undefined;
6597
- this.selector = undefined;
6598
- this.hooks.emit('dispose');
6599
- }
6600
- });
6601
- /** 展示户型图
6602
- * 1. show 函数大部分情况下需要耗时
6603
- * 2. 如果当前已经在展示中,将不会触发任何事件
6604
- * 3. 如果展示过程被中断,将抛出错误
6605
- * 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
6606
- * 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
6607
- * @param opts.floorIndex 楼层
6608
- * @param opts.modelOpacity 模型透明度
6609
- * @param opts.immediately 是否立即展示
6610
- * @param opts.isAutoShow 是否是自动展示
6611
- * @param opts.userAction 是否是用户行为
6612
- */
6613
- Object.defineProperty(this, "show", {
6614
- enumerable: true,
6615
- configurable: true,
6616
- writable: true,
6617
- value: async (options = {}) => {
6618
- if (!this.state.enabled)
6619
- return;
6620
- // 已经展示完成了,不做任何操作
6621
- if (!this.showPromise && this.state.visible)
6622
- return;
6623
- const userAction = options.userAction !== undefined ? options.userAction : true;
6624
- this.updateState({ visible: true }, userAction);
6625
- this._show(options);
6626
- }
6627
- });
6628
- /** 隐藏户型图 */
6629
- Object.defineProperty(this, "hide", {
6630
- enumerable: true,
6631
- configurable: true,
6632
- writable: true,
6633
- value: async (options = {}) => {
6634
- if (!this.state.enabled)
6635
- return;
6636
- this.isHiddenByHideFunc = true;
6637
- if (this.state.visible === false)
6638
- return;
6639
- this.updateState({ visible: false }, options.userAction || true);
6640
- this._hide(options);
6641
- }
6642
- });
6643
6312
  /** 更新户型图大小 */
6644
6313
  Object.defineProperty(this, "updateSize", {
6645
6314
  enumerable: true,
@@ -6648,10 +6317,10 @@
6648
6317
  value: () => {
6649
6318
  if (!this.data)
6650
6319
  return;
6651
- if (!checkShowState(this.five, this.showState))
6652
- return;
6653
6320
  if (!this.container || !this.wrapper)
6654
6321
  return;
6322
+ if (this.five.getCurrentState().mode !== 'Topview')
6323
+ return;
6655
6324
  // 计算户型图展示大小
6656
6325
  const { min, max } = this.data.bounding;
6657
6326
  const width = max.x - min.x;
@@ -6668,349 +6337,1362 @@
6668
6337
  this.size = { width: _width, height: _height };
6669
6338
  }
6670
6339
  });
6340
+ /** 销毁插件 */
6341
+ Object.defineProperty(this, "dispose", {
6342
+ enumerable: true,
6343
+ configurable: true,
6344
+ writable: true,
6345
+ value: () => {
6346
+ var _a, _b;
6347
+ this.removeEventListener();
6348
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6349
+ this.app = undefined;
6350
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
6351
+ this.data = undefined;
6352
+ this.wrapper = undefined;
6353
+ this.selector = undefined;
6354
+ this.hooks.emit('dispose');
6355
+ }
6356
+ });
6671
6357
  Object.defineProperty(this, "_disable", {
6672
6358
  enumerable: true,
6673
6359
  configurable: true,
6674
6360
  writable: true,
6675
6361
  value: (options) => {
6676
- var _a, _b, _c;
6362
+ var _a, _b;
6677
6363
  const { userAction } = options;
6678
- this.hooks.emit('disable', { userAction });
6679
- // ===== 处理展示过程中 disable =====
6680
- (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
6681
- this.showPromise = undefined;
6682
- (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
6364
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
6683
6365
  this.app = undefined;
6684
- (_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
6366
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
6685
6367
  this.removeEventListener();
6368
+ this.hooks.emit('disable', { userAction });
6686
6369
  }
6687
6370
  });
6688
- Object.defineProperty(this, "_enable", {
6371
+ /** modelLoaded 之后自动执行 append container 操作 */
6372
+ Object.defineProperty(this, "onFiveModelLoaded", {
6689
6373
  enumerable: true,
6690
6374
  configurable: true,
6691
6375
  writable: true,
6692
- value: (options) => {
6693
- const { userAction } = options;
6694
- this.addEventListener();
6695
- if (!this.wrapper)
6376
+ value: () => {
6377
+ if (this.state.enabled === false)
6696
6378
  return;
6697
- this.wrapper.append(this.container);
6698
- this.hooks.emit('enable', { userAction });
6699
- if (this.state.visible)
6700
- this._show({ userAction });
6379
+ if (this.wrapper)
6380
+ return;
6381
+ if (!this.selector)
6382
+ return;
6383
+ const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
6384
+ if (!wrapper)
6385
+ throw new Error('不正确的父容器选择器');
6386
+ this.wrapper = wrapper;
6387
+ wrapper.append(this.container);
6701
6388
  }
6702
6389
  });
6703
- Object.defineProperty(this, "_show", {
6390
+ /** Topview 态隐藏户型图 */
6391
+ Object.defineProperty(this, "onFiveModeChange", {
6704
6392
  enumerable: true,
6705
6393
  configurable: true,
6706
6394
  writable: true,
6707
- value: async (options) => {
6708
- var _a;
6709
- if (!this.state.enabled)
6710
- return;
6711
- if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
6712
- throw new Error(FloorplanErrorType.ModelNotLoaded);
6713
- if (!this.data)
6714
- throw new Error(FloorplanErrorType.DataNotLoaded);
6715
- this.isHiddenByHideFunc = false;
6716
- // ===== 参数合并 =====
6717
- const baseShowOpts = {
6718
- floorIndex: this.floorIndex,
6719
- modelOpacity: this.state.config.modelOpacity,
6720
- immediately: false,
6721
- isAutoShow: false,
6722
- userAction: true,
6723
- };
6724
- const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
6725
- const getShowPromise = async () => {
6726
- this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
6727
- let hasRejected = false;
6728
- let externalErrorMsg;
6729
- this.showRejection = (errorMsg) => {
6730
- hasRejected = true;
6731
- externalErrorMsg = errorMsg;
6732
- };
6733
- const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
6734
- if (correctError)
6735
- throw correctError;
6736
- // 异步结束要判断当前是不是被中断了
6737
- if (hasRejected)
6738
- throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
6739
- // 更新户型图大小
6740
- this.updateSize();
6741
- // 高亮当前楼层,有两个目的
6742
- // 1. 点击模型时,可以跳转到当前楼层的点位上
6743
- // 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
6744
- this.floorIndex = mergedOptions.floorIndex;
6745
- this.five.model.show(this.floorIndex);
6746
- // 模型消失, 渲染户型图
6747
- const modelOpacity = mergedOptions.modelOpacity;
6748
- const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
6749
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6750
- this.render(renderDuration);
6751
- };
6752
- this.showPromise = getShowPromise()
6753
- .then(() => {
6754
- this.hooks.emit('showAnimationEnded', {
6755
- auto: mergedOptions.isAutoShow,
6756
- userAction: mergedOptions.userAction,
6757
- });
6758
- })
6759
- .catch((error) => {
6760
- this.updateState({ visible: false }, mergedOptions.userAction);
6761
- // 自动展示的报错内部处理
6762
- if (mergedOptions.isAutoShow)
6763
- return;
6764
- // 非自动展示的报错继续向外抛出
6765
- if (error instanceof Error)
6766
- throw error;
6767
- })
6768
- .finally(() => {
6769
- this.showPromise = undefined;
6770
- this.showRejection = undefined;
6771
- });
6772
- return this.showPromise;
6395
+ value: (...[mode, , , , userAction]) => {
6396
+ if (mode !== 'Topview' && this.state.visible) {
6397
+ this.updateState({ visible: false }, userAction);
6398
+ this._hide({ userAction });
6399
+ }
6773
6400
  }
6774
6401
  });
6775
- Object.defineProperty(this, "_hide", {
6402
+ Object.defineProperty(this, "onFivePanoArrived", {
6776
6403
  enumerable: true,
6777
6404
  configurable: true,
6778
6405
  writable: true,
6779
- value: (options) => {
6406
+ value: (index) => {
6780
6407
  var _a;
6781
- // ===== 处理展示过程中 hide =====
6782
- (_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
6783
- this.showPromise = undefined;
6784
- // ===== 合并参数 =====
6785
- const baseOptions = {
6786
- userAction: true,
6787
- isAutoHide: false,
6788
- };
6789
- const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
6790
- changeModelCanvasOpacity(this.five, 1, 0);
6791
- this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
6792
- this.render();
6408
+ if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
6409
+ return;
6410
+ this.panoIndex = index;
6411
+ this.floorIndex = this.five.work.observers[index].floorIndex;
6793
6412
  }
6794
6413
  });
6795
- Object.defineProperty(this, "handleClick", {
6414
+ Object.defineProperty(this, "onFiveCameraUpdate", {
6796
6415
  enumerable: true,
6797
6416
  configurable: true,
6798
6417
  writable: true,
6799
- value: () => {
6418
+ value: (_, userAction) => {
6800
6419
  if (!this.state.visible)
6801
6420
  return;
6802
- const preventDefault = this.hooks.emit('click');
6803
- if (preventDefault)
6421
+ this.updatePosition();
6422
+ this.updateSize();
6423
+ }
6424
+ });
6425
+ Object.defineProperty(this, "onFiveWantsGesture", {
6426
+ enumerable: true,
6427
+ configurable: true,
6428
+ writable: true,
6429
+ value: (type) => {
6430
+ if (type !== 'pan' && type !== 'pinch' && type !== 'mouseWheel')
6431
+ return;
6432
+ if (this.state.visible && !this.state.config.gestureEnable)
6433
+ return false;
6434
+ }
6435
+ });
6436
+ Object.defineProperty(this, "onFiveWantsMoveToPano", {
6437
+ enumerable: true,
6438
+ configurable: true,
6439
+ writable: true,
6440
+ value: () => {
6441
+ if (this.state.visible && this.state.config.preventRoomClick)
6804
6442
  return false;
6805
6443
  }
6806
6444
  });
6807
- /** modelLoaded 之后自动执行 append container 操作 */
6808
- Object.defineProperty(this, "onFiveModelLoaded", {
6445
+ /** 动画结束后是 Topview 态就展示户型图 */
6446
+ Object.defineProperty(this, "onFiveInitAnimationEnded", {
6447
+ enumerable: true,
6448
+ configurable: true,
6449
+ writable: true,
6450
+ value: (...[, , userAction]) => {
6451
+ const { mode } = this.five.getCurrentState();
6452
+ if (mode === 'Topview' && !this.isHiddenByHideFunc && !this.state.visible && this.state.config.autoShowEnable) {
6453
+ this.updateState({ visible: true }, userAction);
6454
+ this._show({ userAction });
6455
+ }
6456
+ }
6457
+ });
6458
+ Object.defineProperty(this, "onModelShownFloorChange", {
6459
+ enumerable: true,
6460
+ configurable: true,
6461
+ writable: true,
6462
+ value: (shownFloor) => {
6463
+ if (this.floorIndex === shownFloor)
6464
+ return;
6465
+ if (shownFloor === null) {
6466
+ const panoIndex = this.five.getCurrentState().panoIndex;
6467
+ this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
6468
+ return;
6469
+ }
6470
+ // 模型楼层高亮改变时,自动进行楼层切换
6471
+ this.floorIndex = shownFloor;
6472
+ this.updateSize();
6473
+ this.render();
6474
+ }
6475
+ });
6476
+ if (params === null || params === void 0 ? void 0 : params.selector) {
6477
+ this.selector = params.selector;
6478
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6479
+ }
6480
+ // =============== init State ===============
6481
+ const baseConfig = {
6482
+ northDesc: '北',
6483
+ modelOpacity: 1,
6484
+ hoverEnable: true,
6485
+ compassEnable: true,
6486
+ gestureEnable: false,
6487
+ autoShowEnable: true,
6488
+ ruleLabelsEnable: true,
6489
+ roomLabelsEnable: true,
6490
+ cameraImageUrl: CAMERA_IMAGE,
6491
+ attachedTo: exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
6492
+ getLabelElement: undefined,
6493
+ adaptiveRoomLabelVisibleEnable: true,
6494
+ };
6495
+ const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
6496
+ const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
6497
+ this.state = {
6498
+ enabled: true,
6499
+ visible: false,
6500
+ config,
6501
+ };
6502
+ // =============== init Container ===============
6503
+ this.initContainer();
6504
+ // =============== init Listener ===============
6505
+ // 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
6506
+ // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
6507
+ five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
6508
+ five.once('dispose', this.dispose);
6509
+ this.addEventListener();
6510
+ }
6511
+ async load(serverData, state, userAction = true) {
6512
+ function isPluginServerData(serverData) {
6513
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6514
+ }
6515
+ const _data = serverData;
6516
+ if (_data && !_data.version)
6517
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
6518
+ const copyData = JSON.parse(JSON.stringify(serverData));
6519
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6520
+ const prevData = this.data;
6521
+ this.data = await formatData(_serverData);
6522
+ this.hooks.emit('dataLoaded', this.data);
6523
+ this.hooks.emit('dataChange', this.data, prevData);
6524
+ if (state)
6525
+ this.updateState(state, userAction);
6526
+ this.render();
6527
+ }
6528
+ /** 更新户型图位置 */
6529
+ updatePosition() {
6530
+ var _a;
6531
+ const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
6532
+ const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE__namespace.Vector3()).setY(y);
6533
+ if (!modelPosition)
6534
+ return;
6535
+ const ndcPosition = modelPosition.clone().project(this.five.camera);
6536
+ const left = (ndcPosition.x + 1) / 2;
6537
+ const top = -(ndcPosition.y - 1) / 2;
6538
+ this.container.style.left = left * 100 + '%';
6539
+ this.container.style.top = top * 100 + '%';
6540
+ }
6541
+ /** 把插件的渲染DOM插入到对应的容器中去 */
6542
+ appendTo(wrapper) {
6543
+ this.wrapper = wrapper;
6544
+ // 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
6545
+ if (!this.state.enabled)
6546
+ return;
6547
+ wrapper.appendChild(this.container);
6548
+ this.render();
6549
+ return this;
6550
+ }
6551
+ async show(options = {}) {
6552
+ // 已经展示完成了,不做任何操作
6553
+ if (this.state.visible)
6554
+ return;
6555
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6556
+ this.updateState({ visible: true }, userAction);
6557
+ this._show({ userAction });
6558
+ }
6559
+ async hide(options = {}) {
6560
+ this.isHiddenByHideFunc = true;
6561
+ if (!this.state.visible)
6562
+ return;
6563
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6564
+ this.updateState({ visible: false }, userAction);
6565
+ this._hide({ userAction });
6566
+ }
6567
+ enable(options = {}) {
6568
+ if (this.state.enabled)
6569
+ return;
6570
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6571
+ this.updateState({ enabled: true }, options.userAction || userAction);
6572
+ this._enable({ userAction });
6573
+ }
6574
+ disable(options = {}) {
6575
+ if (!this.state.enabled)
6576
+ return;
6577
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6578
+ this.updateState({ enabled: false }, options.userAction || userAction);
6579
+ this._disable({ userAction });
6580
+ }
6581
+ /** 更改插件 State */
6582
+ setState(state, options = {}) {
6583
+ const prevState = this.state;
6584
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6585
+ this.updateState(state, userAction);
6586
+ if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
6587
+ const options = { userAction };
6588
+ state.enabled ? this._enable(options) : this._disable(options);
6589
+ }
6590
+ if (state.visible !== undefined && prevState.visible !== state.visible) {
6591
+ const options = { userAction };
6592
+ state.visible ? this._show(options) : this._hide(options);
6593
+ }
6594
+ }
6595
+ async formatData(serverData) {
6596
+ return await formatData(serverData.data);
6597
+ }
6598
+ async _show(options) {
6599
+ if (!this.state.enabled)
6600
+ return;
6601
+ this.isHiddenByHideFunc = false;
6602
+ const { userAction } = options;
6603
+ this.hooks.emit('show', { userAction });
6604
+ if (this.five.getCurrentState().mode !== 'Topview') {
6605
+ await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
6606
+ }
6607
+ this.five.model.show(this.floorIndex);
6608
+ this.updatePosition();
6609
+ this.updateSize();
6610
+ const renderDuration = 500;
6611
+ const modelOpacity = this.state.config.modelOpacity;
6612
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6613
+ this.hooks.emit('showAnimationEnded', { userAction });
6614
+ this.render();
6615
+ }
6616
+ async _hide(options) {
6617
+ if (!this.state.enabled)
6618
+ return;
6619
+ const { userAction } = options;
6620
+ this.hooks.emit('hide', { userAction });
6621
+ const modelOpacity = 1;
6622
+ const renderDuration = 0;
6623
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6624
+ this.render();
6625
+ }
6626
+ _enable(options) {
6627
+ const { userAction } = options;
6628
+ this.addEventListener();
6629
+ if (this.wrapper)
6630
+ this.wrapper.append(this.container);
6631
+ this.hooks.emit('enable', { userAction });
6632
+ if (this.state.visible)
6633
+ this._show({ userAction });
6634
+ }
6635
+ updateState(state, userAction) {
6636
+ const prevState = this.state;
6637
+ this.state = Object.assign(Object.assign({}, this.state), state);
6638
+ if (equal(this.state, prevState, { deep: true }))
6639
+ return;
6640
+ this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
6641
+ }
6642
+ addEventListener() {
6643
+ if (!this.state.enabled)
6644
+ return;
6645
+ if (this.hasAddedEventListener)
6646
+ return;
6647
+ const five = this.five;
6648
+ five.on('modeChange', this.onFiveModeChange);
6649
+ five.on('panoArrived', this.onFivePanoArrived);
6650
+ five.on('cameraUpdate', this.onFiveCameraUpdate);
6651
+ five.on('wantsGesture', this.onFiveWantsGesture);
6652
+ five.on('wantsMoveToPano', this.onFiveWantsMoveToPano);
6653
+ five.on('initAnimationEnded', this.onFiveInitAnimationEnded);
6654
+ five.on('modelShownFloorChange', this.onModelShownFloorChange);
6655
+ }
6656
+ removeEventListener() {
6657
+ const five = this.five;
6658
+ this.hasAddedEventListener = false;
6659
+ // 注意这里并没有消除 dispose 的监听
6660
+ five.off('modeChange', this.onFiveModeChange);
6661
+ five.off('panoArrived', this.onFivePanoArrived);
6662
+ five.off('cameraUpdate', this.onFiveCameraUpdate);
6663
+ five.off('wantsGesture', this.onFiveWantsGesture);
6664
+ five.off('wantsMoveToPano', this.onFiveWantsMoveToPano);
6665
+ five.off('initAnimationEnded', this.onFiveInitAnimationEnded);
6666
+ five.off('modelShownFloorChange', this.onModelShownFloorChange);
6667
+ }
6668
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
6669
+ *
6670
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
6671
+ */
6672
+ initContainer() {
6673
+ this.container.classList.add('floorplan-plugin');
6674
+ Object.assign(this.container.style, {
6675
+ position: 'absolute',
6676
+ left: '50%',
6677
+ top: '50%',
6678
+ transform: 'translate3d(-50%, -50%, 10px)',
6679
+ zIndex: 10,
6680
+ pointerEvents: 'none',
6681
+ 'will-change': 'width, height',
6682
+ });
6683
+ this.five.addExtraElement(this.container);
6684
+ }
6685
+ render(duration) {
6686
+ if (!this.state.enabled)
6687
+ return;
6688
+ if (!this.container || !this.data)
6689
+ return;
6690
+ if (this.size.width === 0)
6691
+ return;
6692
+ 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 });
6693
+ if (this.app)
6694
+ return this.app.$set(props);
6695
+ this.app = new Main$1({ target: this.container, intro: true, props });
6696
+ }
6697
+ }
6698
+
6699
+ const TopviewFloorplanPlugin = (five, params) => {
6700
+ return new Controller$2(five, params);
6701
+ };
6702
+
6703
+ /**
6704
+ * 创建一个防抖动函数,该函数在高频调用时会每隔 wait 毫秒后调用 func 方法
6705
+ * `throttle` 会在第一次调用时立刻调用一次
6706
+ * @param func - 要防抖动的函数
6707
+ * @param wait - 需要延迟的毫秒数
6708
+ */
6709
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6710
+ function throttle(func, wait = 200) {
6711
+ let last;
6712
+ return function (...args) {
6713
+ if (last)
6714
+ return;
6715
+ func(...args);
6716
+ last = setTimeout(function () {
6717
+ last = null;
6718
+ }, wait);
6719
+ };
6720
+ }
6721
+
6722
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte generated by Svelte v3.49.0 */
6723
+
6724
+ function add_css$a(target) {
6725
+ 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%}");
6726
+ }
6727
+
6728
+ function create_fragment$c(ctx) {
6729
+ let div2;
6730
+ let div1;
6731
+ let div0;
6732
+
6733
+ return {
6734
+ c() {
6735
+ div2 = internal.element("div");
6736
+ div1 = internal.element("div");
6737
+ div0 = internal.element("div");
6738
+ internal.attr(div0, "class", "plugin-radar__camera-rotate svelte-1ty3s4p");
6739
+ internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
6740
+ internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
6741
+ internal.attr(div1, "class", "plugin-radar__camera-position svelte-1ty3s4p");
6742
+ internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
6743
+ internal.attr(div2, "class", "plugin-radar__camera-wrapper svelte-1ty3s4p");
6744
+ },
6745
+ m(target, anchor) {
6746
+ internal.insert(target, div2, anchor);
6747
+ internal.append(div2, div1);
6748
+ internal.append(div1, div0);
6749
+ },
6750
+ p(ctx, [dirty]) {
6751
+ if (dirty & /*cameraImageUrl*/ 1) {
6752
+ internal.set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
6753
+ }
6754
+
6755
+ if (dirty & /*rotateTransform*/ 2) {
6756
+ internal.set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
6757
+ }
6758
+
6759
+ if (dirty & /*positionTransform*/ 4) {
6760
+ internal.set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
6761
+ }
6762
+ },
6763
+ i: internal.noop,
6764
+ o: internal.noop,
6765
+ d(detaching) {
6766
+ if (detaching) internal.detach(div2);
6767
+ }
6768
+ };
6769
+ }
6770
+
6771
+ function getCameraRotateTransform(longitude) {
6772
+ // 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
6773
+ const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
6774
+
6775
+ return `rotate(${rotate}deg)`;
6776
+ }
6777
+
6778
+ function instance$c($$self, $$props, $$invalidate) {
6779
+ let positionTransform;
6780
+ let rotateTransform;
6781
+ let { five } = $$props;
6782
+ let { pxmm } = $$props;
6783
+ let { floorplanData } = $$props;
6784
+ let { cameraImageUrl } = $$props;
6785
+ let panoIndex = five.getCurrentState().panoIndex;
6786
+ let longitude = five.getCurrentState().longitude;
6787
+
6788
+ /** 获取相机在当前 Five 状态下的位移 */
6789
+ function getCameraPositionTransform(floorplanData, panoIndex) {
6790
+ const bounding = floorplanData.bounding;
6791
+ const floorplanObserver = floorplanData.observers[panoIndex];
6792
+ if (!floorplanObserver) return '';
6793
+ const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
6794
+ const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
6795
+ const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
6796
+ const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
6797
+ return `translate(${left}px, ${top}px)`;
6798
+ }
6799
+
6800
+ function onFivePanoWillArrive(_panoIndex) {
6801
+ $$invalidate(6, panoIndex = _panoIndex);
6802
+ }
6803
+
6804
+ const onFiveCameraDirectionUpdate = throttle(
6805
+ pose => {
6806
+ $$invalidate(7, longitude = pose.longitude);
6807
+ },
6808
+ 1000 / 60
6809
+ );
6810
+
6811
+ svelte.onMount(() => {
6812
+ five.on('panoWillArrive', onFivePanoWillArrive);
6813
+ five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
6814
+
6815
+ return function dispose() {
6816
+ five.off('panoWillArrive', onFivePanoWillArrive);
6817
+ five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
6818
+ };
6819
+ });
6820
+
6821
+ $$self.$$set = $$props => {
6822
+ if ('five' in $$props) $$invalidate(3, five = $$props.five);
6823
+ if ('pxmm' in $$props) $$invalidate(4, pxmm = $$props.pxmm);
6824
+ if ('floorplanData' in $$props) $$invalidate(5, floorplanData = $$props.floorplanData);
6825
+ if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
6826
+ };
6827
+
6828
+ $$self.$$.update = () => {
6829
+ if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
6830
+ // 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
6831
+ $$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
6832
+ }
6833
+
6834
+ if ($$self.$$.dirty & /*longitude*/ 128) {
6835
+ $$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
6836
+ }
6837
+ };
6838
+
6839
+ return [
6840
+ cameraImageUrl,
6841
+ rotateTransform,
6842
+ positionTransform,
6843
+ five,
6844
+ pxmm,
6845
+ floorplanData,
6846
+ panoIndex,
6847
+ longitude
6848
+ ];
6849
+ }
6850
+
6851
+ class Camera extends internal.SvelteComponent {
6852
+ constructor(options) {
6853
+ super();
6854
+
6855
+ internal.init(
6856
+ this,
6857
+ options,
6858
+ instance$c,
6859
+ create_fragment$c,
6860
+ internal.safe_not_equal,
6861
+ {
6862
+ five: 3,
6863
+ pxmm: 4,
6864
+ floorplanData: 5,
6865
+ cameraImageUrl: 0
6866
+ },
6867
+ add_css$a
6868
+ );
6869
+ }
6870
+ }
6871
+
6872
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte generated by Svelte v3.49.0 */
6873
+
6874
+ function add_css$9(target) {
6875
+ 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%)}");
6876
+ }
6877
+
6878
+ function get_each_context$5(ctx, list, i) {
6879
+ const child_ctx = ctx.slice();
6880
+ child_ctx[1] = list[i];
6881
+ return child_ctx;
6882
+ }
6883
+
6884
+ // (5:2) {#each extraObjects as extraObject (extraObject.id)}
6885
+ function create_each_block$5(key_1, ctx) {
6886
+ let div1;
6887
+ let div0;
6888
+ let style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`;
6889
+ let style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`;
6890
+ let t;
6891
+ let style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`;
6892
+ let style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`;
6893
+
6894
+ return {
6895
+ key: key_1,
6896
+ first: null,
6897
+ c() {
6898
+ div1 = internal.element("div");
6899
+ div0 = internal.element("div");
6900
+ t = internal.space();
6901
+ internal.attr(div0, "class", "plugin-pano-floorplan__extra-object-item svelte-1i87fz7");
6902
+ internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
6903
+ internal.set_style(div0, "width", style_width, false);
6904
+ internal.set_style(div0, "height", style_height, false);
6905
+ internal.attr(div1, "class", "plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7");
6906
+ internal.set_style(div1, "top", style_top, false);
6907
+ internal.set_style(div1, "left", style_left, false);
6908
+ this.first = div1;
6909
+ },
6910
+ m(target, anchor) {
6911
+ internal.insert(target, div1, anchor);
6912
+ internal.append(div1, div0);
6913
+ internal.append(div1, t);
6914
+ },
6915
+ p(new_ctx, dirty) {
6916
+ ctx = new_ctx;
6917
+
6918
+ if (dirty & /*extraObjects*/ 1) {
6919
+ internal.set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
6920
+ }
6921
+
6922
+ if (dirty & /*extraObjects*/ 1 && style_width !== (style_width = `${/*extraObject*/ ctx[1].icon.width / 16}rem`)) {
6923
+ internal.set_style(div0, "width", style_width, false);
6924
+ }
6925
+
6926
+ if (dirty & /*extraObjects*/ 1 && style_height !== (style_height = `${/*extraObject*/ ctx[1].icon.height / 16}rem`)) {
6927
+ internal.set_style(div0, "height", style_height, false);
6928
+ }
6929
+
6930
+ if (dirty & /*extraObjects*/ 1 && style_top !== (style_top = `${/*extraObject*/ ctx[1].positionInImage.y * 100}%`)) {
6931
+ internal.set_style(div1, "top", style_top, false);
6932
+ }
6933
+
6934
+ if (dirty & /*extraObjects*/ 1 && style_left !== (style_left = `${/*extraObject*/ ctx[1].positionInImage.x * 100}%`)) {
6935
+ internal.set_style(div1, "left", style_left, false);
6936
+ }
6937
+ },
6938
+ d(detaching) {
6939
+ if (detaching) internal.detach(div1);
6940
+ }
6941
+ };
6942
+ }
6943
+
6944
+ function create_fragment$b(ctx) {
6945
+ let div;
6946
+ let each_blocks = [];
6947
+ let each_1_lookup = new Map();
6948
+ let each_value = /*extraObjects*/ ctx[0];
6949
+ const get_key = ctx => /*extraObject*/ ctx[1].id;
6950
+
6951
+ for (let i = 0; i < each_value.length; i += 1) {
6952
+ let child_ctx = get_each_context$5(ctx, each_value, i);
6953
+ let key = get_key(child_ctx);
6954
+ each_1_lookup.set(key, each_blocks[i] = create_each_block$5(key, child_ctx));
6955
+ }
6956
+
6957
+ return {
6958
+ c() {
6959
+ div = internal.element("div");
6960
+
6961
+ for (let i = 0; i < each_blocks.length; i += 1) {
6962
+ each_blocks[i].c();
6963
+ }
6964
+
6965
+ internal.attr(div, "class", "plugin-pano-floorplan__extra-objects svelte-1i87fz7");
6966
+ },
6967
+ m(target, anchor) {
6968
+ internal.insert(target, div, anchor);
6969
+
6970
+ for (let i = 0; i < each_blocks.length; i += 1) {
6971
+ each_blocks[i].m(div, null);
6972
+ }
6973
+ },
6974
+ p(ctx, [dirty]) {
6975
+ if (dirty & /*extraObjects*/ 1) {
6976
+ each_value = /*extraObjects*/ ctx[0];
6977
+ 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);
6978
+ }
6979
+ },
6980
+ i: internal.noop,
6981
+ o: internal.noop,
6982
+ d(detaching) {
6983
+ if (detaching) internal.detach(div);
6984
+
6985
+ for (let i = 0; i < each_blocks.length; i += 1) {
6986
+ each_blocks[i].d();
6987
+ }
6988
+ }
6989
+ };
6990
+ }
6991
+
6992
+ function instance$b($$self, $$props, $$invalidate) {
6993
+ let { extraObjects = [] } = $$props;
6994
+
6995
+ $$self.$$set = $$props => {
6996
+ if ('extraObjects' in $$props) $$invalidate(0, extraObjects = $$props.extraObjects);
6997
+ };
6998
+
6999
+ return [extraObjects];
7000
+ }
7001
+
7002
+ class ExtraObjects extends internal.SvelteComponent {
7003
+ constructor(options) {
7004
+ super();
7005
+ internal.init(this, options, instance$b, create_fragment$b, internal.safe_not_equal, { extraObjects: 0 }, add_css$9);
7006
+ }
7007
+ }
7008
+
7009
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte generated by Svelte v3.49.0 */
7010
+
7011
+ function create_if_block$4(ctx) {
7012
+ let highlight;
7013
+ let current;
7014
+
7015
+ const highlight_spread_levels = [
7016
+ {
7017
+ five: /*five*/ ctx[0],
7018
+ pxmm: /*pxmm*/ ctx[1],
7019
+ floorIndex: /*floorIndex*/ ctx[2],
7020
+ floorplanData: /*floorplanData*/ ctx[4],
7021
+ onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
7022
+ }
7023
+ ];
7024
+
7025
+ let highlight_props = {};
7026
+
7027
+ for (let i = 0; i < highlight_spread_levels.length; i += 1) {
7028
+ highlight_props = internal.assign(highlight_props, highlight_spread_levels[i]);
7029
+ }
7030
+
7031
+ highlight = new RoomHighlight({ props: highlight_props });
7032
+
7033
+ return {
7034
+ c() {
7035
+ internal.create_component(highlight.$$.fragment);
7036
+ },
7037
+ m(target, anchor) {
7038
+ internal.mount_component(highlight, target, anchor);
7039
+ current = true;
7040
+ },
7041
+ p(ctx, dirty) {
7042
+ const highlight_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, onRoomHeightClick*/ 87)
7043
+ ? internal.get_spread_update(highlight_spread_levels, [
7044
+ {
7045
+ five: /*five*/ ctx[0],
7046
+ pxmm: /*pxmm*/ ctx[1],
7047
+ floorIndex: /*floorIndex*/ ctx[2],
7048
+ floorplanData: /*floorplanData*/ ctx[4],
7049
+ onRoomHeightClick: /*onRoomHeightClick*/ ctx[6]
7050
+ }
7051
+ ])
7052
+ : {};
7053
+
7054
+ highlight.$set(highlight_changes);
7055
+ },
7056
+ i(local) {
7057
+ if (current) return;
7058
+ internal.transition_in(highlight.$$.fragment, local);
7059
+ current = true;
7060
+ },
7061
+ o(local) {
7062
+ internal.transition_out(highlight.$$.fragment, local);
7063
+ current = false;
7064
+ },
7065
+ d(detaching) {
7066
+ internal.destroy_component(highlight, detaching);
7067
+ }
7068
+ };
7069
+ }
7070
+
7071
+ function create_fragment$a(ctx) {
7072
+ let baseimage;
7073
+ let t0;
7074
+ let extraobjects;
7075
+ let t1;
7076
+ let if_block_anchor;
7077
+ let current;
7078
+
7079
+ const baseimage_spread_levels = [
7080
+ {
7081
+ floorIndex: /*floorIndex*/ ctx[2],
7082
+ floorplanData: /*floorplanData*/ ctx[4]
7083
+ }
7084
+ ];
7085
+
7086
+ let baseimage_props = {};
7087
+
7088
+ for (let i = 0; i < baseimage_spread_levels.length; i += 1) {
7089
+ baseimage_props = internal.assign(baseimage_props, baseimage_spread_levels[i]);
7090
+ }
7091
+
7092
+ baseimage = new BaseImage({ props: baseimage_props });
7093
+
7094
+ extraobjects = new ExtraObjects({
7095
+ props: {
7096
+ extraObjects: /*currentFloorExtraObjects*/ ctx[5]
7097
+ }
7098
+ });
7099
+
7100
+ let if_block = /*hoverEnable*/ ctx[3] && create_if_block$4(ctx);
7101
+
7102
+ return {
7103
+ c() {
7104
+ internal.create_component(baseimage.$$.fragment);
7105
+ t0 = internal.space();
7106
+ internal.create_component(extraobjects.$$.fragment);
7107
+ t1 = internal.space();
7108
+ if (if_block) if_block.c();
7109
+ if_block_anchor = internal.empty();
7110
+ },
7111
+ m(target, anchor) {
7112
+ internal.mount_component(baseimage, target, anchor);
7113
+ internal.insert(target, t0, anchor);
7114
+ internal.mount_component(extraobjects, target, anchor);
7115
+ internal.insert(target, t1, anchor);
7116
+ if (if_block) if_block.m(target, anchor);
7117
+ internal.insert(target, if_block_anchor, anchor);
7118
+ current = true;
7119
+ },
7120
+ p(ctx, [dirty]) {
7121
+ const baseimage_changes = (dirty & /*floorIndex, floorplanData*/ 20)
7122
+ ? internal.get_spread_update(baseimage_spread_levels, [
7123
+ {
7124
+ floorIndex: /*floorIndex*/ ctx[2],
7125
+ floorplanData: /*floorplanData*/ ctx[4]
7126
+ }
7127
+ ])
7128
+ : {};
7129
+
7130
+ baseimage.$set(baseimage_changes);
7131
+ const extraobjects_changes = {};
7132
+ if (dirty & /*currentFloorExtraObjects*/ 32) extraobjects_changes.extraObjects = /*currentFloorExtraObjects*/ ctx[5];
7133
+ extraobjects.$set(extraobjects_changes);
7134
+
7135
+ if (/*hoverEnable*/ ctx[3]) {
7136
+ if (if_block) {
7137
+ if_block.p(ctx, dirty);
7138
+
7139
+ if (dirty & /*hoverEnable*/ 8) {
7140
+ internal.transition_in(if_block, 1);
7141
+ }
7142
+ } else {
7143
+ if_block = create_if_block$4(ctx);
7144
+ if_block.c();
7145
+ internal.transition_in(if_block, 1);
7146
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
7147
+ }
7148
+ } else if (if_block) {
7149
+ internal.group_outros();
7150
+
7151
+ internal.transition_out(if_block, 1, 1, () => {
7152
+ if_block = null;
7153
+ });
7154
+
7155
+ internal.check_outros();
7156
+ }
7157
+ },
7158
+ i(local) {
7159
+ if (current) return;
7160
+ internal.transition_in(baseimage.$$.fragment, local);
7161
+ internal.transition_in(extraobjects.$$.fragment, local);
7162
+ internal.transition_in(if_block);
7163
+ current = true;
7164
+ },
7165
+ o(local) {
7166
+ internal.transition_out(baseimage.$$.fragment, local);
7167
+ internal.transition_out(extraobjects.$$.fragment, local);
7168
+ internal.transition_out(if_block);
7169
+ current = false;
7170
+ },
7171
+ d(detaching) {
7172
+ internal.destroy_component(baseimage, detaching);
7173
+ if (detaching) internal.detach(t0);
7174
+ internal.destroy_component(extraobjects, detaching);
7175
+ if (detaching) internal.detach(t1);
7176
+ if (if_block) if_block.d(detaching);
7177
+ if (detaching) internal.detach(if_block_anchor);
7178
+ }
7179
+ };
7180
+ }
7181
+
7182
+ function instance$a($$self, $$props, $$invalidate) {
7183
+ let currentFloorExtraObjects;
7184
+ let { five } = $$props;
7185
+ let { pxmm } = $$props;
7186
+ let { floorIndex } = $$props;
7187
+ let { hoverEnable } = $$props;
7188
+ let { floorplanData } = $$props;
7189
+ let { extraObjects = [] } = $$props;
7190
+ const onRoomHeightClick = undefined;
7191
+
7192
+ $$self.$$set = $$props => {
7193
+ if ('five' in $$props) $$invalidate(0, five = $$props.five);
7194
+ if ('pxmm' in $$props) $$invalidate(1, pxmm = $$props.pxmm);
7195
+ if ('floorIndex' in $$props) $$invalidate(2, floorIndex = $$props.floorIndex);
7196
+ if ('hoverEnable' in $$props) $$invalidate(3, hoverEnable = $$props.hoverEnable);
7197
+ if ('floorplanData' in $$props) $$invalidate(4, floorplanData = $$props.floorplanData);
7198
+ if ('extraObjects' in $$props) $$invalidate(7, extraObjects = $$props.extraObjects);
7199
+ };
7200
+
7201
+ $$self.$$.update = () => {
7202
+ if ($$self.$$.dirty & /*extraObjects, floorIndex*/ 132) {
7203
+ $$invalidate(5, currentFloorExtraObjects = extraObjects === null || extraObjects === void 0
7204
+ ? void 0
7205
+ : extraObjects.filter(object => object.floorIndex === floorIndex));
7206
+ }
7207
+ };
7208
+
7209
+ return [
7210
+ five,
7211
+ pxmm,
7212
+ floorIndex,
7213
+ hoverEnable,
7214
+ floorplanData,
7215
+ currentFloorExtraObjects,
7216
+ onRoomHeightClick,
7217
+ extraObjects
7218
+ ];
7219
+ }
7220
+
7221
+ class CurrentFloor extends internal.SvelteComponent {
7222
+ constructor(options) {
7223
+ super();
7224
+
7225
+ internal.init(this, options, instance$a, create_fragment$a, internal.safe_not_equal, {
7226
+ five: 0,
7227
+ pxmm: 1,
7228
+ floorIndex: 2,
7229
+ hoverEnable: 3,
7230
+ floorplanData: 4,
7231
+ extraObjects: 7
7232
+ });
7233
+ }
7234
+ }
7235
+
7236
+ /* src/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte generated by Svelte v3.49.0 */
7237
+
7238
+ function add_css$8(target) {
7239
+ 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}");
7240
+ }
7241
+
7242
+ // (41:0) {#if visible}
7243
+ function create_if_block$3(ctx) {
7244
+ let div;
7245
+ let div_resize_listener;
7246
+ let current;
7247
+ let if_block = /*clientWidth*/ ctx[6] !== 0 && create_if_block_1$1(ctx);
7248
+
7249
+ return {
7250
+ c() {
7251
+ div = internal.element("div");
7252
+ if (if_block) if_block.c();
7253
+ internal.attr(div, "class", "plugin-floorplan-radar svelte-1mvqyqq");
7254
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
7255
+ },
7256
+ m(target, anchor) {
7257
+ internal.insert(target, div, anchor);
7258
+ if (if_block) if_block.m(div, null);
7259
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
7260
+ current = true;
7261
+ },
7262
+ p(ctx, dirty) {
7263
+ if (/*clientWidth*/ ctx[6] !== 0) {
7264
+ if (if_block) {
7265
+ if_block.p(ctx, dirty);
7266
+
7267
+ if (dirty & /*clientWidth*/ 64) {
7268
+ internal.transition_in(if_block, 1);
7269
+ }
7270
+ } else {
7271
+ if_block = create_if_block_1$1(ctx);
7272
+ if_block.c();
7273
+ internal.transition_in(if_block, 1);
7274
+ if_block.m(div, null);
7275
+ }
7276
+ } else if (if_block) {
7277
+ internal.group_outros();
7278
+
7279
+ internal.transition_out(if_block, 1, 1, () => {
7280
+ if_block = null;
7281
+ });
7282
+
7283
+ internal.check_outros();
7284
+ }
7285
+ },
7286
+ i(local) {
7287
+ if (current) return;
7288
+ internal.transition_in(if_block);
7289
+ current = true;
7290
+ },
7291
+ o(local) {
7292
+ internal.transition_out(if_block);
7293
+ current = false;
7294
+ },
7295
+ d(detaching) {
7296
+ if (detaching) internal.detach(div);
7297
+ if (if_block) if_block.d();
7298
+ div_resize_listener();
7299
+ }
7300
+ };
7301
+ }
7302
+
7303
+ // (43:4) {#if clientWidth !== 0}
7304
+ function create_if_block_1$1(ctx) {
7305
+ let div;
7306
+ let currentfloor;
7307
+ let t;
7308
+ let camera;
7309
+ let style_width = `${/*contentWidth*/ ctx[8]}px`;
7310
+ let style_height = `${/*contentHeight*/ ctx[11]}px`;
7311
+ let current;
7312
+
7313
+ const currentfloor_spread_levels = [
7314
+ {
7315
+ five: /*five*/ ctx[0],
7316
+ pxmm: /*pxmm*/ ctx[9],
7317
+ floorIndex: /*floorIndex*/ ctx[10],
7318
+ floorplanData: /*floorplanData*/ ctx[3],
7319
+ hoverEnable: /*hoverEnable*/ ctx[2],
7320
+ extraObjects: /*extraObjects*/ ctx[5]
7321
+ }
7322
+ ];
7323
+
7324
+ let currentfloor_props = {};
7325
+
7326
+ for (let i = 0; i < currentfloor_spread_levels.length; i += 1) {
7327
+ currentfloor_props = internal.assign(currentfloor_props, currentfloor_spread_levels[i]);
7328
+ }
7329
+
7330
+ currentfloor = new CurrentFloor({ props: currentfloor_props });
7331
+
7332
+ const camera_spread_levels = [
7333
+ {
7334
+ pxmm: /*pxmm*/ ctx[9],
7335
+ five: /*five*/ ctx[0],
7336
+ floorplanData: /*floorplanData*/ ctx[3],
7337
+ cameraImageUrl: /*cameraImageUrl*/ ctx[4]
7338
+ }
7339
+ ];
7340
+
7341
+ let camera_props = {};
7342
+
7343
+ for (let i = 0; i < camera_spread_levels.length; i += 1) {
7344
+ camera_props = internal.assign(camera_props, camera_spread_levels[i]);
7345
+ }
7346
+
7347
+ camera = new Camera({ props: camera_props });
7348
+
7349
+ return {
7350
+ c() {
7351
+ div = internal.element("div");
7352
+ internal.create_component(currentfloor.$$.fragment);
7353
+ t = internal.space();
7354
+ internal.create_component(camera.$$.fragment);
7355
+ internal.attr(div, "class", "plugin-floorplan-radar-container svelte-1mvqyqq");
7356
+ internal.set_style(div, "width", style_width, false);
7357
+ internal.set_style(div, "height", style_height, false);
7358
+ },
7359
+ m(target, anchor) {
7360
+ internal.insert(target, div, anchor);
7361
+ internal.mount_component(currentfloor, div, null);
7362
+ internal.append(div, t);
7363
+ internal.mount_component(camera, div, null);
7364
+ current = true;
7365
+ },
7366
+ p(ctx, dirty) {
7367
+ const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, floorplanData, hoverEnable, extraObjects*/ 1581)
7368
+ ? internal.get_spread_update(currentfloor_spread_levels, [
7369
+ {
7370
+ five: /*five*/ ctx[0],
7371
+ pxmm: /*pxmm*/ ctx[9],
7372
+ floorIndex: /*floorIndex*/ ctx[10],
7373
+ floorplanData: /*floorplanData*/ ctx[3],
7374
+ hoverEnable: /*hoverEnable*/ ctx[2],
7375
+ extraObjects: /*extraObjects*/ ctx[5]
7376
+ }
7377
+ ])
7378
+ : {};
7379
+
7380
+ currentfloor.$set(currentfloor_changes);
7381
+
7382
+ const camera_changes = (dirty & /*pxmm, five, floorplanData, cameraImageUrl*/ 537)
7383
+ ? internal.get_spread_update(camera_spread_levels, [
7384
+ {
7385
+ pxmm: /*pxmm*/ ctx[9],
7386
+ five: /*five*/ ctx[0],
7387
+ floorplanData: /*floorplanData*/ ctx[3],
7388
+ cameraImageUrl: /*cameraImageUrl*/ ctx[4]
7389
+ }
7390
+ ])
7391
+ : {};
7392
+
7393
+ camera.$set(camera_changes);
7394
+
7395
+ if (dirty & /*contentWidth*/ 256 && style_width !== (style_width = `${/*contentWidth*/ ctx[8]}px`)) {
7396
+ internal.set_style(div, "width", style_width, false);
7397
+ }
7398
+
7399
+ if (dirty & /*contentHeight*/ 2048 && style_height !== (style_height = `${/*contentHeight*/ ctx[11]}px`)) {
7400
+ internal.set_style(div, "height", style_height, false);
7401
+ }
7402
+ },
7403
+ i(local) {
7404
+ if (current) return;
7405
+ internal.transition_in(currentfloor.$$.fragment, local);
7406
+ internal.transition_in(camera.$$.fragment, local);
7407
+ current = true;
7408
+ },
7409
+ o(local) {
7410
+ internal.transition_out(currentfloor.$$.fragment, local);
7411
+ internal.transition_out(camera.$$.fragment, local);
7412
+ current = false;
7413
+ },
7414
+ d(detaching) {
7415
+ if (detaching) internal.detach(div);
7416
+ internal.destroy_component(currentfloor);
7417
+ internal.destroy_component(camera);
7418
+ }
7419
+ };
7420
+ }
7421
+
7422
+ function create_fragment$9(ctx) {
7423
+ let if_block_anchor;
7424
+ let current;
7425
+ let if_block = /*visible*/ ctx[1] && create_if_block$3(ctx);
7426
+
7427
+ return {
7428
+ c() {
7429
+ if (if_block) if_block.c();
7430
+ if_block_anchor = internal.empty();
7431
+ },
7432
+ m(target, anchor) {
7433
+ if (if_block) if_block.m(target, anchor);
7434
+ internal.insert(target, if_block_anchor, anchor);
7435
+ current = true;
7436
+ },
7437
+ p(ctx, [dirty]) {
7438
+ if (/*visible*/ ctx[1]) {
7439
+ if (if_block) {
7440
+ if_block.p(ctx, dirty);
7441
+
7442
+ if (dirty & /*visible*/ 2) {
7443
+ internal.transition_in(if_block, 1);
7444
+ }
7445
+ } else {
7446
+ if_block = create_if_block$3(ctx);
7447
+ if_block.c();
7448
+ internal.transition_in(if_block, 1);
7449
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
7450
+ }
7451
+ } else if (if_block) {
7452
+ internal.group_outros();
7453
+
7454
+ internal.transition_out(if_block, 1, 1, () => {
7455
+ if_block = null;
7456
+ });
7457
+
7458
+ internal.check_outros();
7459
+ }
7460
+ },
7461
+ i(local) {
7462
+ if (current) return;
7463
+ internal.transition_in(if_block);
7464
+ current = true;
7465
+ },
7466
+ o(local) {
7467
+ internal.transition_out(if_block);
7468
+ current = false;
7469
+ },
7470
+ d(detaching) {
7471
+ if (if_block) if_block.d(detaching);
7472
+ if (detaching) internal.detach(if_block_anchor);
7473
+ }
7474
+ };
7475
+ }
7476
+
7477
+ function instance$9($$self, $$props, $$invalidate) {
7478
+ let { five } = $$props;
7479
+ let { visible } = $$props;
7480
+ let { hoverEnable } = $$props;
7481
+ let { floorplanData } = $$props;
7482
+ let { cameraImageUrl } = $$props;
7483
+ let { extraObjects = [] } = $$props;
7484
+ let pxmm = 0;
7485
+ let floorIndex = 0;
7486
+ let clientWidth = 0;
7487
+ let clientHeight = 0;
7488
+ let contentWidth = 0;
7489
+ let contentHeight = 0;
7490
+
7491
+ function handlePanoArrived(panoIndex) {
7492
+ $$invalidate(10, floorIndex = five.work.observers[panoIndex].floorIndex);
7493
+ }
7494
+
7495
+ svelte.onMount(() => {
7496
+ five.on('panoArrived', handlePanoArrived);
7497
+
7498
+ return () => {
7499
+ five.off('panoArrived', handlePanoArrived);
7500
+ };
7501
+ });
7502
+
7503
+ function div_elementresize_handler() {
7504
+ clientWidth = this.clientWidth;
7505
+ clientHeight = this.clientHeight;
7506
+ $$invalidate(6, clientWidth);
7507
+ $$invalidate(7, clientHeight);
7508
+ }
7509
+
7510
+ $$self.$$set = $$props => {
7511
+ if ('five' in $$props) $$invalidate(0, five = $$props.five);
7512
+ if ('visible' in $$props) $$invalidate(1, visible = $$props.visible);
7513
+ if ('hoverEnable' in $$props) $$invalidate(2, hoverEnable = $$props.hoverEnable);
7514
+ if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
7515
+ if ('cameraImageUrl' in $$props) $$invalidate(4, cameraImageUrl = $$props.cameraImageUrl);
7516
+ if ('extraObjects' in $$props) $$invalidate(5, extraObjects = $$props.extraObjects);
7517
+ };
7518
+
7519
+ $$self.$$.update = () => {
7520
+ if ($$self.$$.dirty & /*clientWidth, clientHeight, floorplanData, contentWidth*/ 456) {
7521
+ {
7522
+ const size = Math.min(clientWidth, clientHeight);
7523
+ const { max, min } = floorplanData.bounding;
7524
+ const boundingWidth = max.x - min.x;
7525
+ const boundingHeight = max.y - min.y;
7526
+
7527
+ const contentSize = (function getSize() {
7528
+ if (boundingWidth > boundingHeight) return [size, size / boundingWidth * boundingHeight];
7529
+ return [size / boundingHeight * boundingWidth, size];
7530
+ })();
7531
+
7532
+ $$invalidate(8, contentWidth = contentSize[0]);
7533
+ $$invalidate(11, contentHeight = contentSize[1]);
7534
+ $$invalidate(9, pxmm = contentWidth / boundingWidth);
7535
+ }
7536
+ }
7537
+ };
7538
+
7539
+ return [
7540
+ five,
7541
+ visible,
7542
+ hoverEnable,
7543
+ floorplanData,
7544
+ cameraImageUrl,
7545
+ extraObjects,
7546
+ clientWidth,
7547
+ clientHeight,
7548
+ contentWidth,
7549
+ pxmm,
7550
+ floorIndex,
7551
+ contentHeight,
7552
+ div_elementresize_handler
7553
+ ];
7554
+ }
7555
+
7556
+ class Main extends internal.SvelteComponent {
7557
+ constructor(options) {
7558
+ super();
7559
+
7560
+ internal.init(
7561
+ this,
7562
+ options,
7563
+ instance$9,
7564
+ create_fragment$9,
7565
+ internal.safe_not_equal,
7566
+ {
7567
+ five: 0,
7568
+ visible: 1,
7569
+ hoverEnable: 2,
7570
+ floorplanData: 3,
7571
+ cameraImageUrl: 4,
7572
+ extraObjects: 5
7573
+ },
7574
+ add_css$8
7575
+ );
7576
+ }
7577
+ }
7578
+
7579
+ class Controller$1 extends Controller$5 {
7580
+ constructor(five, params) {
7581
+ super(five);
7582
+ // =============== public properties =================
7583
+ Object.defineProperty(this, "name", {
6809
7584
  enumerable: true,
6810
7585
  configurable: true,
6811
7586
  writable: true,
6812
- value: () => {
6813
- if (this.state.enabled === false)
6814
- return;
6815
- if (this.wrapper)
6816
- return;
6817
- if (!this.selector)
6818
- return;
6819
- const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
6820
- if (!wrapper)
6821
- throw new Error('不正确的父容器选择器');
6822
- this.wrapper = wrapper;
6823
- wrapper.append(this.container);
6824
- }
7587
+ value: 'panoFloorplanRadarPlugin'
6825
7588
  });
6826
- /** 更改模型时,自动隐藏户型图 */
6827
- Object.defineProperty(this, "onFiveModeChange", {
7589
+ Object.defineProperty(this, "state", {
6828
7590
  enumerable: true,
6829
7591
  configurable: true,
6830
7592
  writable: true,
6831
- value: (mode) => {
6832
- // 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
6833
- if (mode !== this.showState.mode) {
6834
- this.updateState({ visible: false }, false);
6835
- this._hide({ userAction: false });
6836
- }
6837
- }
7593
+ value: void 0
6838
7594
  });
6839
- /** 惯性结束后,判断能否自动展示户型图 */
6840
- Object.defineProperty(this, "onFiveInteriaPan", {
7595
+ // =============== protected properties =================
7596
+ Object.defineProperty(this, "data", {
6841
7597
  enumerable: true,
6842
7598
  configurable: true,
6843
7599
  writable: true,
6844
- value: (_, isFinal) => {
6845
- if (!isFinal)
6846
- return;
6847
- if (this.state.config.autoShowEnable === false)
6848
- return;
6849
- // 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
6850
- if (this.isHiddenByHideFunc)
6851
- return;
6852
- const fiveCurrentState = this.five.getCurrentState();
6853
- if (fiveCurrentState.mode !== 'Floorplan')
6854
- return;
6855
- if (this.state.visible)
6856
- return;
6857
- if (shouldFloorplanShowWithPose(fiveCurrentState)) {
6858
- this.updateState({ visible: true }, true);
6859
- this._show({ isAutoShow: true });
6860
- }
6861
- }
7600
+ value: void 0
6862
7601
  });
6863
- /** panoIndex 改变时,更新 floorIndex */
6864
- Object.defineProperty(this, "onFivePanoArrived", {
7602
+ // =============== private properties =================
7603
+ Object.defineProperty(this, "app", {
6865
7604
  enumerable: true,
6866
7605
  configurable: true,
6867
7606
  writable: true,
6868
- value: (index) => {
6869
- var _a;
6870
- if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
6871
- return;
6872
- this.panoIndex = index;
6873
- this.floorIndex = this.five.work.observers[index].floorIndex;
6874
- }
7607
+ value: void 0
6875
7608
  });
6876
- /** cameraUpdate 时判断户型图是否应该自动隐藏 */
6877
- Object.defineProperty(this, "onFiveCameraUpdate", {
7609
+ Object.defineProperty(this, "wrapperSelector", {
6878
7610
  enumerable: true,
6879
7611
  configurable: true,
6880
7612
  writable: true,
6881
- value: (_, userAction) => {
6882
- if (!this.state.visible)
6883
- return;
6884
- // 展示过程中不处理自动隐藏逻辑
6885
- if (this.showPromise)
6886
- return;
6887
- const fiveCurrentState = this.five.getCurrentState();
6888
- if (shouldFloorplanHideWithPose(fiveCurrentState)) {
6889
- this.updateState({ visible: false }, userAction);
6890
- this._hide({ userAction, isAutoHide: true });
6891
- }
6892
- }
7613
+ value: ''
6893
7614
  });
6894
- /** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
6895
- Object.defineProperty(this, "onFiveWantsGesture", {
6896
- enumerable: true,
6897
- configurable: true,
6898
- writable: true,
6899
- value: (type, pointers) => {
6900
- if (!this.state.visible)
6901
- return;
6902
- // 阻止多指操作
6903
- if (pointers.length > 1)
6904
- return false;
6905
- // 阻止鼠标滚轮行为
6906
- if (type === 'mouseWheel')
6907
- return false;
6908
- }
7615
+ Object.defineProperty(this, "wrapper", {
7616
+ enumerable: true,
7617
+ configurable: true,
7618
+ writable: true,
7619
+ value: null
6909
7620
  });
6910
- /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
6911
- Object.defineProperty(this, "onFiveWantsPanGesture", {
7621
+ Object.defineProperty(this, "disposed", {
6912
7622
  enumerable: true,
6913
7623
  configurable: true,
6914
7624
  writable: true,
6915
- value: (_, isFinal) => {
6916
- if (this.five.getCurrentState().mode !== 'Floorplan')
6917
- return;
6918
- if (this.state.config.autoShowEnable === false)
6919
- return;
6920
- if (isFinal && this.state.visible) {
6921
- this.five.updateCamera(this.showState, 0);
6922
- // 禁用掉 isFinal 的 panGesture 行为
6923
- // 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
6924
- // 此行为也会禁用 pan 结束后的惯性处理
6925
- return false;
6926
- }
6927
- }
7625
+ value: false
6928
7626
  });
6929
- /** 阻止点击分间走点 */
6930
- Object.defineProperty(this, "onFiveWantsTapGesture", {
7627
+ Object.defineProperty(this, "extraObjects", {
6931
7628
  enumerable: true,
6932
7629
  configurable: true,
6933
7630
  writable: true,
6934
- value: () => this.handleClick()
7631
+ value: []
6935
7632
  });
6936
- /** Panorama 切换到其他模态时,记录当前的相机水平视角 */
6937
- Object.defineProperty(this, "onFiveWantsChangeMode", {
7633
+ Object.defineProperty(this, "dispose", {
6938
7634
  enumerable: true,
6939
7635
  configurable: true,
6940
7636
  writable: true,
6941
- value: (mode, prevMode) => {
6942
- if (prevMode === 'Panorama' && mode === 'Floorplan') {
6943
- this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
6944
- }
6945
- // if (mode !== 'Floorplan') this.hide()
7637
+ value: () => {
7638
+ var _a;
7639
+ this.disposed = true;
7640
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
7641
+ this.wrapper = null;
7642
+ this.wrapperSelector = '';
7643
+ this.hooks.emit('dispose');
6946
7644
  }
6947
7645
  });
6948
- /** 模型楼层高亮改变时,自动进行楼层切换 */
6949
- Object.defineProperty(this, "onModelShownFloorChange", {
7646
+ Object.defineProperty(this, "_disable", {
6950
7647
  enumerable: true,
6951
7648
  configurable: true,
6952
7649
  writable: true,
6953
- value: (shownFloor) => {
6954
- if (this.floorIndex === shownFloor)
6955
- return;
6956
- if (shownFloor === null) {
6957
- const panoIndex = this.five.getCurrentState().panoIndex;
6958
- this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
6959
- return;
6960
- }
6961
- this.floorIndex = shownFloor;
6962
- this.updateSize();
6963
- this.render();
7650
+ value: (options) => {
7651
+ var _a;
7652
+ const { userAction } = options;
7653
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
7654
+ this.app = undefined;
7655
+ this.hooks.emit('disable', { userAction });
6964
7656
  }
6965
7657
  });
6966
- if (params === null || params === void 0 ? void 0 : params.selector) {
6967
- this.selector = params.selector;
6968
- console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
6969
- }
6970
- // =============== init Show State ===============
6971
- this.showState = {
6972
- mode: 'Floorplan',
6973
- longitude: 0,
6974
- latitude: Math.PI / 2,
6975
- fov: FIVE_CAMERA_DEFAULT_FOV / ((_a = params === null || params === void 0 ? void 0 : params.scale) !== null && _a !== void 0 ? _a : 1),
6976
- };
7658
+ this.five = five;
6977
7659
  // =============== init State ===============
6978
7660
  const baseConfig = {
6979
- northDesc: '北',
6980
- modelOpacity: 1,
6981
- hoverEnable: true,
6982
- compassEnable: true,
6983
- autoShowEnable: true,
6984
- ruleLabelsEnable: true,
6985
- roomLabelsEnable: true,
7661
+ hoverEnable: false,
6986
7662
  cameraImageUrl: CAMERA_IMAGE,
6987
- attachedTo: exports.FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
6988
- getLabelElement: undefined,
6989
- adaptiveRoomLabelVisibleEnable: true,
6990
7663
  };
6991
- const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
7664
+ const paramsConfig = (params === null || params === void 0 ? void 0 : params.configs) ? params.configs : {};
6992
7665
  const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
6993
- this.state = {
6994
- enabled: true,
6995
- visible: false,
6996
- config,
6997
- };
6998
- // =============== init Container ===============
6999
- this.initContainer();
7666
+ this.state = { enabled: true, visible: true, config };
7667
+ // =============== init wrapper ===============
7668
+ if (params === null || params === void 0 ? void 0 : params.wrapper)
7669
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
7670
+ if (typeof (params === null || params === void 0 ? void 0 : params.wrapper) === 'string')
7671
+ this.wrapperSelector = params.wrapper;
7672
+ else if ((params === null || params === void 0 ? void 0 : params.wrapper) instanceof Element)
7673
+ this.wrapper = params.wrapper;
7000
7674
  // =============== init Listener ===============
7001
- // 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
7002
- // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
7003
- five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
7004
7675
  five.once('dispose', this.dispose);
7005
- this.addEventListener();
7006
7676
  }
7007
7677
  async load(serverData, state, userAction = true) {
7678
+ // const loadImage = async () => {
7679
+ // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
7680
+ // // 当有 svgString 时,没有加载过程
7681
+ // if (floorplanData.outlines[floorIndex]?.svgContent) return
7682
+ // // 如果当前楼层图片不存在,不存在加载过程
7683
+ // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
7684
+ // if (!nowFloorImageSrc) return
7685
+ // // 图片加载完成时再 render
7686
+ // await new Promise<void>((resolve) => {
7687
+ // const nowFloorImage = new Image()
7688
+ // nowFloorImage.src = nowFloorImageSrc
7689
+ // nowFloorImage.onload = () => resolve()
7690
+ // })
7691
+ // }
7692
+ // await loadImage()
7008
7693
  function isPluginServerData(serverData) {
7009
7694
  return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
7010
7695
  }
7011
- const _data = serverData;
7012
- if (_data && !_data.version)
7013
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
7014
7696
  const copyData = JSON.parse(JSON.stringify(serverData));
7015
7697
  const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
7016
7698
  const prevData = this.data;
@@ -7021,17 +7703,21 @@
7021
7703
  this.updateState(state, userAction);
7022
7704
  this.render();
7023
7705
  }
7024
- /** 把插件的渲染DOM插入到对应的容器中去 */
7025
- appendTo(wrapper) {
7026
- this.wrapper = wrapper;
7027
- // 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
7028
- if (!this.state.enabled)
7706
+ async show(options = {}) {
7707
+ // 已经展示完成了,不做任何操作
7708
+ if (this.state.visible)
7029
7709
  return;
7030
- wrapper.appendChild(this.container);
7031
- this.render();
7032
- return this;
7710
+ const userAction = options.userAction !== undefined ? options.userAction : true;
7711
+ this.updateState({ visible: true }, userAction);
7712
+ this._show({ userAction });
7713
+ }
7714
+ async hide(options = {}) {
7715
+ if (!this.state.visible)
7716
+ return;
7717
+ const userAction = options.userAction !== undefined ? options.userAction : true;
7718
+ this.updateState({ visible: false }, userAction);
7719
+ this._hide({ userAction });
7033
7720
  }
7034
- /** 启用插件 */
7035
7721
  enable(options = {}) {
7036
7722
  if (this.state.enabled)
7037
7723
  return;
@@ -7039,7 +7725,6 @@
7039
7725
  this.updateState({ enabled: true }, options.userAction || userAction);
7040
7726
  this._enable({ userAction });
7041
7727
  }
7042
- /** 禁用插件 */
7043
7728
  disable(options = {}) {
7044
7729
  if (!this.state.enabled)
7045
7730
  return;
@@ -7053,23 +7738,56 @@
7053
7738
  const userAction = options.userAction !== undefined ? options.userAction : true;
7054
7739
  this.updateState(state, userAction);
7055
7740
  if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
7056
- state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
7741
+ const options = { userAction };
7742
+ state.enabled ? this._enable(options) : this._disable(options);
7057
7743
  }
7058
7744
  if (state.visible !== undefined && prevState.visible !== state.visible) {
7059
7745
  const options = { userAction };
7060
7746
  state.visible ? this._show(options) : this._hide(options);
7061
7747
  }
7062
7748
  }
7063
- changeConfigs(_config, userAction = true) {
7064
- const config = Object.assign(Object.assign({}, this.state.config), _config);
7065
- this.updateState({ config }, userAction);
7066
- if (!this.container)
7749
+ /** 把插件的渲染DOM插入到对应的容器中去 */
7750
+ appendTo(wrapper) {
7751
+ this.wrapper = wrapper;
7752
+ this.render();
7753
+ }
7754
+ changeConfigs(config, userAction = true) {
7755
+ this.setState({ config }, { userAction });
7756
+ this.render();
7757
+ }
7758
+ setExtraObjectsWith3DPositions(data) {
7759
+ if (!this.data)
7067
7760
  return;
7761
+ this.extraObjects = formatExtraObjects(data, this.five, this.data);
7068
7762
  this.render();
7069
7763
  }
7070
7764
  async formatData(serverData) {
7071
7765
  return await formatData(serverData.data);
7072
7766
  }
7767
+ _enable(options) {
7768
+ const { userAction } = options;
7769
+ this.hooks.emit('enable', { userAction });
7770
+ if (this.state.visible)
7771
+ this._show({ userAction });
7772
+ }
7773
+ _show(options) {
7774
+ if (this.disposed)
7775
+ return;
7776
+ if (!this.state.enabled)
7777
+ return;
7778
+ const { userAction } = options;
7779
+ this.hooks.emit('show', { userAction });
7780
+ this.render();
7781
+ }
7782
+ _hide(options) {
7783
+ if (this.disposed)
7784
+ return;
7785
+ if (!this.state.enabled)
7786
+ return;
7787
+ const { userAction } = options;
7788
+ this.hooks.emit('hide', { userAction });
7789
+ this.render();
7790
+ }
7073
7791
  updateState(state, userAction) {
7074
7792
  const prevState = this.state;
7075
7793
  this.state = Object.assign(Object.assign({}, this.state), state);
@@ -7077,68 +7795,24 @@
7077
7795
  return;
7078
7796
  this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
7079
7797
  }
7080
- /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
7081
- *
7082
- * - TODO: 等 selector 功能下掉之后删除这个逻辑
7083
- */
7084
- initContainer() {
7085
- this.container.classList.add('floorplan-plugin');
7086
- Object.assign(this.container.style, {
7087
- position: 'absolute',
7088
- left: '50%',
7089
- top: '50%',
7090
- transform: 'translate(-50%, -50%)',
7091
- zIndex: 10,
7092
- pointerEvents: 'none',
7093
- });
7094
- this.five.addExtraElement(this.container);
7095
- }
7096
- addEventListener() {
7097
- if (!this.state.enabled)
7098
- return;
7099
- if (this.hasAddedEventListener)
7798
+ render() {
7799
+ if (this.disposed)
7100
7800
  return;
7101
- const five = this.five;
7102
- five.on('modeChange', this.onFiveModeChange);
7103
- five.on('interiaPan', this.onFiveInteriaPan);
7104
- five.on('panoArrived', this.onFivePanoArrived);
7105
- five.on('cameraUpdate', this.onFiveCameraUpdate);
7106
- five.on('wantsGesture', this.onFiveWantsGesture);
7107
- five.on('wantsPanGesture', this.onFiveWantsPanGesture);
7108
- five.on('wantsTapGesture', this.onFiveWantsTapGesture);
7109
- five.on('wantsChangeMode', this.onFiveWantsChangeMode);
7110
- five.on('modelShownFloorChange', this.onModelShownFloorChange);
7111
- }
7112
- removeEventListener() {
7113
- const five = this.five;
7114
- this.hasAddedEventListener = false;
7115
- // 注意这里并没有消除 dispose 的监听
7116
- five.off('modelLoaded', this.onFiveModelLoaded);
7117
- five.off('modeChange', this.onFiveModeChange);
7118
- five.off('interiaPan', this.onFiveInteriaPan);
7119
- five.off('panoArrived', this.onFivePanoArrived);
7120
- five.off('cameraUpdate', this.onFiveCameraUpdate);
7121
- five.off('wantsGesture', this.onFiveWantsGesture);
7122
- five.off('wantsPanGesture', this.onFiveWantsPanGesture);
7123
- five.off('wantsTapGesture', this.onFiveWantsTapGesture);
7124
- five.off('wantsChangeMode', this.onFiveWantsChangeMode);
7125
- five.off('modelShownFloorChange', this.onModelShownFloorChange);
7126
- }
7127
- render(duration) {
7128
7801
  if (!this.state.enabled)
7129
7802
  return;
7130
- if (!this.container || !this.data)
7131
- return;
7132
- if (this.size.width === 0)
7803
+ // 处理 wrapper
7804
+ if (!this.wrapper && this.wrapperSelector) {
7805
+ const _wrapper = document.querySelector(this.wrapperSelector);
7806
+ this.wrapper = _wrapper;
7807
+ }
7808
+ if (!this.data || !this.wrapper)
7133
7809
  return;
7134
- 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 });
7135
- if (this.app)
7136
- return this.app.$set(props);
7137
- this.app = new Main$1({ target: this.container, intro: true, props });
7810
+ const props = Object.assign(Object.assign({}, this.state.config), { five: this.five, floorplanData: this.data, visible: this.state.visible, extraObjects: this.extraObjects });
7811
+ this.app ? this.app.$set(props) : (this.app = new Main({ target: this.wrapper, props }));
7138
7812
  }
7139
7813
  }
7140
7814
 
7141
- const ModelFloorplanPlugin = (five, params) => {
7815
+ const PanoFloorplanRadarPlugin = (five, params) => {
7142
7816
  return new Controller$1(five, params);
7143
7817
  };
7144
7818
 
@@ -9245,7 +9919,7 @@
9245
9919
  }
9246
9920
 
9247
9921
  const defaultBaseOptions$1 = { userAction: true };
9248
- class PanoCompassController extends Controller$4 {
9922
+ class PanoCompassController extends Controller$5 {
9249
9923
  constructor(five$1, config) {
9250
9924
  super(five$1);
9251
9925
  /**
@@ -15654,10 +16328,10 @@ void main() {
15654
16328
  five.on('wantsTapGesture', (raycaster) => {
15655
16329
  if (!state.enabled)
15656
16330
  return;
15657
- const targetMesh = five.scene.children.find(item => /^ModelTVVideoPlugin/.test(item.name));
16331
+ const targetMesh = five.scene.children.filter(item => /^ModelTVVideoPlugin/.test(item.name));
15658
16332
  if (!targetMesh)
15659
16333
  return;
15660
- const intersectObjects = raycaster.intersectObjects([targetMesh]);
16334
+ const intersectObjects = raycaster.intersectObjects(targetMesh);
15661
16335
  if (intersectObjects.length === 0)
15662
16336
  return;
15663
16337
  if (state.videoTexture)
@@ -16697,7 +17371,7 @@ void main() {
16697
17371
  * pano plugin controller 基类
16698
17372
  * @author kyleju
16699
17373
  */
16700
- class BasePanoPluginController extends Controller$5 {
17374
+ class BasePanoPluginController extends Controller$6 {
16701
17375
  constructor(five) {
16702
17376
  super(five);
16703
17377
  Object.defineProperty(this, "state", {
@@ -17000,7 +17674,7 @@ void main() {
17000
17674
  enumerable: true,
17001
17675
  configurable: true,
17002
17676
  writable: true,
17003
- value: 2.3
17677
+ value: 1.8
17004
17678
  });
17005
17679
  Object.defineProperty(this, "MaxVisibledistance", {
17006
17680
  enumerable: true,
@@ -17064,7 +17738,12 @@ void main() {
17064
17738
  enumerable: true,
17065
17739
  configurable: true,
17066
17740
  writable: true,
17067
- value: (floorplanServerData) => {
17741
+ value: (floorplanServerData, doorLabelConfig) => {
17742
+ if (doorLabelConfig) {
17743
+ this.MaxVisibledistance = doorLabelConfig.MaxVisibledistance;
17744
+ this.MinVisibledistance = doorLabelConfig.MinVisibledistance;
17745
+ this.OffsetHeight = doorLabelConfig.OffsetHeight;
17746
+ }
17068
17747
  if (this.doorLabelItems && this.doorLabelItems.length > 0) {
17069
17748
  this.doorLabelItems.forEach((doorItem) => {
17070
17749
  doorItem.$destroy();
@@ -17423,7 +18102,7 @@ void main() {
17423
18102
  return new PanoDoorLabelPluginController(five);
17424
18103
  };
17425
18104
 
17426
- const DnalogelVersion = '2.0.0-alpha.43';
18105
+ const DnalogelVersion = '2.0.0-alpha.49';
17427
18106
 
17428
18107
  exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
17429
18108
  exports.CameraMovementPlugin = CameraMovementPlugin;
@@ -17431,6 +18110,7 @@ void main() {
17431
18110
  exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
17432
18111
  exports.ItemLabelPlugin = Plugin;
17433
18112
  exports.Magnifier = Magnifier;
18113
+ exports.MapviewFloorplanPlugin = MapviewFloorplanPlugin;
17434
18114
  exports.ModelChassisCompassPlugin = ModelChassisCompassPlugin;
17435
18115
  exports.ModelEntryDoorGuidePlugin = ModelEntryDoorGuidePlugin;
17436
18116
  exports.ModelFloorplanPlugin = ModelFloorplanPlugin;