@realsee/dnalogel 2.0.0-alpha.33 → 2.0.0-alpha.35-beta2

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 (139) hide show
  1. package/components/index.js +1450 -0
  2. package/dist/PanoSpatialTagPlugin/index.js +21 -7
  3. package/dist/components/PaintBrush/Controller.d.ts +43 -0
  4. package/dist/components/PaintBrush/Subscribe.d.ts +76 -0
  5. package/dist/components/PaintBrush/index.d.ts +27 -0
  6. package/dist/components/PaintBrush/style.d.ts +2 -0
  7. package/dist/components/PaintBrush/tween.d.ts +62 -0
  8. package/dist/components/PaintBrush/typings.d.ts +58 -0
  9. package/dist/components/PaintBrush/utils.d.ts +26 -0
  10. package/dist/components/index.d.ts +2 -0
  11. package/dist/index.es.js +21 -7
  12. package/dist/index.js +21 -7
  13. package/dist/index.umd.js +21 -7
  14. package/dist/shared-utils/uuid.d.ts +1 -0
  15. package/docs/classes/Magnifier.html +4 -4
  16. package/docs/classes/ModelRoomLabelController.html +4 -4
  17. package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
  18. package/docs/enums/CameraMovementEffect.html +2 -2
  19. package/docs/enums/DIRECTION.html +1 -1
  20. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  21. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  22. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  23. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  24. package/docs/enums/Rotation.html +2 -2
  25. package/docs/index.html +1 -1
  26. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  27. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  28. package/docs/interfaces/FloorplanBounding.html +4 -4
  29. package/docs/interfaces/FloorplanData.html +2 -2
  30. package/docs/interfaces/FloorplanEntrance.html +7 -7
  31. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  32. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  33. package/docs/interfaces/FloorplanFloorData.html +2 -2
  34. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  35. package/docs/interfaces/FloorplanObserver.html +2 -2
  36. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  37. package/docs/interfaces/FloorplanPosition.html +2 -2
  38. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  39. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  40. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  41. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  42. package/docs/interfaces/FloorplanServerData.html +2 -2
  43. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  44. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  45. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  46. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  47. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  48. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  49. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  50. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  51. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  52. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  53. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  54. package/docs/interfaces/LineJson.html +1 -1
  55. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  56. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  57. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  58. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  59. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  60. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  61. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  62. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  63. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  64. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  65. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  66. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  67. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  68. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  69. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  70. package/docs/interfaces/OpenParameter.html +2 -2
  71. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  72. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  73. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  74. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  75. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
  76. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  77. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  78. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  79. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  80. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  81. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  82. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  83. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  84. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  85. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  86. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  87. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  88. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  89. package/docs/interfaces/Point.html +1 -1
  90. package/docs/interfaces/PointJson.html +1 -1
  91. package/docs/interfaces/Room.html +1 -1
  92. package/docs/interfaces/RoomInfo.html +1 -1
  93. package/docs/interfaces/RoomLabel.html +7 -7
  94. package/docs/interfaces/RoomRules.html +1 -1
  95. package/docs/interfaces/Rooms.html +1 -1
  96. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +9 -9
  97. package/docs/modules.html +20 -20
  98. package/libs/ModelSimulationPlugin/index.d.ts +33 -0
  99. package/libs/ModelSimulationPlugin/index.js +166 -0
  100. package/libs/ModelSimulationPlugin/shaders/fragment.d.ts +2 -0
  101. package/libs/ModelSimulationPlugin/shaders/fragment.js +96 -0
  102. package/libs/ModelSimulationPlugin/shaders/vertex.d.ts +2 -0
  103. package/libs/ModelSimulationPlugin/shaders/vertex.js +23 -0
  104. package/libs/PanoSpatialTagPlugin/Plugin.js +21 -7
  105. package/libs/components/PaintBrush/Controller.d.ts +43 -0
  106. package/libs/components/PaintBrush/Controller.js +575 -0
  107. package/libs/components/PaintBrush/Subscribe.d.ts +76 -0
  108. package/libs/components/PaintBrush/Subscribe.js +121 -0
  109. package/libs/components/PaintBrush/index.d.ts +27 -0
  110. package/libs/components/PaintBrush/index.js +57 -0
  111. package/libs/components/PaintBrush/style.d.ts +2 -0
  112. package/libs/components/PaintBrush/style.js +102 -0
  113. package/libs/components/PaintBrush/tween.d.ts +62 -0
  114. package/libs/components/PaintBrush/tween.js +15 -0
  115. package/libs/components/PaintBrush/typings.d.ts +58 -0
  116. package/libs/components/PaintBrush/typings.js +6 -0
  117. package/libs/components/PaintBrush/utils.d.ts +26 -0
  118. package/libs/components/PaintBrush/utils.js +51 -0
  119. package/libs/components/index.d.ts +2 -0
  120. package/libs/components/index.js +3 -0
  121. package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.d.ts +1 -0
  122. package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.js +1 -0
  123. package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.js +120 -0
  124. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +106 -0
  125. package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.js +463 -0
  126. package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +375 -0
  127. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +171 -0
  128. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.js +265 -0
  129. package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +301 -0
  130. package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.js +219 -0
  131. package/libs/shared-utils/five/useFivePlugin.d.ts +1 -0
  132. package/libs/shared-utils/five/useFivePlugin.js +8 -0
  133. package/libs/shared-utils/useDebounce.d.ts +8 -0
  134. package/libs/shared-utils/useDebounce.js +22 -0
  135. package/libs/shared-utils/useThrottle.d.ts +8 -0
  136. package/libs/shared-utils/useThrottle.js +25 -0
  137. package/libs/shared-utils/uuid.d.ts +1 -0
  138. package/libs/shared-utils/uuid.js +1 -0
  139. package/package.json +4 -2
@@ -885,7 +885,6 @@ 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
890
  const MIN_DISTANCE = 1.2;
@@ -896,6 +895,7 @@ const MAX_DISTANCE = 3.5;
896
895
  const PanoSpatialTagPlugin = (five$1, params) => {
897
896
  var _a, _b, _c, _d, _e, _f;
898
897
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
898
+ let centerY = 1.4;
899
899
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
900
900
  const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
901
901
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
@@ -954,7 +954,7 @@ 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);
957
+ const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
958
958
  if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
959
959
  return tag.destroying = true;
960
960
  if (!frustum.containsPoint(tag.position))
@@ -1049,7 +1049,7 @@ 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);
1052
+ const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
1053
1053
  if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
1054
1054
  return result;
1055
1055
  if (!frustum.containsPoint(point.position))
@@ -1110,10 +1110,12 @@ 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);
1114
- const [intersect] = five$1.model.bvhs.loaded ?
1115
- five$1.model.intersectRaycaster(raycaster) :
1116
- raycaster.intersectObjects(five$1.model.children, true);
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
+ const [intersect] = state.intersectObjects ?
1115
+ raycaster.intersectObjects(state.intersectObjects, true) :
1116
+ (five$1.model.bvhs.loaded ?
1117
+ five$1.model.intersectRaycaster(raycaster) :
1118
+ raycaster.intersectObjects(five$1.model.children, true));
1117
1119
  if (!intersect)
1118
1120
  continue;
1119
1121
  if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
@@ -1180,6 +1182,13 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1180
1182
  if (data.folded === true)
1181
1183
  state.folded = data.folded;
1182
1184
  };
1185
+ /** 设置射线碰撞检测objects
1186
+ *
1187
+ */
1188
+ const setIntersectObjects = (objects) => {
1189
+ state.intersectObjects = objects;
1190
+ updateTags();
1191
+ };
1183
1192
  /** 标签启用
1184
1193
  * 启用插件并重新计算展示标签
1185
1194
  */
@@ -1253,13 +1262,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1253
1262
  five$1.off('panoArrived', onPanoArrived);
1254
1263
  five$1.off('modeChange', onModeChange);
1255
1264
  five$1.off('cameraUpdate', onCameraUpdate);
1265
+ window.removeEventListener('resize', updateOrigins, false);
1256
1266
  };
1267
+ window.addEventListener('resize', updateOrigins, false);
1257
1268
  if ((_f = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _f === void 0 ? void 0 : _f.loaded) {
1258
1269
  if (!wrapper)
1259
1270
  wrapper = five$1.getElement().parentElement;
1260
1271
  if (wrapper)
1261
1272
  wrapper.appendChild(container);
1262
1273
  state.forbidden = false;
1274
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
1263
1275
  updateTags();
1264
1276
  five$1.on('panoWillArrive', onPanoWillArrive);
1265
1277
  five$1.on('panoArrived', onPanoArrived);
@@ -1272,6 +1284,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1272
1284
  wrapper = five$1.getElement().parentElement;
1273
1285
  if (wrapper)
1274
1286
  wrapper.appendChild(container);
1287
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
1275
1288
  state.forbidden = false;
1276
1289
  updateTags();
1277
1290
  five$1.on('panoWillArrive', onPanoWillArrive);
@@ -1283,6 +1296,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1283
1296
  five$1.on('dispose', dispose);
1284
1297
  return {
1285
1298
  load,
1299
+ setIntersectObjects,
1286
1300
  unfoldAll,
1287
1301
  foldAll,
1288
1302
  unfold,
@@ -0,0 +1,43 @@
1
+ import { noop } from './utils';
2
+ import { PaintBrushAction, PaintBrushConfigs, PaintBrushEventMap, PaintBrushState } from './typings';
3
+ import { Subscribe } from './Subscribe';
4
+ export declare class Controller extends Subscribe<PaintBrushEventMap> {
5
+ configs: PaintBrushConfigs;
6
+ private clientWidth;
7
+ private clientHeight;
8
+ private ready;
9
+ private uuid;
10
+ private tween?;
11
+ private tweening;
12
+ private container;
13
+ private canvas;
14
+ private data;
15
+ private tempLine;
16
+ get color(): string;
17
+ get state(): Record<string, PaintBrushState[]>;
18
+ get dpr(): number;
19
+ constructor(configs: PaintBrushConfigs);
20
+ ifInsertToDOM(): HTMLDivElement;
21
+ /**
22
+ *
23
+ * @param className 初始化画板
24
+ * @returns
25
+ */
26
+ initCanvas(className: string): HTMLCanvasElement;
27
+ /**
28
+ * 初始化操作面板
29
+ * @returns
30
+ */
31
+ initCtrl(): HTMLDivElement;
32
+ openBrush(): void;
33
+ closeBrush(): void;
34
+ updateCurrentColor(color: string): void;
35
+ openBrushHandle(): void;
36
+ emitStateChange(action: PaintBrushAction, userAction?: boolean): void;
37
+ action(action: PaintBrushAction): void;
38
+ handleDrawLine(_uuid: string, data: PaintBrushState, { withUndo }: {
39
+ withUndo?: boolean;
40
+ }, callback?: typeof noop): void;
41
+ handleUndo(uuid: string): void;
42
+ destroyBrush(): void;
43
+ }
@@ -0,0 +1,76 @@
1
+ export declare type EventMap = {
2
+ [name: string]: (...args: any[]) => void | boolean;
3
+ };
4
+ /**
5
+ * 监听者模式
6
+ * @template T 预设的监听回调类型
7
+ * @example
8
+ * ```
9
+ * new Subscribe<{
10
+ * "foo": [arg1: number, arg2: string],
11
+ * "bar": [arg: boolean],
12
+ * }>()
13
+ * ```
14
+ */
15
+ declare class Subscribe<T extends EventMap> {
16
+ /**
17
+ * 判断是否注册了事件
18
+ * @param name 事件类型
19
+ */
20
+ hasListener(name: keyof T): boolean;
21
+ /**
22
+ * 注册事件
23
+ * @param name 事件类型
24
+ * @param callback 事件回调函数
25
+ * @param once 是否只执行一次
26
+ * @returns 解除事件
27
+ * @template K 预设的监听事件名称
28
+ * @template C 回调函数函数上下文
29
+ */
30
+ on<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>, once?: boolean): () => void;
31
+ /**
32
+ * 注册事件(是否只执行一次)
33
+ * @param name 事件类型
34
+ * @param callback 事件回调函数
35
+ * @returns 解除事件
36
+ * @template K 预设的监听事件名称
37
+ * @template C 回调函数函数上下文
38
+ */
39
+ once<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>): () => void;
40
+ /**
41
+ * 解除事件
42
+ *
43
+ * 如果 name 不传的话解除对应所有事件
44
+ * 如果 name, callback 不传的话解除所有name的所有事件
45
+ * @param name 事件类型
46
+ * @param callback 事件回调函数
47
+ * @template K 预设的监听事件名称
48
+ */
49
+ off<K extends keyof T>(name?: K, callback?: (...args: Parameters<T[K]>) => ReturnType<T[K]>): void;
50
+ /**
51
+ * 触发事件
52
+ * @param name 事件类型
53
+ * @param data 触发事件的数据
54
+ * @returns canceled 是否被触发取消
55
+ * @template K 预设的监听事件名称
56
+ */
57
+ emit<K extends keyof T>(name: K, ...data: Parameters<T[K]>): boolean;
58
+ }
59
+ export declare namespace SubscribeMixinType {
60
+ interface hasListener<T extends EventMap> {
61
+ (name: keyof T): boolean;
62
+ }
63
+ interface on<T extends EventMap> {
64
+ <K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>, once?: boolean): () => void;
65
+ }
66
+ interface once<T extends EventMap> {
67
+ <K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>): () => void;
68
+ }
69
+ interface off<T extends EventMap> {
70
+ <K extends keyof T>(names?: K | K[], callback?: (...args: any[]) => any): void;
71
+ }
72
+ interface emit<T extends EventMap> {
73
+ <K extends keyof T>(name: K, ...data: Parameters<T[K]>): boolean;
74
+ }
75
+ }
76
+ export { Subscribe };
@@ -0,0 +1,27 @@
1
+ import type { PaintBrushAction, PaintBrushConfigs, PaintBrushEventMap, PaintBrushState } from './typings';
2
+ export declare class PaintBrush {
3
+ private controller;
4
+ constructor(configs?: Partial<PaintBrushConfigs>);
5
+ on<K extends keyof PaintBrushEventMap>(name: K, callback: (...args: Parameters<PaintBrushEventMap[K]>) => ReturnType<PaintBrushEventMap[K]>): void;
6
+ off<K extends keyof PaintBrushEventMap>(name: K, callback: (...args: Parameters<PaintBrushEventMap[K]>) => ReturnType<PaintBrushEventMap[K]>): void;
7
+ once<K extends keyof PaintBrushEventMap>(name: K, callback: (...args: Parameters<PaintBrushEventMap[K]>) => ReturnType<PaintBrushEventMap[K]>): void;
8
+ /**
9
+ * 显示画笔。
10
+ */
11
+ show(): void;
12
+ action(action: PaintBrushAction): void;
13
+ /**
14
+ * 获取画笔状态。
15
+ */
16
+ get state(): Record<string, PaintBrushState[]>;
17
+ get configs(): PaintBrushConfigs;
18
+ /**
19
+ * 销毁。
20
+ *
21
+ * @deprecated
22
+ *
23
+ * @description 画笔应该维护一个 **全局单例**,重复利用。
24
+ */
25
+ dispose(): void;
26
+ setCurrentColor(color: string): void;
27
+ }
@@ -0,0 +1,2 @@
1
+ declare const PaintBrushStyle = "\n<style type=\"text/css\">\n\n#_gl_paintBrush {\nposition: fixed;\ntop: 0;\nbottom: 0;\nleft: 0;\nright: 0;\ntransform: translateZ(0);\nz-index: 1997;\npointer-events: none;\nopacity: 0;\ntransition: all 500ms;\n}\n\n#_gl_paintBrush.brushing {\n opacity: 1;\n}\n\n#_gl_paintBrush ._paintBrush-canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n#_gl_paintBrush ._paintBrush-canvas--sync {\n pointer-events: none;\n z-index: 0;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n#_gl_paintBrush ._paintBrush-canvas {\n pointer-events: none;\n z-index: 1;\n}\n\n#_gl_paintBrush.brushing ._paintBrush-canvas {\n pointer-events: auto;\n}\n\n#_gl_paintBrush ._paintBrush-ctrl {\n width: 140px;\n height: 52px;\n position: absolute;\n bottom: 28px;\n right: 50%;\n transform: translateX(50%);\n font-size: 10px;\n color: white;\n z-index: 2;\n}\n\n#_gl_paintBrush.brushing ._paintBrush-ctrl {\n pointer-events: auto;\n}\n\n#_gl_paintBrush ._paintBrush-ctrl ._paintBrush-ctrlinner {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: 100%;\n border-radius: 26px;\n padding: 8px 16px;\n box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);\n background-image: linear-gradient(180deg, hsl(0deg 0% 0% / 57%), hsl(0deg 0% 0% / 70%) 117%);\n}\n\n._paintBrush-ctrlitem {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 38px;\n height: 38px;\n cursor: pointer;\n}\n\n._paintBrush-ctrlitem--undo >.brush-icon{\n background-image: url(\"//vrlab-static.ljcdn.com/release/web/revoke.ab7694ef.svg\");\n background-size: 100%;\n width: 22px;\n height: 22px;\n}\n\n._paintBrush-ctrlitem--close >.brush-icon {\n background-image: url(\"//vrlab-static.ljcdn.com/release/web/exit_paintbrush.02bc1341.svg\");\n background-size: 100%;\n width: 22px;\n height: 22px;\n}\n\n</style>\n";
2
+ export default PaintBrushStyle;
@@ -0,0 +1,62 @@
1
+ import { Tween } from '@tweenjs/tween.js';
2
+ export declare const Easing: {
3
+ Linear: {
4
+ None: (amount: number) => number;
5
+ };
6
+ Quadratic: {
7
+ In: (amount: number) => number;
8
+ Out: (amount: number) => number;
9
+ InOut: (amount: number) => number;
10
+ };
11
+ Cubic: {
12
+ In: (amount: number) => number;
13
+ Out: (amount: number) => number;
14
+ InOut: (amount: number) => number;
15
+ };
16
+ Quartic: {
17
+ In: (amount: number) => number;
18
+ Out: (amount: number) => number;
19
+ InOut: (amount: number) => number;
20
+ };
21
+ Quintic: {
22
+ In: (amount: number) => number;
23
+ Out: (amount: number) => number;
24
+ InOut: (amount: number) => number;
25
+ };
26
+ Sinusoidal: {
27
+ In: (amount: number) => number;
28
+ Out: (amount: number) => number;
29
+ InOut: (amount: number) => number;
30
+ };
31
+ Exponential: {
32
+ In: (amount: number) => number;
33
+ Out: (amount: number) => number;
34
+ InOut: (amount: number) => number;
35
+ };
36
+ Circular: {
37
+ In: (amount: number) => number;
38
+ Out: (amount: number) => number;
39
+ InOut: (amount: number) => number;
40
+ };
41
+ Elastic: {
42
+ In: (amount: number) => number;
43
+ Out: (amount: number) => number;
44
+ InOut: (amount: number) => number;
45
+ };
46
+ Back: {
47
+ In: (amount: number) => number;
48
+ Out: (amount: number) => number;
49
+ InOut: (amount: number) => number;
50
+ };
51
+ Bounce: {
52
+ In: (amount: number) => number;
53
+ Out: (amount: number) => number;
54
+ InOut: (amount: number) => number;
55
+ };
56
+ };
57
+ export interface TweenRes extends Tween<any> {
58
+ onDestroy: (fn: () => void) => any;
59
+ destroy: () => any;
60
+ }
61
+ export default function tween(from: any, to: any, duration: number, easing?: (amount: number) => number): TweenRes;
62
+ export declare function tweenProgress(duration: number, easing: (amount: number) => number): TweenRes;
@@ -0,0 +1,58 @@
1
+ export interface PaintBrushConfigs {
2
+ container?: HTMLDivElement;
3
+ currentColor: string;
4
+ DPR?: number;
5
+ onClickClose?: () => void;
6
+ onClickUndo?: () => void;
7
+ onUndoText?: string;
8
+ onExitText?: string;
9
+ }
10
+ export declare type PaintBrushEventMap = {
11
+ readyChange: (ready: boolean) => void;
12
+ stateChange: (state: PaintBrushAction, userAction: boolean) => void;
13
+ };
14
+ export interface PaintBrushState {
15
+ move: {
16
+ x: number;
17
+ y: number;
18
+ };
19
+ line: {
20
+ x: number;
21
+ y: number;
22
+ }[];
23
+ color: string;
24
+ uuid: string;
25
+ duration: number;
26
+ }
27
+ export declare enum PaintBrushTypeEnum {
28
+ Drawline = "Drawline",
29
+ Undo = "Undo",
30
+ Exit = "Exit"
31
+ }
32
+ export interface PaintBrushAction {
33
+ uuid: string;
34
+ /**
35
+ * 类型枚举
36
+ */
37
+ type: PaintBrushTypeEnum;
38
+ /**
39
+ * 颜色色值
40
+ */
41
+ color: string;
42
+ /**
43
+ * 是否就绪
44
+ */
45
+ ready: boolean;
46
+ /**
47
+ * 状态值
48
+ */
49
+ state?: PaintBrushState;
50
+ /**
51
+ * 时间戳:当作 uuid 使用
52
+ */
53
+ timestamp?: number;
54
+ /**
55
+ * 是否是结尾数据
56
+ */
57
+ end?: boolean;
58
+ }
@@ -0,0 +1,26 @@
1
+ export declare function noop(): void;
2
+ export interface Coords {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ export declare function queue(promiseCallback?: () => Promise<void>): void;
7
+ export declare function transformCoords(coords: Coords, cw: number, ch: number): {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ export declare function unTransformCoords(coords: Coords, cw: number, ch: number): {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ export declare function getQuadraticCurvePoint(points: Coords[]): {
16
+ control?: undefined;
17
+ end?: undefined;
18
+ } | {
19
+ control: Coords;
20
+ end: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ };
25
+ export declare function execInterval(i: number, time: number, callback?: typeof noop): void;
26
+ export declare function nextFrame(fn: FrameRequestCallback, delay?: number): void;
@@ -0,0 +1,2 @@
1
+ export * from './PaintBrush';
2
+ export * from './PaintBrush/typings';
package/dist/index.es.js CHANGED
@@ -12426,7 +12426,6 @@ class Template {
12426
12426
  }
12427
12427
 
12428
12428
  const MESH_SIZE = 0.001;
12429
- const RAY_ORIGIN_Y = 1.4;
12430
12429
  const RAY_TOLERANT_DISTANCE = 0.01;
12431
12430
  const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
12432
12431
  const MIN_DISTANCE = 1.2;
@@ -12437,6 +12436,7 @@ const MAX_DISTANCE = 3.5;
12437
12436
  const PanoSpatialTagPlugin = (five, params) => {
12438
12437
  var _a, _b, _c, _d, _e, _f;
12439
12438
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
12439
+ let centerY = 1.4;
12440
12440
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
12441
12441
  const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
12442
12442
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
@@ -12495,7 +12495,7 @@ const PanoSpatialTagPlugin = (five, params) => {
12495
12495
  projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
12496
12496
  frustum.setFromProjectionMatrix(projScreenMatrix);
12497
12497
  state.tags.forEach(tag => {
12498
- const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(tag.position);
12498
+ const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
12499
12499
  if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12500
12500
  return tag.destroying = true;
12501
12501
  if (!frustum.containsPoint(tag.position))
@@ -12590,7 +12590,7 @@ const PanoSpatialTagPlugin = (five, params) => {
12590
12590
  const points = state.points.reduce((result, point) => {
12591
12591
  if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
12592
12592
  return result;
12593
- const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(point.position);
12593
+ const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
12594
12594
  if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12595
12595
  return result;
12596
12596
  if (!frustum.containsPoint(point.position))
@@ -12651,10 +12651,12 @@ const PanoSpatialTagPlugin = (five, params) => {
12651
12651
  Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
12652
12652
  }))
12653
12653
  continue;
12654
- const raycaster = new THREE.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);
12655
- const [intersect] = five.model.bvhs.loaded ?
12656
- five.model.intersectRaycaster(raycaster) :
12657
- raycaster.intersectObjects(five.model.children, true);
12654
+ const raycaster = new THREE.Raycaster(camera.position.clone().setY(centerY), point.position.clone().sub(camera.position.clone().setY(centerY)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
12655
+ const [intersect] = state.intersectObjects ?
12656
+ raycaster.intersectObjects(state.intersectObjects, true) :
12657
+ (five.model.bvhs.loaded ?
12658
+ five.model.intersectRaycaster(raycaster) :
12659
+ raycaster.intersectObjects(five.model.children, true));
12658
12660
  if (!intersect)
12659
12661
  continue;
12660
12662
  if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
@@ -12721,6 +12723,13 @@ const PanoSpatialTagPlugin = (five, params) => {
12721
12723
  if (data.folded === true)
12722
12724
  state.folded = data.folded;
12723
12725
  };
12726
+ /** 设置射线碰撞检测objects
12727
+ *
12728
+ */
12729
+ const setIntersectObjects = (objects) => {
12730
+ state.intersectObjects = objects;
12731
+ updateTags();
12732
+ };
12724
12733
  /** 标签启用
12725
12734
  * 启用插件并重新计算展示标签
12726
12735
  */
@@ -12794,13 +12803,16 @@ const PanoSpatialTagPlugin = (five, params) => {
12794
12803
  five.off('panoArrived', onPanoArrived);
12795
12804
  five.off('modeChange', onModeChange);
12796
12805
  five.off('cameraUpdate', onCameraUpdate);
12806
+ window.removeEventListener('resize', updateOrigins, false);
12797
12807
  };
12808
+ window.addEventListener('resize', updateOrigins, false);
12798
12809
  if ((_f = five === null || five === void 0 ? void 0 : five.model) === null || _f === void 0 ? void 0 : _f.loaded) {
12799
12810
  if (!wrapper)
12800
12811
  wrapper = five.getElement().parentElement;
12801
12812
  if (wrapper)
12802
12813
  wrapper.appendChild(container);
12803
12814
  state.forbidden = false;
12815
+ centerY = five.model.bounding.getCenter(new THREE.Vector3()).y;
12804
12816
  updateTags();
12805
12817
  five.on('panoWillArrive', onPanoWillArrive);
12806
12818
  five.on('panoArrived', onPanoArrived);
@@ -12813,6 +12825,7 @@ const PanoSpatialTagPlugin = (five, params) => {
12813
12825
  wrapper = five.getElement().parentElement;
12814
12826
  if (wrapper)
12815
12827
  wrapper.appendChild(container);
12828
+ centerY = five.model.bounding.getCenter(new THREE.Vector3()).y;
12816
12829
  state.forbidden = false;
12817
12830
  updateTags();
12818
12831
  five.on('panoWillArrive', onPanoWillArrive);
@@ -12824,6 +12837,7 @@ const PanoSpatialTagPlugin = (five, params) => {
12824
12837
  five.on('dispose', dispose);
12825
12838
  return {
12826
12839
  load,
12840
+ setIntersectObjects,
12827
12841
  unfoldAll,
12828
12842
  foldAll,
12829
12843
  unfold,
package/dist/index.js CHANGED
@@ -12454,7 +12454,6 @@ class Template {
12454
12454
  }
12455
12455
 
12456
12456
  const MESH_SIZE = 0.001;
12457
- const RAY_ORIGIN_Y = 1.4;
12458
12457
  const RAY_TOLERANT_DISTANCE = 0.01;
12459
12458
  const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
12460
12459
  const MIN_DISTANCE = 1.2;
@@ -12465,6 +12464,7 @@ const MAX_DISTANCE = 3.5;
12465
12464
  const PanoSpatialTagPlugin = (five$1, params) => {
12466
12465
  var _a, _b, _c, _d, _e, _f;
12467
12466
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
12467
+ let centerY = 1.4;
12468
12468
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
12469
12469
  const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
12470
12470
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
@@ -12523,7 +12523,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12523
12523
  projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
12524
12524
  frustum.setFromProjectionMatrix(projScreenMatrix);
12525
12525
  state.tags.forEach(tag => {
12526
- const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(tag.position);
12526
+ const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
12527
12527
  if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12528
12528
  return tag.destroying = true;
12529
12529
  if (!frustum.containsPoint(tag.position))
@@ -12618,7 +12618,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12618
12618
  const points = state.points.reduce((result, point) => {
12619
12619
  if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
12620
12620
  return result;
12621
- const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(point.position);
12621
+ const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
12622
12622
  if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12623
12623
  return result;
12624
12624
  if (!frustum.containsPoint(point.position))
@@ -12679,10 +12679,12 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12679
12679
  Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
12680
12680
  }))
12681
12681
  continue;
12682
- 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);
12683
- const [intersect] = five$1.model.bvhs.loaded ?
12684
- five$1.model.intersectRaycaster(raycaster) :
12685
- raycaster.intersectObjects(five$1.model.children, true);
12682
+ 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);
12683
+ const [intersect] = state.intersectObjects ?
12684
+ raycaster.intersectObjects(state.intersectObjects, true) :
12685
+ (five$1.model.bvhs.loaded ?
12686
+ five$1.model.intersectRaycaster(raycaster) :
12687
+ raycaster.intersectObjects(five$1.model.children, true));
12686
12688
  if (!intersect)
12687
12689
  continue;
12688
12690
  if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
@@ -12749,6 +12751,13 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12749
12751
  if (data.folded === true)
12750
12752
  state.folded = data.folded;
12751
12753
  };
12754
+ /** 设置射线碰撞检测objects
12755
+ *
12756
+ */
12757
+ const setIntersectObjects = (objects) => {
12758
+ state.intersectObjects = objects;
12759
+ updateTags();
12760
+ };
12752
12761
  /** 标签启用
12753
12762
  * 启用插件并重新计算展示标签
12754
12763
  */
@@ -12822,13 +12831,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12822
12831
  five$1.off('panoArrived', onPanoArrived);
12823
12832
  five$1.off('modeChange', onModeChange);
12824
12833
  five$1.off('cameraUpdate', onCameraUpdate);
12834
+ window.removeEventListener('resize', updateOrigins, false);
12825
12835
  };
12836
+ window.addEventListener('resize', updateOrigins, false);
12826
12837
  if ((_f = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _f === void 0 ? void 0 : _f.loaded) {
12827
12838
  if (!wrapper)
12828
12839
  wrapper = five$1.getElement().parentElement;
12829
12840
  if (wrapper)
12830
12841
  wrapper.appendChild(container);
12831
12842
  state.forbidden = false;
12843
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
12832
12844
  updateTags();
12833
12845
  five$1.on('panoWillArrive', onPanoWillArrive);
12834
12846
  five$1.on('panoArrived', onPanoArrived);
@@ -12841,6 +12853,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12841
12853
  wrapper = five$1.getElement().parentElement;
12842
12854
  if (wrapper)
12843
12855
  wrapper.appendChild(container);
12856
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
12844
12857
  state.forbidden = false;
12845
12858
  updateTags();
12846
12859
  five$1.on('panoWillArrive', onPanoWillArrive);
@@ -12852,6 +12865,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12852
12865
  five$1.on('dispose', dispose);
12853
12866
  return {
12854
12867
  load,
12868
+ setIntersectObjects,
12855
12869
  unfoldAll,
12856
12870
  foldAll,
12857
12871
  unfold,