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