@realsee/dnalogel 2.0.0-alpha.35-beta → 2.0.0-alpha.36

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 (194) hide show
  1. package/dist/ItemLabelPlugin/index.js +21 -41
  2. package/dist/ModelItemLabelPlugin/index.js +16 -36
  3. package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
  4. package/dist/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
  5. package/dist/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
  6. package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  7. package/dist/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
  8. package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
  9. package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
  10. package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
  11. package/dist/PanoMeasurePlugin/index.js +298 -331
  12. package/dist/PanoMeasurePlugin/typings/data.d.ts +5 -0
  13. package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
  14. package/dist/PanoSpatialTagPlugin/Plugin.d.ts +2 -0
  15. package/dist/PanoSpatialTagPlugin/index.js +44 -45
  16. package/dist/base/BasePlugin.d.ts +100 -0
  17. package/dist/base/BasePluginWithData.d.ts +34 -0
  18. package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
  19. package/dist/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
  20. package/dist/floorplan/ModelFloorplanPlugin/index.js +1059 -569
  21. package/dist/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
  22. package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
  23. package/dist/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
  24. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +489 -129
  25. package/dist/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
  26. package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
  27. package/dist/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
  28. package/dist/floorplan/TopviewFloorplanPlugin/index.js +1031 -443
  29. package/dist/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
  30. package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/constant.d.ts +10 -3
  31. package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/correctFiveState.d.ts +2 -1
  32. package/dist/index.es.js +2259 -1487
  33. package/dist/index.js +2266 -1494
  34. package/dist/index.umd.js +2294 -1522
  35. package/dist/shared-utils/five/changeMode.d.ts +4 -1
  36. package/dist/shared-utils/getPxmm.d.ts +8 -0
  37. package/docs/assets/search.js +1 -1
  38. package/docs/classes/Magnifier.html +4 -4
  39. package/docs/classes/ModelRoomLabelController.html +4 -4
  40. package/docs/enums/CameraMovementEffect.html +2 -2
  41. package/docs/enums/DIRECTION.html +1 -1
  42. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  43. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  44. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  45. package/docs/enums/Rotation.html +2 -2
  46. package/docs/index.html +2 -2
  47. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  48. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  49. package/docs/interfaces/FloorplanBounding.html +4 -4
  50. package/docs/interfaces/FloorplanData.html +2 -2
  51. package/docs/interfaces/FloorplanEntrance.html +7 -7
  52. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  53. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  54. package/docs/interfaces/FloorplanFloorData.html +2 -2
  55. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  56. package/docs/interfaces/FloorplanObserver.html +2 -2
  57. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  58. package/docs/interfaces/FloorplanPosition.html +2 -2
  59. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  60. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  61. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  62. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  63. package/docs/interfaces/FloorplanServerData.html +2 -2
  64. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  65. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  66. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  67. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  68. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  69. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  70. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  71. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  72. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  73. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  74. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  75. package/docs/interfaces/LineJson.html +1 -1
  76. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  77. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  78. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  79. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  80. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  81. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  82. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  83. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  84. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  85. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  86. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  87. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  88. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  89. package/docs/interfaces/OpenParameter.html +2 -2
  90. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  91. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  92. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  93. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  94. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  95. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  96. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  97. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  98. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  99. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  100. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  101. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  102. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  103. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  104. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  105. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  106. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  107. package/docs/interfaces/Point.html +1 -1
  108. package/docs/interfaces/PointJson.html +1 -1
  109. package/docs/interfaces/Room.html +1 -1
  110. package/docs/interfaces/RoomInfo.html +1 -1
  111. package/docs/interfaces/RoomLabel.html +7 -7
  112. package/docs/interfaces/RoomRules.html +1 -1
  113. package/docs/interfaces/Rooms.html +1 -1
  114. package/docs/modules.html +17 -27
  115. package/libs/ItemLabelPlugin/ItemLabelComponent.js +21 -41
  116. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +16 -36
  117. package/libs/PanoMeasurePlugin/Controller/index.js +4 -2
  118. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
  119. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +1 -1
  120. package/libs/PanoMeasurePlugin/Modules/GuideController.js +2 -2
  121. package/libs/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
  122. package/libs/PanoMeasurePlugin/Modules/UIController/HTML.js +66 -55
  123. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
  124. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +51 -73
  125. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +7 -4
  126. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +10 -12
  127. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  128. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +2 -2
  129. package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
  130. package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.js → mobileMainBtnController.js} +4 -4
  131. package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
  132. package/libs/PanoMeasurePlugin/Modules/UIController/style.js +7 -24
  133. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
  134. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +1 -1
  135. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
  136. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +1 -2
  137. package/libs/PanoMeasurePlugin/typings/data.d.ts +5 -0
  138. package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
  139. package/libs/PanoMeasurePlugin/utils/mouseGroup.js +55 -7
  140. package/libs/PanoSpatialTagPlugin/Components/tag.js +2 -2
  141. package/libs/PanoSpatialTagPlugin/Plugin.d.ts +2 -0
  142. package/libs/PanoSpatialTagPlugin/Plugin.js +42 -43
  143. package/libs/base/BasePlugin.d.ts +100 -0
  144. package/libs/base/BasePlugin.js +31 -0
  145. package/libs/base/BasePluginWithData.d.ts +34 -0
  146. package/libs/base/BasePluginWithData.js +4 -0
  147. package/libs/floorplan/Components/Compass.js +11 -11
  148. package/libs/floorplan/Components/CurrentFloor.js +24 -11
  149. package/libs/floorplan/Components/Main.js +21 -15
  150. package/libs/floorplan/Components/RoomHighlight/Room.js +44 -5
  151. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +29 -12
  152. package/libs/floorplan/Components/RoomLabels/RoomLabel.js +164 -15
  153. package/libs/floorplan/Components/RoomLabels/RoomLabels.js +68 -24
  154. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.js +1 -0
  155. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.js +11 -9
  156. package/libs/floorplan/Components/RuleLabels/RuleItem.js +2 -2
  157. package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
  158. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +434 -274
  159. package/libs/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
  160. package/libs/floorplan/ModelFloorplanPlugin/index.js +2 -2
  161. package/libs/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
  162. package/libs/floorplan/ModelFloorplanPlugin/{typings/events.type.js → typing.js} +0 -0
  163. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +5 -5
  164. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +114 -53
  165. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
  166. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +162 -52
  167. package/libs/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
  168. package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +2 -2
  169. package/libs/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
  170. package/libs/floorplan/PanoFloorplanRadarPlugin/typing.js +1 -0
  171. package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
  172. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +320 -174
  173. package/libs/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
  174. package/libs/floorplan/TopviewFloorplanPlugin/index.js +2 -2
  175. package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -1
  176. package/libs/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
  177. package/libs/floorplan/TopviewFloorplanPlugin/typing.js +1 -0
  178. package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/constant.d.ts +10 -3
  179. package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/constant.js +9 -2
  180. package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/correctFiveState.d.ts +2 -1
  181. package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/correctFiveState.js +16 -16
  182. package/libs/shared-utils/five/changeMode.d.ts +4 -1
  183. package/libs/shared-utils/five/changeMode.js +34 -13
  184. package/libs/shared-utils/getPxmm.d.ts +8 -0
  185. package/libs/shared-utils/getPxmm.js +25 -20
  186. package/package.json +2 -2
  187. package/dist/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
  188. package/docs/classes/PanoFloorplanRadarPluginController.html +0 -3
  189. package/docs/enums/ModelFloorplanErrorType.html +0 -1
  190. package/docs/interfaces/ModelFloorplanParameterType.html +0 -1
  191. package/docs/interfaces/ModelFloorplanViewEvent.html +0 -5
  192. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +0 -1
  193. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +0 -19
  194. package/libs/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
@@ -29,4 +29,9 @@ export interface PluginData {
29
29
  /** 开放可配置参数 */
30
30
  export interface OpenParameter {
31
31
  isMobile?: boolean;
32
+ crossHairParameter?: CrossHairParameter;
33
+ }
34
+ export interface CrossHairParameter {
35
+ useNormalVector?: boolean;
36
+ ballColor?: number;
32
37
  }
@@ -1,2 +1,7 @@
1
1
  import { Group } from 'three';
2
- export declare function getMouseGroup(): Group;
2
+ export interface MouseGroupParameter {
3
+ isMobile?: boolean;
4
+ useNormalVector?: boolean;
5
+ ballColor?: number;
6
+ }
7
+ export declare function getMouseGroup(params: MouseGroupParameter): Group;
@@ -15,6 +15,8 @@ export interface PanoSpatialTagPluginParameterType {
15
15
  minRad?: number;
16
16
  nearTolerance?: number;
17
17
  upsideHeight?: number;
18
+ minDistance?: number;
19
+ maxDistance?: number;
18
20
  }
19
21
  export interface PanoSpatialTagPluginExportType {
20
22
  load: (data: PanoSpatialTagPluginData) => void;
@@ -423,7 +423,7 @@ function create_fragment(ctx) {
423
423
  div3 = internal.element("div");
424
424
  div2 = internal.element("div");
425
425
  internal.attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
426
- internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
426
+ internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
427
427
  internal.attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
428
428
  internal.set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
429
429
  internal.attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
@@ -463,7 +463,7 @@ function create_fragment(ctx) {
463
463
  },
464
464
  p(ctx, [dirty]) {
465
465
  if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
466
- internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
466
+ internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
467
467
  }
468
468
 
469
469
  if (dirty & /*lineWidthZoom*/ 16) {
@@ -885,22 +885,22 @@ class Template {
885
885
  }
886
886
 
887
887
  const MESH_SIZE = 0.001;
888
- const RAY_ORIGIN_Y = 1.4;
889
888
  const RAY_TOLERANT_DISTANCE = 0.01;
890
889
  const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
891
- const MIN_DISTANCE = 1.2;
892
- const MAX_DISTANCE = 3.5;
893
890
  /**
894
891
  * 空间游走标签插件
895
892
  */
896
893
  const PanoSpatialTagPlugin = (five$1, params) => {
897
- var _a, _b, _c, _d, _e, _f;
894
+ var _a, _b, _c, _d, _e, _f, _g, _h;
898
895
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
896
+ let centerY = 1.4;
899
897
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
900
898
  const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
901
899
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
902
900
  const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
903
901
  const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
902
+ const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
903
+ const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
904
904
  // const foldPercent = params?.foldPercent ?? 20
905
905
  const css3DRender = CSS3DRenderPlugin(five$1);
906
906
  const container = document.createElement('div');
@@ -954,8 +954,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
954
954
  projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
955
955
  frustum.setFromProjectionMatrix(projScreenMatrix);
956
956
  state.tags.forEach(tag => {
957
- const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(tag.position);
958
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
957
+ const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
958
+ if (distance < minDistance || distance > maxDistance)
959
959
  return tag.destroying = true;
960
960
  if (!frustum.containsPoint(tag.position))
961
961
  return tag.destroying = true;
@@ -967,16 +967,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
967
967
  state.tags.forEach(tag => {
968
968
  if (tag.destroying) {
969
969
  tag.app.$set({
970
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
971
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
970
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
971
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
972
972
  destroying: tag.destroying,
973
973
  });
974
974
  }
975
975
  else {
976
976
  tag.app.$set({
977
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
978
- lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
979
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
977
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
978
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
979
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
980
980
  });
981
981
  }
982
982
  });
@@ -1049,8 +1049,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1049
1049
  const points = state.points.reduce((result, point) => {
1050
1050
  if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
1051
1051
  return result;
1052
- const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(point.position);
1053
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
1052
+ const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
1053
+ if (distance < minDistance || distance > maxDistance)
1054
1054
  return result;
1055
1055
  if (!frustum.containsPoint(point.position))
1056
1056
  return result;
@@ -1110,7 +1110,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1110
1110
  Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
1111
1111
  }))
1112
1112
  continue;
1113
- const raycaster = new THREE__namespace.Raycaster(camera.position.clone().setY(RAY_ORIGIN_Y), point.position.clone().sub(camera.position.clone().setY(RAY_ORIGIN_Y)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
1113
+ const raycaster = new THREE__namespace.Raycaster(camera.position.clone().setY(centerY), point.position.clone().sub(camera.position.clone().setY(centerY)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
1114
1114
  const [intersect] = state.intersectObjects ?
1115
1115
  raycaster.intersectObjects(state.intersectObjects, true) :
1116
1116
  (five$1.model.bvhs.loaded ?
@@ -1135,9 +1135,9 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1135
1135
  props: {
1136
1136
  id,
1137
1137
  content: state.render(state.template, replacement),
1138
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / MAX_DISTANCE),
1139
- lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
1140
- contentZoom: 0.1 + camera.position.distanceTo(position) / MAX_DISTANCE,
1138
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
1139
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
1140
+ contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
1141
1141
  upsideDown: position.y > upsideHeight,
1142
1142
  folded: state.folded,
1143
1143
  events: state.events,
@@ -1248,6 +1248,22 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1248
1248
  tag.app.$set({ folded: true });
1249
1249
  });
1250
1250
  };
1251
+ const onResize = () => {
1252
+ five$1.once('renderFrame', updateOrigins);
1253
+ };
1254
+ const onModelLoaded = () => {
1255
+ if (!wrapper)
1256
+ wrapper = five$1.getElement().parentElement;
1257
+ if (wrapper)
1258
+ wrapper.appendChild(container);
1259
+ state.forbidden = false;
1260
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
1261
+ updateTags();
1262
+ five$1.on('panoWillArrive', onPanoWillArrive);
1263
+ five$1.on('panoArrived', onPanoArrived);
1264
+ five$1.on('modeChange', onModeChange);
1265
+ five$1.on('cameraUpdate', onCameraUpdate);
1266
+ };
1251
1267
  const dispose = () => {
1252
1268
  blurImage = null;
1253
1269
  css3DRender.disposeAll();
@@ -1258,37 +1274,20 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1258
1274
  });
1259
1275
  state.origins = [];
1260
1276
  state.tags = [];
1277
+ five$1.off('modelLoaded', onModelLoaded);
1278
+ five$1.off('renderFrame', updateOrigins);
1261
1279
  five$1.off('panoWillArrive', onPanoWillArrive);
1262
1280
  five$1.off('panoArrived', onPanoArrived);
1263
1281
  five$1.off('modeChange', onModeChange);
1264
1282
  five$1.off('cameraUpdate', onCameraUpdate);
1283
+ five$1.off('dispose', dispose);
1284
+ window.removeEventListener('resize', onResize, false);
1265
1285
  };
1266
- if ((_f = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _f === void 0 ? void 0 : _f.loaded) {
1267
- if (!wrapper)
1268
- wrapper = five$1.getElement().parentElement;
1269
- if (wrapper)
1270
- wrapper.appendChild(container);
1271
- state.forbidden = false;
1272
- updateTags();
1273
- five$1.on('panoWillArrive', onPanoWillArrive);
1274
- five$1.on('panoArrived', onPanoArrived);
1275
- five$1.on('modeChange', onModeChange);
1276
- five$1.on('cameraUpdate', onCameraUpdate);
1277
- }
1278
- else {
1279
- five$1.once('modelLoaded', () => {
1280
- if (!wrapper)
1281
- wrapper = five$1.getElement().parentElement;
1282
- if (wrapper)
1283
- wrapper.appendChild(container);
1284
- state.forbidden = false;
1285
- updateTags();
1286
- five$1.on('panoWillArrive', onPanoWillArrive);
1287
- five$1.on('panoArrived', onPanoArrived);
1288
- five$1.on('modeChange', onModeChange);
1289
- five$1.on('cameraUpdate', onCameraUpdate);
1290
- });
1291
- }
1286
+ window.addEventListener('resize', onResize, false);
1287
+ if ((_h = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _h === void 0 ? void 0 : _h.loaded)
1288
+ onModelLoaded();
1289
+ else
1290
+ five$1.once('modelLoaded', onModelLoaded);
1292
1291
  five$1.on('dispose', dispose);
1293
1292
  return {
1294
1293
  load,
@@ -0,0 +1,100 @@
1
+ import { Five, Subscribe } from '@realsee/five';
2
+ /**
3
+ * 基本属性字段
4
+ */
5
+ interface State {
6
+ /**
7
+ * 插件是否启用
8
+ */
9
+ enabled: boolean;
10
+ /**
11
+ * 插件UI是否展示
12
+ */
13
+ visible?: boolean;
14
+ /**
15
+ * 插件的配置项
16
+ */
17
+ config?: unknown;
18
+ }
19
+ interface BaseOptions {
20
+ /** 是否是用户行为 */
21
+ userAction?: boolean;
22
+ }
23
+ /**
24
+ * 插件基本事件
25
+ */
26
+ declare type EventMap<PluginState> = {
27
+ /**
28
+ * 插件被销毁
29
+ */
30
+ dispose: () => void;
31
+ /**
32
+ * 插件状态变化
33
+ * @param params.state 最新的State
34
+ * @param params.prevState 上一个State
35
+ * @param params.userAction 是否是用户触发
36
+ */
37
+ stateChange: (params: {
38
+ state: PluginState;
39
+ prevState?: PluginState;
40
+ userAction: boolean;
41
+ }) => void;
42
+ };
43
+ /**
44
+ * plugin 的基本控制器
45
+ */
46
+ declare abstract class Controller<PluginState extends State, PluginEventMap extends EventMap<PluginState>> {
47
+ five: Five;
48
+ /**
49
+ * 插件事件钩子
50
+ */
51
+ hooks: Subscribe<PluginEventMap>;
52
+ /**
53
+ * 当前状态
54
+ * @description
55
+ * ```text
56
+ * 可以通过 plugin.state 和 plugin.setState 来获取和设置。
57
+ * 通过 state 设置后,plugin 会通过合适的动画运动来达到设置的效果。
58
+ * 来迎合一些通过数据驱动的场景。
59
+ * ```
60
+ */
61
+ abstract state: PluginState;
62
+ constructor(five: Five);
63
+ /**
64
+ * 获取当前的插件状态,如果当初插件内存在需要通过动画变更的 state 值,则通过此方法可以得到中间状态
65
+ */
66
+ getCurrentState(): PluginState;
67
+ /**
68
+ * 插件自身DOM添加到父容器
69
+ * @param wrapper
70
+ */
71
+ appendTo?(wrapper: Element): void;
72
+ /**
73
+ * 展示UI
74
+ */
75
+ show?(options?: BaseOptions): Promise<void>;
76
+ /**
77
+ * 隐藏UI
78
+ */
79
+ hide?(options?: BaseOptions): Promise<void>;
80
+ /**
81
+ * 启用插件,让插件能够响应交互
82
+ */
83
+ abstract enable(options?: BaseOptions): void;
84
+ /**
85
+ * 禁用插件,让插件停止响应交互
86
+ */
87
+ abstract disable(options?: BaseOptions): void;
88
+ /**
89
+ * 插件进行销毁
90
+ */
91
+ abstract dispose(): void;
92
+ /**
93
+ * 设置state
94
+ * @param state 插件的目标状态
95
+ * @param options 配置项
96
+ */
97
+ abstract setState(state: Partial<PluginState>, options?: BaseOptions): void;
98
+ }
99
+ export type { State, EventMap, BaseOptions };
100
+ export { Controller };
@@ -0,0 +1,34 @@
1
+ import * as BasePlugin from './BasePlugin';
2
+ declare type State = BasePlugin.State;
3
+ interface EventMap<PluginState, PluginData> extends BasePlugin.EventMap<PluginState> {
4
+ /** 数据变更 */
5
+ dataChange: (data: PluginData, prevData?: PluginData) => void;
6
+ /** 数据加载完成 */
7
+ dataLoaded: (data: PluginData) => void;
8
+ }
9
+ /**
10
+ * 插件的基础数据
11
+ */
12
+ interface ServerData {
13
+ /**
14
+ * 数据版本
15
+ */
16
+ version: number;
17
+ /**
18
+ * 数据
19
+ */
20
+ data?: unknown;
21
+ }
22
+ declare abstract class Controller<PluginState extends State, PluginEventMap extends EventMap<PluginState, PluginData>, PluginServerData extends ServerData, PluginData> extends BasePlugin.Controller<PluginState, PluginEventMap> {
23
+ protected abstract data?: PluginData;
24
+ /**
25
+ * 加载插件依赖数据
26
+ * @param serverData 插件数据
27
+ * @param state 插件 State
28
+ */
29
+ abstract load(serverData: PluginServerData, state?: PluginState, userAction?: boolean): Promise<void>;
30
+ /** 把原始数据转化为插件数据 */
31
+ protected abstract formatData?(serverData: PluginServerData): Promise<PluginData>;
32
+ }
33
+ export type { State, EventMap, ServerData };
34
+ export { Controller };
@@ -1,66 +1,45 @@
1
- import type { FLOOR_PLAN_ATTACHED_TO } from '../constant';
2
- import type { FloorplanEventHandlers } from './typings/events.type';
1
+ import type { BaseOptions } from '../../base/BasePlugin';
2
+ import type { Five } from '@realsee/five';
3
+ import type { ShowState } from '../utils/correctFiveState';
3
4
  import type { FloorplanServerData } from '../typings/floorplanServerData';
4
- import type { FloorplanRoomItem } from '../typings/floorplanData';
5
- import { Five, Subscribe } from '@realsee/five';
6
- export interface ModelFloorplanParameterType {
7
- northDesc?: string;
8
- selector?: string | Element;
9
- scale?: number;
10
- modelOpacity?: number;
11
- autoShowEnable?: boolean;
12
- hoverEnable?: boolean;
13
- compassEnable?: boolean;
14
- ruleLabelsEnable?: boolean;
15
- roomLabelsEnable?: boolean;
16
- cameraImageUrl?: string;
17
- attachedTo?: FLOOR_PLAN_ATTACHED_TO;
18
- getLabelElement?: (room: FloorplanRoomItem) => Element | null;
19
- }
20
- export declare type ModelFloorplanPluginsConfigs = Omit<ModelFloorplanParameterType, 'selector' | 'scale'>;
21
- export interface ModelFloorplanPluginsShowOpts {
22
- floorIndex?: number;
23
- isAutoShow?: boolean;
24
- modelOpacity?: number;
25
- immediately?: boolean;
26
- userAction?: boolean;
27
- }
28
- export declare const MODEL_FLOORPLAN_PLUGIN_NAME = "modelFloorplanPlugin";
29
- export default class ModelFloorplanPluginController {
5
+ import type { State, EventMap, ShowOptions, HideOptions, Parameters, PluginData, PluginServerData } from './typing';
6
+ import * as BasePlugin from '../../base/BasePluginWithData';
7
+ export declare class Controller extends BasePlugin.Controller<State, EventMap, PluginServerData, PluginData> {
30
8
  name: string;
31
- /** 用于绑定事件钩子 */
32
- hooks: Subscribe<FloorplanEventHandlers>;
33
- /** 展示状态 */
34
- visible: boolean;
35
- /** 户型图大小 */
36
- size: {
37
- width: number;
38
- height: number;
39
- };
9
+ state: State;
10
+ protected data?: PluginData;
11
+ /** 展示户型图时,需要正确的状态 */
12
+ protected showState: ShowState;
13
+ /** show 动画的公共 Promise */
14
+ protected showPromise?: Promise<void>;
40
15
  private app?;
41
- private pxmm;
42
- private five;
43
16
  private panoIndex;
44
17
  private floorIndex;
45
- private configs;
46
- private lastPanoramaLongitude;
47
18
  private selector?;
48
- private floorplanData?;
19
+ /** 公共 Promise 的 reject 方法 */
20
+ private showRejection?;
21
+ /** 户型图父容器 */
49
22
  private wrapper?;
23
+ /** 户型图主容器 */
50
24
  private container;
51
- private showState;
52
- /** 记录上次 show 的参数,如果不一致,需要 reject 掉正在进行的 showPromise */
53
- private ModelFloorplanPluginsShowOpts?;
54
- private showPromise?;
55
- private showRejection?;
56
- constructor(five: Five, params: ModelFloorplanParameterType);
57
- dispose: () => void;
58
- /** 加载户型图数据 */
59
- load(data: FloorplanServerData): Promise<void>;
25
+ /** 展示户型图图前,Five 的 Panorama Longitude */
26
+ private lastPanoramaLongitude;
27
+ /** 户型图大小 */
28
+ private size;
29
+ /** 是否已经执行过事件监听 */
30
+ private hasAddedEventListener;
31
+ /** 上一次隐藏是否是用户调用了 hide 导致的 */
32
+ private isHiddenByHideFunc;
33
+ constructor(five: Five, params?: Parameters);
34
+ load(serverData: PluginServerData | FloorplanServerData, state?: Partial<State>, userAction?: boolean): Promise<void>;
60
35
  /** 把插件的渲染DOM插入到对应的容器中去 */
61
36
  appendTo(wrapper: Element): this;
62
- /** 更新户型图大小 */
63
- updateSize: () => void;
37
+ /** 启用插件 */
38
+ enable(options?: BaseOptions): void;
39
+ /** 禁用插件 */
40
+ disable(options?: BaseOptions): void;
41
+ /** 销毁插件 */
42
+ dispose: () => void;
64
43
  /** 展示户型图
65
44
  * 1. show 函数大部分情况下需要耗时
66
45
  * 2. 如果当前已经在展示中,将不会触发任何事件
@@ -71,35 +50,48 @@ export default class ModelFloorplanPluginController {
71
50
  * @param opts.modelOpacity 模型透明度
72
51
  * @param opts.immediately 是否立即展示
73
52
  * @param opts.isAutoShow 是否是自动展示
53
+ * @param opts.userAction 是否是用户行为
74
54
  */
75
- show: (opts?: ModelFloorplanPluginsShowOpts) => Promise<boolean>;
55
+ show: (options?: Omit<Partial<ShowOptions>, 'isAutoShow'>) => Promise<void>;
76
56
  /** 隐藏户型图 */
77
- hide: (options?: {
78
- isAutoHide?: boolean;
79
- userAction?: boolean;
80
- }) => boolean;
81
- /** 更改户型图楼层 */
82
- changeFloor(floorIndex: number): void;
83
- changeConfigs(params: ModelFloorplanPluginsConfigs): void;
84
- /** 模型楼层高亮改变时,自动进行楼层切换 */
85
- private onModelShownFloorChange;
86
- private handleModelLoaded;
57
+ hide: (options?: Partial<HideOptions>) => Promise<void>;
58
+ /** 更改插件 State */
59
+ setState(state: Partial<State>, options?: BaseOptions): void;
60
+ /** 更新户型图大小 */
61
+ updateSize: () => void;
62
+ protected formatData(serverData: PluginServerData): Promise<PluginData>;
63
+ private _disable;
64
+ private _enable;
65
+ private _show;
66
+ private _hide;
67
+ private updateState;
68
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
69
+ *
70
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
71
+ */
72
+ private initContainer;
87
73
  private handleClick;
88
- private handleWantsTapGesture;
89
- /** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
90
- private handleWantsChangeMode;
91
- /** 监听模型态变化,只有在模型态才进行手势动作监听 */
92
- private handleModeChange;
74
+ private addEventListener;
75
+ private removeEventListener;
76
+ /** modelLoaded 之后自动执行 append container 操作 */
77
+ private onFiveModelLoaded;
78
+ /** 更改模型时,自动隐藏户型图 */
79
+ private onFiveModeChange;
80
+ /** 惯性结束后,判断能否自动展示户型图 */
81
+ private onFiveInteriaPan;
93
82
  /** panoIndex 改变时,更新 floorIndex */
94
- private handlePanoArrived;
95
- /** 当户型图正在展示中的时候禁用惯性 */
96
- private handleWantsInteriaPan;
83
+ private onFivePanoArrived;
84
+ /** cameraUpdate 时判断户型图是否应该自动隐藏 */
85
+ private onFiveCameraUpdate;
97
86
  /** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
98
- private handleWantsGesture;
99
- /** 监听三维模型滑动
100
- * 1. 在三维模型转动结束时,如果达到设置的阈值,会自动切换到户型图
101
- * 2. 如何户型图已经展示,滑动时关闭户型图
102
- */
103
- private handlePanGesture;
87
+ private onFiveWantsGesture;
88
+ /** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
89
+ private onFiveWantsPanGesture;
90
+ /** 阻止点击分间走点 */
91
+ private onFiveWantsTapGesture;
92
+ /** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
93
+ private onFiveWantsChangeMode;
94
+ /** 模型楼层高亮改变时,自动进行楼层切换 */
95
+ private onModelShownFloorChange;
104
96
  private render;
105
97
  }
@@ -1,9 +1,7 @@
1
+ import type { Parameters } from './typing';
1
2
  import type { FivePlugin } from '@realsee/five';
2
- import FloorplanPluginController, { ModelFloorplanParameterType } from './Controller';
3
- export declare const ModelFloorplanPlugin: FivePlugin<ModelFloorplanParameterType, ModelFloorplanPluginReturnType>;
3
+ import { Controller } from './Controller';
4
+ export declare const ModelFloorplanPlugin: FivePlugin<undefined | Parameters, Controller>;
5
+ export declare type ModelFloorplanPluginParameterType = Parameters | undefined;
6
+ export declare type ModelFloorplanPluginReturnType = InstanceType<typeof Controller>;
4
7
  export default ModelFloorplanPlugin;
5
- export declare type ModelFloorplanPluginReturnType = FloorplanPluginController;
6
- export type { ModelFloorplanViewEvent } from './typings/events.type';
7
- export type { FloorplanErrorType as ModelFloorplanErrorType } from './utils/constant';
8
- export type { ModelFloorplanPluginsConfigs, ModelFloorplanParameterType } from './Controller';
9
- export type { FloorplanEventHandlers as ModelFloorplanEventHandlers } from './typings/events.type';