@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.
- package/CHANGELOG.md +11 -0
- package/README.md +78 -28
- package/dist/CSS3DRenderPlugin/index.js +17 -14
- package/dist/CameraMovementPlugin/index.js +40 -15
- package/dist/ModelChassisCompassPlugin/index.js +32 -6
- package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
- package/dist/ModelItemLabelPlugin/index.js +81 -95
- package/dist/ModelRoomLabelPlugin/index.js +67 -26
- package/dist/ModelTVVideoPlugin/index.d.ts +4 -0
- package/dist/ModelTVVideoPlugin/index.js +326 -0
- package/dist/ModelTVVideoPlugin/typings.d.ts +25 -0
- package/dist/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
- package/dist/PanoCompassPlugin/index.js +311 -164
- package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
- package/dist/PanoMeasurePlugin/index.js +1335 -581
- package/dist/PanoRulerPlugin/index.js +32 -5
- package/dist/PanoSpatialTagPlugin/index.js +64 -29
- package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +2999 -1419
- package/dist/index.js +3003 -1422
- package/dist/index.umd.js +3003 -1422
- package/docs/assets/search.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +6 -6
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/index.html +78 -33
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -0
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -0
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
- package/docs/modules.html +12 -12
- package/libs/CSS3DRenderPlugin/index.js +16 -13
- package/libs/CameraMovementPlugin/index.js +24 -15
- package/libs/ModelChassisCompassPlugin/index.js +14 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +54 -67
- package/libs/ModelItemLabelPlugin/index.js +8 -59
- package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
- package/libs/ModelTVVideoPlugin/index.d.ts +4 -0
- package/libs/ModelTVVideoPlugin/index.js +263 -0
- package/libs/ModelTVVideoPlugin/typings.d.ts +25 -0
- package/libs/ModelTVVideoPlugin/typings.js +7 -0
- package/libs/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
- package/libs/ModelTVVideoPlugin/utils/parseData.js +13 -0
- package/libs/PanoCompassPlugin/index.js +225 -128
- package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
- package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
- package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
- package/libs/PanoMeasurePlugin/Model/index.js +30 -5
- package/libs/PanoMeasurePlugin/Model/line.js +60 -10
- package/libs/PanoMeasurePlugin/Model/point.js +24 -4
- package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
- package/libs/PanoMeasurePlugin/utils/line.js +8 -7
- package/libs/PanoRulerPlugin/index.js +16 -5
- package/libs/PanoSpatialTagPlugin/index.js +11 -9
- package/libs/floorplan/Components/BaseImage.js +10 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
- package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -108
- package/libs/floorplan/utils/formatData.js +43 -28
- package/libs/floorplan/utils/formatPosition.js +1 -1
- package/libs/index.d.ts +3 -0
- package/libs/index.js +1 -1
- package/libs/shared-utils/Subscribe.js +8 -1
- package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
- package/libs/shared-utils/createCanvasTextTexture.js +6 -5
- package/libs/shared-utils/five/changeMode.js +23 -12
- package/libs/shared-utils/getPxmm.js +1 -1
- package/libs/shared-utils/math/evenNumber.js +1 -1
- package/libs/shared-utils/three/loadFbxObj.js +20 -9
- package/libs/shared-utils/three/loadTexture.js +17 -6
- package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
- package/libs/shared-utils/tinyEJSrender.js +36 -6
- package/libs/shared-utils/to.js +21 -10
- package/libs/shared-utils/useDebounce.js +1 -1
- package/libs/shared-utils/useThrottle.js +2 -1
- 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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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) => {
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
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
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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
|
|
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
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
texture
|
|
8
|
-
|
|
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
|
|
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() {
|
package/libs/shared-utils/to.js
CHANGED
|
@@ -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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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
|
|
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.
|
|
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",
|