@realsee/dnalogel 2.0.0-alpha.12 → 2.0.0-alpha.15

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 (122) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +78 -28
  3. package/dist/CSS3DRenderPlugin/index.js +17 -14
  4. package/dist/CameraMovementPlugin/index.js +40 -15
  5. package/dist/ModelChassisCompassPlugin/index.js +32 -6
  6. package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
  7. package/dist/ModelItemLabelPlugin/index.js +81 -95
  8. package/dist/ModelRoomLabelPlugin/index.js +67 -26
  9. package/dist/ModelTVVideoPlugin/index.d.ts +4 -0
  10. package/dist/ModelTVVideoPlugin/index.js +326 -0
  11. package/dist/ModelTVVideoPlugin/typings.d.ts +25 -0
  12. package/dist/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
  13. package/dist/PanoCompassPlugin/index.js +311 -164
  14. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  15. package/dist/PanoMeasurePlugin/index.js +1335 -581
  16. package/dist/PanoRulerPlugin/index.js +32 -5
  17. package/dist/PanoSpatialTagPlugin/index.js +64 -29
  18. package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
  19. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  20. package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.es.js +2999 -1419
  23. package/dist/index.js +3003 -1422
  24. package/dist/index.umd.js +3003 -1422
  25. package/docs/assets/search.js +1 -1
  26. package/docs/classes/ModelRoomLabelController.html +6 -6
  27. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  28. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  29. package/docs/index.html +78 -33
  30. package/docs/interfaces/LineJson.html +1 -1
  31. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  32. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  33. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  34. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  35. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  36. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  37. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  38. package/docs/interfaces/ModelItemLabelPluginData.html +1 -0
  39. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -0
  40. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -0
  41. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  42. package/docs/interfaces/ModelTVVideoPluginData.html +1 -0
  43. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -0
  44. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -0
  45. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  46. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  47. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  48. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  49. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  50. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  51. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  52. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  53. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  54. package/docs/interfaces/PointJson.html +1 -1
  55. package/docs/interfaces/RoomLabel.html +7 -7
  56. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  57. package/docs/modules.html +12 -12
  58. package/libs/CSS3DRenderPlugin/index.js +16 -13
  59. package/libs/CameraMovementPlugin/index.js +24 -15
  60. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  61. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  62. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +54 -67
  63. package/libs/ModelItemLabelPlugin/index.js +8 -59
  64. package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
  65. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  66. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
  67. package/libs/ModelTVVideoPlugin/index.d.ts +4 -0
  68. package/libs/ModelTVVideoPlugin/index.js +263 -0
  69. package/libs/ModelTVVideoPlugin/typings.d.ts +25 -0
  70. package/libs/ModelTVVideoPlugin/typings.js +7 -0
  71. package/libs/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
  72. package/libs/ModelTVVideoPlugin/utils/parseData.js +13 -0
  73. package/libs/PanoCompassPlugin/index.js +225 -128
  74. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  75. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  76. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  77. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  78. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  79. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  80. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  81. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  82. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  83. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  84. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  85. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  86. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  87. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  88. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  89. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  90. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  91. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  92. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  93. package/libs/PanoRulerPlugin/index.js +16 -5
  94. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  95. package/libs/floorplan/Components/BaseImage.js +10 -5
  96. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  97. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  98. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
  99. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  100. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
  101. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  102. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  103. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  104. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -108
  105. package/libs/floorplan/utils/formatData.js +43 -28
  106. package/libs/floorplan/utils/formatPosition.js +1 -1
  107. package/libs/index.d.ts +3 -0
  108. package/libs/index.js +1 -1
  109. package/libs/shared-utils/Subscribe.js +8 -1
  110. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  111. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  112. package/libs/shared-utils/five/changeMode.js +23 -12
  113. package/libs/shared-utils/getPxmm.js +1 -1
  114. package/libs/shared-utils/math/evenNumber.js +1 -1
  115. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  116. package/libs/shared-utils/three/loadTexture.js +17 -6
  117. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  118. package/libs/shared-utils/tinyEJSrender.js +36 -6
  119. package/libs/shared-utils/to.js +21 -10
  120. package/libs/shared-utils/useDebounce.js +1 -1
  121. package/libs/shared-utils/useThrottle.js +2 -1
  122. package/package.json +2 -1
@@ -1,21 +1,34 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { FLOORPLAN_EXTRA_OBJECT_IMAGE } from '../Assets/floorplanExtraObject';
2
11
  import { floorplanPosition2ImagePosition, getFloorIndexFromModelPosition, modelPosition2FloorplanPosition, } from './formatPosition';
3
- async function formatOutlines(outlines) {
4
- const headers = new Headers({ 'Content-Type': 'text/plain' });
5
- const getOutlineItem = async function (item) {
6
- const outlineItem = {
7
- index: item.index,
8
- url: item.url,
9
- svgUrl: item.svg_url,
12
+ function formatOutlines(outlines) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ const headers = new Headers({ 'Content-Type': 'text/plain' });
15
+ const getOutlineItem = function (item) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const outlineItem = {
18
+ index: item.index,
19
+ url: item.url,
20
+ svgUrl: item.svg_url,
21
+ };
22
+ if (item.svg_url) {
23
+ const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
24
+ outlineItem.svgContent = svgContent;
25
+ }
26
+ return outlineItem;
27
+ });
10
28
  };
11
- if (item.svg_url) {
12
- const svgContent = await fetch(item.svg_url, { headers }).then((res) => res.text());
13
- outlineItem.svgContent = svgContent;
14
- }
15
- return outlineItem;
16
- };
17
- const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
18
- return svgOutlineItems;
29
+ const svgOutlineItems = yield Promise.all(outlines.map(getOutlineItem));
30
+ return svgOutlineItems;
31
+ });
19
32
  }
20
33
  function formatRoom(data) {
21
34
  const floorplanRoomItem = {
@@ -61,19 +74,21 @@ function formatFloorplanEntrance(data) {
61
74
  };
62
75
  return floorplanEntrance;
63
76
  }
64
- export default async function formatData(data) {
65
- const outlines = await formatOutlines(data.outlines);
66
- const bounding = data.computed_data.bounding;
67
- const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
68
- const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
69
- const floorplanData = {
70
- outlines,
71
- entrance,
72
- bounding,
73
- floorDatas,
74
- observers: data.computed_data.observers.map(formateFloorplanObserver),
75
- };
76
- return floorplanData;
77
+ export default function formatData(data) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const outlines = yield formatOutlines(data.outlines);
80
+ const bounding = data.computed_data.bounding;
81
+ const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
82
+ const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
83
+ const floorplanData = {
84
+ outlines,
85
+ entrance,
86
+ bounding,
87
+ floorDatas,
88
+ observers: data.computed_data.observers.map(formateFloorplanObserver),
89
+ };
90
+ return floorplanData;
91
+ });
77
92
  }
78
93
  export function formatExtraObjects(data, five, floorplanData) {
79
94
  const extraObjects = data.map((object) => {
@@ -9,7 +9,7 @@ export function pathD(points, options = {}) {
9
9
  d += 'M' + point;
10
10
  return d;
11
11
  }
12
- if (needA?.[index]) {
12
+ if (needA === null || needA === void 0 ? void 0 : needA[index]) {
13
13
  d += 'A' + needA[index] + ',' + point;
14
14
  return d;
15
15
  }
package/libs/index.d.ts CHANGED
@@ -24,4 +24,7 @@ export type { PluginReturns, PluginEvent, LineJson, PointJson } from './PanoMeas
24
24
  export { default as PanoMeasurePlugin } from './PanoMeasurePlugin';
25
25
  export type { PanoSpatialTagPluginParameterType, PanoSpatialTagPluginData, PanoSpatialTagPluginExportType } from './PanoSpatialTagPlugin';
26
26
  export { default as PanoSpatialTagPlugin } from './PanoSpatialTagPlugin';
27
+ export type { ModelItemLabelPluginData, ModelItemLabelPluginExportReturnsType, ModelItemLabelPluginParametersType } from './ModelItemLabelPlugin/typings';
27
28
  export { default as ModelItemLabelPlugin } from './ModelItemLabelPlugin';
29
+ export type { ModelTVVideoPluginData, ModelTVVideoPluginParameterType, ModelTVVideoPluginExportType } from './ModelTVVideoPlugin/typings';
30
+ export { default as ModelTVVideoPlugin } from './ModelTVVideoPlugin';
package/libs/index.js CHANGED
@@ -14,5 +14,5 @@ export { default as PanoRulerPlugin } from './PanoRulerPlugin';
14
14
  export { default as PanoCompassPlugin } from './PanoCompassPlugin';
15
15
  export { default as PanoMeasurePlugin } from './PanoMeasurePlugin';
16
16
  export { default as PanoSpatialTagPlugin } from './PanoSpatialTagPlugin';
17
- // 模型物品标签插件
18
17
  export { default as ModelItemLabelPlugin } from './ModelItemLabelPlugin';
18
+ export { default as ModelTVVideoPlugin } from './ModelTVVideoPlugin';
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
3
  const __EVENT__ = '__events__';
3
4
  /**
@@ -5,8 +6,13 @@ const __EVENT__ = '__events__';
5
6
  * 观察者模式(供前端使用),Node端推荐<a href="https://nodejs.org/api/events.html#events_class_eventemitter">EventEmitter</a>。
6
7
  */
7
8
  export default class Subscribe {
8
- [__EVENT__];
9
9
  constructor() {
10
+ Object.defineProperty(this, _a, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
10
16
  this[__EVENT__] = {};
11
17
  }
12
18
  /**
@@ -99,3 +105,4 @@ export default class Subscribe {
99
105
  return canceled;
100
106
  }
101
107
  }
108
+ _a = __EVENT__;
@@ -1,24 +1,53 @@
1
1
  import TWEEN from '@tweenjs/tween.js';
2
2
  import { requestAnimationFrameInterval } from './index';
3
3
  export class BetterTween extends TWEEN.Tween {
4
- disposeMethods = [];
5
- animationFrameDisposer;
6
- onDispose = (callback) => {
7
- this.disposeMethods.push(callback);
8
- return this;
9
- };
10
- play = () => {
11
- this.start(0);
12
- this.animationFrameDisposer = requestAnimationFrameInterval((time) => this.update(time));
13
- return this;
14
- };
15
- dispose = () => {
16
- this.stop();
17
- this.animationFrameDisposer?.();
18
- this.disposeMethods.forEach((fn) => fn());
19
- this.disposeMethods = [];
20
- TWEEN.remove(this);
21
- };
4
+ constructor() {
5
+ super(...arguments);
6
+ Object.defineProperty(this, "disposeMethods", {
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true,
10
+ value: []
11
+ });
12
+ Object.defineProperty(this, "animationFrameDisposer", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ Object.defineProperty(this, "onDispose", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: (callback) => {
23
+ this.disposeMethods.push(callback);
24
+ return this;
25
+ }
26
+ });
27
+ Object.defineProperty(this, "play", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: () => {
32
+ this.start(0);
33
+ this.animationFrameDisposer = requestAnimationFrameInterval((time) => this.update(time));
34
+ return this;
35
+ }
36
+ });
37
+ Object.defineProperty(this, "dispose", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: () => {
42
+ var _a;
43
+ this.stop();
44
+ (_a = this.animationFrameDisposer) === null || _a === void 0 ? void 0 : _a.call(this);
45
+ this.disposeMethods.forEach((fn) => fn());
46
+ this.disposeMethods = [];
47
+ TWEEN.remove(this);
48
+ }
49
+ });
50
+ }
22
51
  }
23
52
  export function tweenProgress(duration, easing = TWEEN.Easing.Linear.None) {
24
53
  const tween = new BetterTween({ progress: 0 }).to({ progress: 1 });
@@ -1,10 +1,11 @@
1
1
  import { CanvasTexture } from 'three';
2
2
  export default function createCanvasTextTexture(text, config) {
3
- const size = config?.size ?? 512;
4
- const fontSize = config?.fontSize ?? size * (35 / 256) * 1.2;
5
- const backgroundColor = config?.backgroundColor ?? 'rgba(0,0,0,0)';
6
- const fontColor = config?.fontColor ?? '#fff';
7
- const textAlign = config?.textAlign ?? 'center';
3
+ var _a, _b, _c, _d, _e;
4
+ const size = (_a = config === null || config === void 0 ? void 0 : config.size) !== null && _a !== void 0 ? _a : 512;
5
+ const fontSize = (_b = config === null || config === void 0 ? void 0 : config.fontSize) !== null && _b !== void 0 ? _b : size * (35 / 256) * 1.2;
6
+ const backgroundColor = (_c = config === null || config === void 0 ? void 0 : config.backgroundColor) !== null && _c !== void 0 ? _c : 'rgba(0,0,0,0)';
7
+ const fontColor = (_d = config === null || config === void 0 ? void 0 : config.fontColor) !== null && _d !== void 0 ? _d : '#fff';
8
+ const textAlign = (_e = config === null || config === void 0 ? void 0 : config.textAlign) !== null && _e !== void 0 ? _e : 'center';
8
9
  const canvas = document.createElement('canvas');
9
10
  canvas.setAttribute('width', size + '');
10
11
  canvas.setAttribute('height', size + '');
@@ -1,15 +1,26 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import to from '../to';
2
- export default async function changeMode(five, ...changeModeParams) {
3
- const [changeModeError] = await to(five.changeMode(...changeModeParams));
4
- if (changeModeError)
5
- throw changeModeError;
6
- await new Promise((reslove, reject) => {
7
- five.once('initAnimationEnded', reslove);
8
- const handleModeChange = (mode) => {
9
- if (mode !== changeModeParams[0])
10
- reject('changeMode 被中断');
11
- five.off('modeChange', handleModeChange);
12
- };
13
- five.on('modeChange', handleModeChange);
11
+ export default function changeMode(five, ...changeModeParams) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const [changeModeError] = yield to(five.changeMode(...changeModeParams));
14
+ if (changeModeError)
15
+ throw changeModeError;
16
+ yield new Promise((reslove, reject) => {
17
+ five.once('initAnimationEnded', reslove);
18
+ const handleModeChange = (mode) => {
19
+ if (mode !== changeModeParams[0])
20
+ reject('changeMode 被中断');
21
+ five.off('modeChange', handleModeChange);
22
+ };
23
+ five.on('modeChange', handleModeChange);
24
+ });
14
25
  });
15
26
  }
@@ -16,7 +16,7 @@ export default function getPxmm(five, container, floorIndex, options) {
16
16
  function getY() {
17
17
  const currentFloorY = getFloorY(floorIndex);
18
18
  const nextFloorY = getFloorY(floorIndex + 1);
19
- const attachedTo = options?.attachedTo || FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER;
19
+ const attachedTo = (options === null || options === void 0 ? void 0 : options.attachedTo) || FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER;
20
20
  if (attachedTo === FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
21
21
  return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
22
22
  else if (attachedTo === FLOOR_PLAN_ATTACHED_TO.CEILING)
@@ -1,4 +1,4 @@
1
1
  export default function evenNumber(num, config) {
2
2
  const roundNum = Math.round(num);
3
- return roundNum % 2 === 0 ? roundNum : roundNum + Number(config?.smaller ? -1 : 1);
3
+ return roundNum % 2 === 0 ? roundNum : roundNum + Number((config === null || config === void 0 ? void 0 : config.smaller) ? -1 : 1);
4
4
  }
@@ -1,13 +1,24 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
2
11
  const loader = new FBXLoader();
3
- export async function loadFbxObj(url) {
4
- return new Promise((resolve, reject) => {
5
- function onLoad(object) {
6
- resolve(object);
7
- }
8
- function onError(error) {
9
- reject(error);
10
- }
11
- loader.load(url, onLoad, undefined, onError);
12
+ export function loadFbxObj(url) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ return new Promise((resolve, reject) => {
15
+ function onLoad(object) {
16
+ resolve(object);
17
+ }
18
+ function onError(error) {
19
+ reject(error);
20
+ }
21
+ loader.load(url, onLoad, undefined, onError);
22
+ });
12
23
  });
13
24
  }
@@ -1,10 +1,21 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import * as THREE from 'three';
2
11
  const textureLoader = new THREE.TextureLoader();
3
- export async function loadTexture(url) {
4
- return new Promise((resolve, reject) => {
5
- textureLoader.load(url, resolve, undefined, reject);
6
- }).then((texture) => {
7
- texture.encoding = THREE.sRGBEncoding;
8
- return texture;
12
+ export function loadTexture(url) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ return new Promise((resolve, reject) => {
15
+ textureLoader.load(url, resolve, undefined, reject);
16
+ }).then((texture) => {
17
+ texture.encoding = THREE.sRGBEncoding;
18
+ return texture;
19
+ });
9
20
  });
10
21
  }
@@ -1,12 +1,13 @@
1
1
  import { MeshBasicMaterial } from 'three';
2
2
  export default function transfromToMeshBasicMaterial(object, options) {
3
3
  object.traverse((ele) => {
4
+ var _a;
4
5
  if (ele.type === 'Mesh') {
5
6
  const mesh = ele;
6
7
  const materialConf = Object.assign({ map: mesh.material.map || {} }, options);
7
8
  mesh.material = new MeshBasicMaterial(materialConf);
8
9
  mesh.renderOrder = 1;
9
- if (ele.parent?.type === 'Mesh') {
10
+ if (((_a = ele.parent) === null || _a === void 0 ? void 0 : _a.type) === 'Mesh') {
10
11
  ele.renderOrder = ele.parent.renderOrder + 1;
11
12
  }
12
13
  }
@@ -25,13 +25,43 @@ export default function render(template, data) {
25
25
  return templ.compileFunction()(data);
26
26
  }
27
27
  class Template {
28
- templateText;
29
- mode = null;
30
- truncate = false;
31
- currentLine = 1;
32
- source = '';
33
- regex = new RegExp(REGEX_STRING);
34
28
  constructor(text) {
29
+ Object.defineProperty(this, "templateText", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: void 0
34
+ });
35
+ Object.defineProperty(this, "mode", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: null
40
+ });
41
+ Object.defineProperty(this, "truncate", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: false
46
+ });
47
+ Object.defineProperty(this, "currentLine", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: 1
52
+ });
53
+ Object.defineProperty(this, "source", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: ''
58
+ });
59
+ Object.defineProperty(this, "regex", {
60
+ enumerable: true,
61
+ configurable: true,
62
+ writable: true,
63
+ value: new RegExp(REGEX_STRING)
64
+ });
35
65
  this.templateText = text;
36
66
  }
37
67
  compileFunction() {
@@ -1,18 +1,29 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  /**
2
11
  * 传入一个 Promise
3
12
  * 无异常,返回 [null, data]
4
13
  * 有异常,则返回 [Error, undefined]
5
14
  * 用于替代 try&catch 处理 await 异常的方案
6
15
  */
7
- export async function to(promise) {
8
- try {
9
- const data = await promise;
10
- return [null, data];
11
- }
12
- catch (error) {
13
- if (error instanceof Error)
14
- return [error, null];
15
- return [new Error(''), null];
16
- }
16
+ export function to(promise) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ try {
19
+ const data = yield promise;
20
+ return [null, data];
21
+ }
22
+ catch (error) {
23
+ if (error instanceof Error)
24
+ return [error, null];
25
+ return [new Error(''), null];
26
+ }
27
+ });
17
28
  }
18
29
  export default to;
@@ -16,7 +16,7 @@ export const useDebounce = (callback, waitFor = 200) => {
16
16
  clearTimeout(timer.current);
17
17
  timer.current = null;
18
18
  }
19
- timer.current = setTimeout(() => savedFunc.current?.(...args), waitFor);
19
+ timer.current = setTimeout(() => { var _a; return (_a = savedFunc.current) === null || _a === void 0 ? void 0 : _a.call(savedFunc, ...args); }, waitFor);
20
20
  }, []);
21
21
  };
22
22
  export default useDebounce;
@@ -12,9 +12,10 @@ export const useThrottle = (callback, waitFor) => {
12
12
  savedFunc.current = callback;
13
13
  }, [waitFor]);
14
14
  return useCallback((...args) => {
15
+ var _a;
15
16
  if (timer.current)
16
17
  return;
17
- savedFunc.current?.(...args);
18
+ (_a = savedFunc.current) === null || _a === void 0 ? void 0 : _a.call(savedFunc, ...args);
18
19
  timer.current = setTimeout(() => {
19
20
  if (timer.current)
20
21
  clearTimeout(timer.current);
package/package.json CHANGED
@@ -5,8 +5,9 @@
5
5
  "type": "module",
6
6
  "author": "REALSEE-DEVELOPER",
7
7
  "repository": "https://github.com/realsee-developer/dnalogel.git",
8
+ "description": "如视 VR 看房插件合集",
8
9
  "private": false,
9
- "version": "2.0.0-alpha.12",
10
+ "version": "2.0.0-alpha.15",
10
11
  "license": "SEE LICENSE IN TERMS.txt",
11
12
  "scripts": {
12
13
  "build": "yarn run tsb && yarn run build:rollup && yarn build:docs",