@realsee/dnalogel 2.0.0-alpha.11 → 2.0.0-alpha.14
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/events.type.d.ts +9 -0
- package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
- package/dist/ModelItemLabelPlugin/index.js +691 -0
- package/dist/ModelItemLabelPlugin/typings.d.ts +56 -0
- package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ModelRoomLabelPlugin/index.js +68 -27
- 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 +73 -38
- 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 +4 -0
- package/dist/index.es.js +3790 -1539
- package/dist/index.js +3794 -1540
- package/dist/index.umd.js +3797 -1544
- 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 +422 -0
- package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
- package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ModelItemLabelPlugin/events.type.js +1 -0
- package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
- package/libs/ModelItemLabelPlugin/index.js +184 -0
- package/libs/ModelItemLabelPlugin/typings.d.ts +56 -0
- package/libs/ModelItemLabelPlugin/typings.js +6 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +4 -4
- 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/Components/tag.js +9 -9
- 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 +4 -0
- package/libs/index.js +2 -0
- 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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.14
|
|
4
|
+
- 1.feat: 新增 ModelTVVideoPlugin 插件;
|
|
5
|
+
- 2.fix: 修复 ModelItemLabelPlugin disable & enable 方法逻辑;
|
|
6
|
+
- 3.refactor: 增加 ModelItemLabelPlugin 类型导出。
|
|
7
|
+
|
|
8
|
+
## 2.0.0-alpha.13
|
|
9
|
+
- 1.chore: 修改 tsconfig.json target 配置项为 es6。
|
|
10
|
+
|
|
11
|
+
## 2.0.0-alpha.12
|
|
12
|
+
- 1.feat: 新增 ModelItemLabelPlugin
|
|
13
|
+
|
|
3
14
|
## 2.0.0-alpha.11
|
|
4
15
|
- 1.fix: 修复 ModelRoomLabelPlugin 未监听多楼层切换 rerender 问题。
|
|
5
16
|
- 2.feat: ModelFloorplanPlugin & TopviewFloorplanPlugin 新增 `northDesc?: string` 配置项,支持用户修改指北针名称。
|
package/README.md
CHANGED
|
@@ -1,50 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
npm install svelte
|
|
5
|
-
```
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://realsee.js.org/"><img src="https://vrlab-public.ljcdn.com/common/file/web/ea031fa5-ad82-46b3-86c8-7b20ec1e635a.jpg" width="60" /></a>
|
|
3
|
+
</p>
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@realsee/dnalogel">
|
|
7
|
+
<img src="https://img.shields.io/npm/v/@realsee/dnalogel.svg" alt="npm version" >
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://packagephobia.now.sh/result?p=@realsee/dnalogel">
|
|
10
|
+
<img src="https://packagephobia.now.sh/badge?p=@realsee/dnalogel" alt="install size" >
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://github.com/realsee-developer/dnalogel/blob/main/plugins/TERMS.txt">
|
|
13
|
+
<img src="https://img.shields.io/npm/l/@realsee/dnalogel.svg" alt="license">
|
|
14
|
+
</a>
|
|
15
|
+
</p>
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
通过 [如视开放 API](https://open-platform.realsee.com/developer/open/api/#/) 并结合 Five 的渲染能力可以制作丰富多彩的三维空间应用。
|
|
17
|
+
<h1 align="center">@realsee/dnalogel</h1>
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
# 👀 Overview
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
@realsee/dnalogel 将 [如视(realsee.com)](https://realsee.com) **VR 看房** 常用能力沉淀,并以 `Five Plugins` 形式进行抽象。
|
|
22
|
+
结合[如视 VR 看房 SDK Five](https://open-platform.realsee.com/developer/docs/front/3d-space/get-started/rendering-engine/)
|
|
23
|
+
与 [如视开放 API](https://open-platform.realsee.com/developer/open/api/#/) ,可以制作出丰富多彩的三维空间应用。不论是经过线上环境千锤百炼的刚需功能,还是灵感一现的炫酷尝试,所有已经落地的功能我们均毫无保留的开源至github [realsee-developer/dnalogel](https://github.com/realsee-developer/dnalogel) 。
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
# 🔨 Usage
|
|
17
26
|
|
|
18
|
-
|
|
27
|
+
**1、安装**
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npm install @realsee/dnalogel
|
|
31
|
+
```
|
|
21
32
|
|
|
33
|
+
```bash
|
|
34
|
+
yarn add @realsee/dnalogel
|
|
35
|
+
```
|
|
22
36
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- CameraMovementPlugin:相机运镜插件
|
|
32
|
-
- ModelFloorplanPlugin:模型户型图插件
|
|
33
|
-
- PanoRulerPlugin:全景标尺插件
|
|
34
|
-
- PanoCompassPlugin:全景指南针插件
|
|
35
|
-
- ... 待补充
|
|
37
|
+
2.x 版本依赖 `svelte`, 使用时请同时安装:
|
|
38
|
+
```bash
|
|
39
|
+
npm install svelte
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
yarn add svelte
|
|
44
|
+
```
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
**2、插件注册**
|
|
38
47
|
|
|
39
48
|
```js
|
|
40
49
|
import { Five } from '@realsee/five'
|
|
41
|
-
import Plugin from '@realsee/dnalogel
|
|
50
|
+
import { Plugin } from '@realsee/dnalogel'
|
|
42
51
|
const five = new Five({
|
|
43
52
|
plugins: [[Plugin, 'PluginName', initOptions]],
|
|
44
53
|
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**3、插件方法使用**
|
|
45
57
|
|
|
58
|
+
```js
|
|
46
59
|
// 不同插件提供的方法可能存在差异,请参考各插件 API 文档
|
|
47
60
|
five.plugins.PluginName.load(data)
|
|
48
61
|
five.plugins.PluginName.enable()
|
|
49
62
|
five.plugins.PluginName.disable()
|
|
63
|
+
five.plugins.PluginName.dispose()
|
|
50
64
|
```
|
|
65
|
+
|
|
66
|
+
**4、插件依赖数据获取**
|
|
67
|
+
|
|
68
|
+
您可以通过 [open API](https://open-platform.realsee.com/developer/open/api#/) 查看数据获取方式及相关 open API 。
|
|
69
|
+
|
|
70
|
+
# 📖 Documents
|
|
71
|
+
|
|
72
|
+
- [说明文档](https://open-platform.realsee.com/developer/docs/front/3d-space/advanced/dnalogel/ModelViewPlugin/)
|
|
73
|
+
- [API 文档](https://unpkg.com/@realsee/dnalogel/docs/index.html)
|
|
74
|
+
- [demo 源码](https://github.com/realsee-developer/dnalogel/tree/main/examples/src)
|
|
75
|
+
- [数据依赖来源:open API](https://open-platform.realsee.com/developer/open/api/)
|
|
76
|
+
- [CHANGELOG](https://github.com/realsee-developer/dnalogel/blob/main/plugins/CHANGELOG.md)
|
|
77
|
+
|
|
78
|
+
# 💡 Preview
|
|
79
|
+
|
|
80
|
+
我们为每个插件书写了简单的效果示例,您可点击预览:
|
|
81
|
+
[@realsee/dnalogel showcase](https://realsee.js.org/dnalogel/)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# 🧾 Lists
|
|
85
|
+
|
|
86
|
+
- 🔌 ModelViewPlugin:模型小窗插件
|
|
87
|
+
- 🔌 PanoFloorplanRadarPlugin:全景户型雷达图插件
|
|
88
|
+
- 🔌 ModelRoomLabelPlugin:模型态房屋标签插件
|
|
89
|
+
- 🔌 TopviewFloorplanPlugin:俯视模型户型图插件
|
|
90
|
+
- 🔌 ModelChassisCompassPlugin:模型底盘指南针插件
|
|
91
|
+
- 🔌 ModelEntryDoorGuidePlugin:模型入户门引导插件
|
|
92
|
+
- 🔌 CSS3DRenderPlugin:CSS3D渲染插件
|
|
93
|
+
- 🔌 CameraMovementPlugin:相机运镜插件
|
|
94
|
+
- 🔌 ModelFloorplanPlugin:模型户型图插件
|
|
95
|
+
- 🔌 PanoRulerPlugin:全景标尺插件
|
|
96
|
+
- 🔌 PanoCompassPlugin:全景指南针插件
|
|
97
|
+
- 其他插件持续更新中...
|
|
98
|
+
|
|
99
|
+
# License
|
|
100
|
+
[TERMS](https://github.com/realsee-developer/dnalogel/blob/main/plugins/TERMS.txt)
|
|
@@ -27,7 +27,7 @@ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
|
27
27
|
|
|
28
28
|
function evenNumber(num, config) {
|
|
29
29
|
const roundNum = Math.round(num);
|
|
30
|
-
return roundNum % 2 === 0 ? roundNum : roundNum + Number(config
|
|
30
|
+
return roundNum % 2 === 0 ? roundNum : roundNum + Number((config === null || config === void 0 ? void 0 : config.smaller) ? -1 : 1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function centerPoint(point1, point2) {
|
|
@@ -64,24 +64,25 @@ function createResizeObserver(func, element) {
|
|
|
64
64
|
const CSS3DRenderPlugin = (five) => {
|
|
65
65
|
const state = { disposeCallbacks: [] };
|
|
66
66
|
const create3DDomContainer = (...params) => {
|
|
67
|
+
var _a, _b, _c;
|
|
67
68
|
const points = params[0].map((point) => (point instanceof THREE.Vector3 ? point : transformPositionToVector3(point)));
|
|
68
69
|
const config = params[1];
|
|
69
|
-
if (points
|
|
70
|
+
if ((points === null || points === void 0 ? void 0 : points.length) < 4)
|
|
70
71
|
return console.error('points must be equal or greater than than 4');
|
|
71
|
-
if (!five
|
|
72
|
-
return console.error('five.model.loaded is: ', five
|
|
72
|
+
if (!((_a = five === null || five === void 0 ? void 0 : five.model) === null || _a === void 0 ? void 0 : _a.loaded))
|
|
73
|
+
return console.error('five.model.loaded is: ', (_b = five === null || five === void 0 ? void 0 : five.model) === null || _b === void 0 ? void 0 : _b.loaded);
|
|
73
74
|
const fiveElement = five.getElement();
|
|
74
75
|
if (!fiveElement)
|
|
75
76
|
return console.error('five.getElement() is ' + fiveElement);
|
|
76
77
|
const disposers = [];
|
|
77
|
-
const ratio = config
|
|
78
|
+
const ratio = (config === null || config === void 0 ? void 0 : config.ratio) || 0.00216;
|
|
78
79
|
if (ratio <= 0.00215)
|
|
79
80
|
console.warn('if you need click css3DElement on safari, ratio must be greater than 0.00215');
|
|
80
|
-
const dpr = config
|
|
81
|
-
const mode = config
|
|
82
|
-
const autoRender = config
|
|
83
|
-
const behindFiveContainer = config
|
|
84
|
-
const container = config
|
|
81
|
+
const dpr = (config === null || config === void 0 ? void 0 : config.dpr) || 1;
|
|
82
|
+
const mode = (config === null || config === void 0 ? void 0 : config.mode) || 'front';
|
|
83
|
+
const autoRender = (_c = config === null || config === void 0 ? void 0 : config.autoRender) !== null && _c !== void 0 ? _c : true;
|
|
84
|
+
const behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
|
|
85
|
+
const container = (config === null || config === void 0 ? void 0 : config.container) || document.createElement('div');
|
|
85
86
|
container.classList.add('__Dnalogel-plugin--CSS3DRenderPlugin');
|
|
86
87
|
// 获取css3DObject, 如果mode为behind的话,一起获取mesh
|
|
87
88
|
const { css3DObject, mesh } = createObject(points, { ratio, dpr, container, mode });
|
|
@@ -119,8 +120,9 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
119
120
|
css3DRenderer.render(scene, five.camera);
|
|
120
121
|
};
|
|
121
122
|
return () => {
|
|
123
|
+
var _a;
|
|
122
124
|
scene.add(css3DObject);
|
|
123
|
-
resizeObserver
|
|
125
|
+
(_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
|
|
124
126
|
renderEveryFrame();
|
|
125
127
|
if (mode === 'behind' && mesh) {
|
|
126
128
|
five.scene.add(mesh);
|
|
@@ -144,7 +146,8 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
144
146
|
}
|
|
145
147
|
// ======= INIT END =======
|
|
146
148
|
const dispose = () => {
|
|
147
|
-
|
|
149
|
+
var _a;
|
|
150
|
+
disposers.forEach((d) => d === null || d === void 0 ? void 0 : d());
|
|
148
151
|
scene.remove(css3DObject);
|
|
149
152
|
if (scene.children.length === 0) {
|
|
150
153
|
if (typeof stateMode.requestAnimationFrameId === 'number') {
|
|
@@ -156,7 +159,7 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
156
159
|
if (mode === 'behind')
|
|
157
160
|
state.behindMode = undefined;
|
|
158
161
|
if (!state.behindMode && !state.frontMode) {
|
|
159
|
-
resizeObserver
|
|
162
|
+
(_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
return true;
|
|
@@ -221,7 +224,7 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
221
224
|
return {
|
|
222
225
|
create3DDomContainer,
|
|
223
226
|
disposeAll: () => {
|
|
224
|
-
state.disposeCallbacks.forEach((d) => d
|
|
227
|
+
state.disposeCallbacks.forEach((d) => d === null || d === void 0 ? void 0 : d());
|
|
225
228
|
state.disposeCallbacks = [];
|
|
226
229
|
},
|
|
227
230
|
};
|
|
@@ -25,6 +25,31 @@ function _interopNamespace(e) {
|
|
|
25
25
|
|
|
26
26
|
var TWEEN__namespace = /*#__PURE__*/_interopNamespace(TWEEN);
|
|
27
27
|
|
|
28
|
+
/*! *****************************************************************************
|
|
29
|
+
Copyright (c) Microsoft Corporation.
|
|
30
|
+
|
|
31
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
32
|
+
purpose with or without fee is hereby granted.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
35
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
36
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
37
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
38
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
39
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
41
|
+
***************************************************************************** */
|
|
42
|
+
|
|
43
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
28
53
|
const _requestAnimationFrame = window.requestAnimationFrame || ((fn) => setTimeout(fn, 16));
|
|
29
54
|
const _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
|
30
55
|
function nextFrame(fn, delay = 0) {
|
|
@@ -170,21 +195,21 @@ const getLongitudeParams = (from, to, rotation) => {
|
|
|
170
195
|
*/
|
|
171
196
|
const CameraMovementPlugin = (five$1) => {
|
|
172
197
|
const state = {};
|
|
173
|
-
const move =
|
|
198
|
+
const move = (args, duration, opts = { preload: true }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
174
199
|
if (state.interruptCallback) {
|
|
175
200
|
state.interruptCallback(false);
|
|
176
201
|
}
|
|
177
202
|
if (opts.asyncStartCallback) {
|
|
178
|
-
|
|
203
|
+
yield opts.asyncStartCallback();
|
|
179
204
|
}
|
|
180
205
|
if (args.mode && args.mode !== five$1.currentMode) {
|
|
181
|
-
|
|
206
|
+
yield five$1.changeMode(args.mode);
|
|
182
207
|
}
|
|
183
208
|
if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five$1.panoIndex) {
|
|
184
|
-
|
|
209
|
+
yield five$1.preloadPano(args.panoIndex);
|
|
185
210
|
}
|
|
186
211
|
if (opts.asyncEndCallback) {
|
|
187
|
-
|
|
212
|
+
yield opts.asyncEndCallback();
|
|
188
213
|
}
|
|
189
214
|
if (args.panoIndex === undefined &&
|
|
190
215
|
args.fov === undefined &&
|
|
@@ -192,7 +217,7 @@ const CameraMovementPlugin = (five$1) => {
|
|
|
192
217
|
args.longitude === undefined) {
|
|
193
218
|
return true;
|
|
194
219
|
}
|
|
195
|
-
return
|
|
220
|
+
return yield new Promise((resolve, reject) => {
|
|
196
221
|
const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five$1.panoIndex;
|
|
197
222
|
if (panoIndex !== undefined) {
|
|
198
223
|
five$1.moveToPano(panoIndex, Object.assign({
|
|
@@ -205,7 +230,7 @@ const CameraMovementPlugin = (five$1) => {
|
|
|
205
230
|
reject(false);
|
|
206
231
|
}
|
|
207
232
|
});
|
|
208
|
-
};
|
|
233
|
+
});
|
|
209
234
|
const getAnimeParams = (args) => {
|
|
210
235
|
const currentFiveState = five$1.state;
|
|
211
236
|
// latitude
|
|
@@ -221,20 +246,20 @@ const CameraMovementPlugin = (five$1) => {
|
|
|
221
246
|
to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
|
|
222
247
|
};
|
|
223
248
|
};
|
|
224
|
-
const rotate =
|
|
249
|
+
const rotate = (args, duration, opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
225
250
|
if (state.interruptCallback) {
|
|
226
251
|
state.interruptCallback(false);
|
|
227
252
|
}
|
|
228
253
|
if (opts.asyncStartCallback) {
|
|
229
|
-
|
|
254
|
+
yield opts.asyncStartCallback();
|
|
230
255
|
}
|
|
231
256
|
if (five$1.currentMode !== five.Five.Mode.Panorama) {
|
|
232
|
-
|
|
257
|
+
yield five$1.changeMode(five.Five.Mode.Panorama);
|
|
233
258
|
}
|
|
234
259
|
if (args.panoIndex !== undefined && args.panoIndex !== five$1.panoIndex) {
|
|
235
260
|
if (opts.preload)
|
|
236
|
-
|
|
237
|
-
|
|
261
|
+
yield five$1.preloadPano(args.panoIndex);
|
|
262
|
+
yield new Promise((resolve, reject) => {
|
|
238
263
|
if (!args.panoIndex) {
|
|
239
264
|
resolve(true);
|
|
240
265
|
return;
|
|
@@ -246,10 +271,10 @@ const CameraMovementPlugin = (five$1) => {
|
|
|
246
271
|
});
|
|
247
272
|
}
|
|
248
273
|
if (opts.asyncEndCallback) {
|
|
249
|
-
|
|
274
|
+
yield opts.asyncEndCallback();
|
|
250
275
|
}
|
|
251
276
|
const { from, to } = getAnimeParams(args);
|
|
252
|
-
return
|
|
277
|
+
return yield new Promise((resolve) => {
|
|
253
278
|
const onUpdate = ({ progress }) => {
|
|
254
279
|
const state = {};
|
|
255
280
|
state.longitude = progressNumber(from.longitude, to.longitude, progress);
|
|
@@ -291,7 +316,7 @@ const CameraMovementPlugin = (five$1) => {
|
|
|
291
316
|
state.interruptCallback(true);
|
|
292
317
|
}, duration);
|
|
293
318
|
});
|
|
294
|
-
};
|
|
319
|
+
});
|
|
295
320
|
return {
|
|
296
321
|
move,
|
|
297
322
|
rotate,
|
|
@@ -25,6 +25,31 @@ function _interopNamespace(e) {
|
|
|
25
25
|
|
|
26
26
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
27
27
|
|
|
28
|
+
/*! *****************************************************************************
|
|
29
|
+
Copyright (c) Microsoft Corporation.
|
|
30
|
+
|
|
31
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
32
|
+
purpose with or without fee is hereby granted.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
35
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
36
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
37
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
38
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
39
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
41
|
+
***************************************************************************** */
|
|
42
|
+
|
|
43
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
28
53
|
const genRotationMatrix = (x, y, z) => {
|
|
29
54
|
const matrix = new THREE__namespace.Matrix4();
|
|
30
55
|
const euler = new THREE__namespace.Euler(x, y, z, 'YXZ');
|
|
@@ -55,12 +80,13 @@ const bject3d2LocalMatrix = (mesh, { scale, rotation, position, }) => {
|
|
|
55
80
|
|
|
56
81
|
function transfromToMeshBasicMaterial(object, options) {
|
|
57
82
|
object.traverse((ele) => {
|
|
83
|
+
var _a;
|
|
58
84
|
if (ele.type === 'Mesh') {
|
|
59
85
|
const mesh = ele;
|
|
60
86
|
const materialConf = Object.assign({ map: mesh.material.map || {} }, options);
|
|
61
87
|
mesh.material = new THREE.MeshBasicMaterial(materialConf);
|
|
62
88
|
mesh.renderOrder = 1;
|
|
63
|
-
if (ele.parent
|
|
89
|
+
if (((_a = ele.parent) === null || _a === void 0 ? void 0 : _a.type) === 'Mesh') {
|
|
64
90
|
ele.renderOrder = ele.parent.renderOrder + 1;
|
|
65
91
|
}
|
|
66
92
|
}
|
|
@@ -75,9 +101,9 @@ const ModelChassisCompassPlugin = (five, params) => {
|
|
|
75
101
|
const defaultNorthRad = params.north_rad || undefined;
|
|
76
102
|
// 局部状态
|
|
77
103
|
const state = {};
|
|
78
|
-
const load =
|
|
79
|
-
const fbxUrl = data
|
|
80
|
-
const northRad = data
|
|
104
|
+
const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
+
const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
|
|
106
|
+
const northRad = (data === null || data === void 0 ? void 0 : data.north_rad) || defaultNorthRad;
|
|
81
107
|
if (!northRad) {
|
|
82
108
|
throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
|
|
83
109
|
}
|
|
@@ -86,7 +112,7 @@ const ModelChassisCompassPlugin = (five, params) => {
|
|
|
86
112
|
const zOffset = bounding.max.z - bounding.min.z;
|
|
87
113
|
const maxOffset = Math.max(xOffset, zOffset);
|
|
88
114
|
const fbxLoader = new FBXLoader.FBXLoader();
|
|
89
|
-
const object =
|
|
115
|
+
const object = yield fbxLoader.loadAsync(fbxUrl);
|
|
90
116
|
transfromToMeshBasicMaterial(object, {
|
|
91
117
|
transparent: true,
|
|
92
118
|
side: THREE__namespace.DoubleSide,
|
|
@@ -100,7 +126,7 @@ const ModelChassisCompassPlugin = (five, params) => {
|
|
|
100
126
|
bject3d2LocalMatrix(object, { position, rotation, scale });
|
|
101
127
|
state.object = object;
|
|
102
128
|
return true;
|
|
103
|
-
};
|
|
129
|
+
});
|
|
104
130
|
const onCameraUpdate = ({ latitude }) => {
|
|
105
131
|
if (!state.object)
|
|
106
132
|
return;
|
|
@@ -25,12 +25,38 @@ function _interopNamespace(e) {
|
|
|
25
25
|
|
|
26
26
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
27
27
|
|
|
28
|
+
/*! *****************************************************************************
|
|
29
|
+
Copyright (c) Microsoft Corporation.
|
|
30
|
+
|
|
31
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
32
|
+
purpose with or without fee is hereby granted.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
35
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
36
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
37
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
38
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
39
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
41
|
+
***************************************************************************** */
|
|
42
|
+
|
|
43
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
28
53
|
function createCanvasTextTexture(text, config) {
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
54
|
+
var _a, _b, _c, _d, _e;
|
|
55
|
+
const size = (_a = config === null || config === void 0 ? void 0 : config.size) !== null && _a !== void 0 ? _a : 512;
|
|
56
|
+
const fontSize = (_b = config === null || config === void 0 ? void 0 : config.fontSize) !== null && _b !== void 0 ? _b : size * (35 / 256) * 1.2;
|
|
57
|
+
const backgroundColor = (_c = config === null || config === void 0 ? void 0 : config.backgroundColor) !== null && _c !== void 0 ? _c : 'rgba(0,0,0,0)';
|
|
58
|
+
const fontColor = (_d = config === null || config === void 0 ? void 0 : config.fontColor) !== null && _d !== void 0 ? _d : '#fff';
|
|
59
|
+
const textAlign = (_e = config === null || config === void 0 ? void 0 : config.textAlign) !== null && _e !== void 0 ? _e : 'center';
|
|
34
60
|
const canvas = document.createElement('canvas');
|
|
35
61
|
canvas.setAttribute('width', size + '');
|
|
36
62
|
canvas.setAttribute('height', size + '');
|
|
@@ -48,12 +74,13 @@ const transformPositionToVector3 = ({ x, y, z }) => new THREE.Vector3(x, y, z);
|
|
|
48
74
|
|
|
49
75
|
function transfromToMeshBasicMaterial(object, options) {
|
|
50
76
|
object.traverse((ele) => {
|
|
77
|
+
var _a;
|
|
51
78
|
if (ele.type === 'Mesh') {
|
|
52
79
|
const mesh = ele;
|
|
53
80
|
const materialConf = Object.assign({ map: mesh.material.map || {} }, options);
|
|
54
81
|
mesh.material = new THREE.MeshBasicMaterial(materialConf);
|
|
55
82
|
mesh.renderOrder = 1;
|
|
56
|
-
if (ele.parent
|
|
83
|
+
if (((_a = ele.parent) === null || _a === void 0 ? void 0 : _a.type) === 'Mesh') {
|
|
57
84
|
ele.renderOrder = ele.parent.renderOrder + 1;
|
|
58
85
|
}
|
|
59
86
|
}
|
|
@@ -64,31 +91,33 @@ function transfromToMeshBasicMaterial(object, options) {
|
|
|
64
91
|
* 模型入户门引导插件
|
|
65
92
|
*/
|
|
66
93
|
const ModelEntryDoorGuidePlugin = (five, params) => {
|
|
94
|
+
var _a, _b, _c;
|
|
67
95
|
// 局部状态
|
|
68
96
|
const state = {};
|
|
69
|
-
const defaultAnimationEnable = params.animationEnabled
|
|
70
|
-
const defaultModelPosition = params.position
|
|
71
|
-
const defaultRad = params.rad
|
|
97
|
+
const defaultAnimationEnable = (_a = params.animationEnabled) !== null && _a !== void 0 ? _a : true;
|
|
98
|
+
const defaultModelPosition = (_b = params.position) !== null && _b !== void 0 ? _b : undefined;
|
|
99
|
+
const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
|
|
72
100
|
const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
|
|
73
101
|
const mixers = [];
|
|
74
|
-
const load =
|
|
75
|
-
|
|
102
|
+
const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
104
|
+
const position = (_d = data === null || data === void 0 ? void 0 : data.position) !== null && _d !== void 0 ? _d : defaultModelPosition;
|
|
76
105
|
if (!position)
|
|
77
106
|
return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
|
|
78
107
|
const modelPosition = transformPositionToVector3(position);
|
|
79
|
-
const rad = data
|
|
80
|
-
const fbxUrl = data
|
|
108
|
+
const rad = (_e = data === null || data === void 0 ? void 0 : data.rad) !== null && _e !== void 0 ? _e : defaultRad;
|
|
109
|
+
const fbxUrl = (_f = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _f !== void 0 ? _f : defaultFbxUrl;
|
|
81
110
|
state.rad = rad;
|
|
82
111
|
if (rad === undefined)
|
|
83
112
|
return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
|
|
84
113
|
// 加载模型
|
|
85
|
-
const object =
|
|
114
|
+
const object = yield new FBXLoader.FBXLoader().loadAsync(fbxUrl);
|
|
86
115
|
// 设置位置
|
|
87
116
|
object.position.copy(modelPosition);
|
|
88
117
|
object.rotation.z = rad;
|
|
89
118
|
object.scale.set(0.8, 0.8, 0.8);
|
|
90
119
|
transfromToMeshBasicMaterial(object, { transparent: true, side: THREE__namespace.DoubleSide });
|
|
91
|
-
const textMesh = object.children
|
|
120
|
+
const textMesh = (_k = (_j = (_h = (_g = object.children) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j[3]) === null || _k === void 0 ? void 0 : _k.clone();
|
|
92
121
|
if (!textMesh)
|
|
93
122
|
return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
|
|
94
123
|
textMesh.material = new THREE.MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
|
|
@@ -96,7 +125,7 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
|
|
|
96
125
|
object.children[0].add(textMesh);
|
|
97
126
|
state.object = object;
|
|
98
127
|
return true;
|
|
99
|
-
};
|
|
128
|
+
});
|
|
100
129
|
const initAnimation = () => {
|
|
101
130
|
if (state.animation)
|
|
102
131
|
return;
|
|
@@ -140,16 +169,17 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
|
|
|
140
169
|
};
|
|
141
170
|
const stop = () => {
|
|
142
171
|
action.stop();
|
|
143
|
-
stopAnimation
|
|
172
|
+
stopAnimation === null || stopAnimation === void 0 ? void 0 : stopAnimation();
|
|
144
173
|
stopAnimation = undefined;
|
|
145
174
|
};
|
|
146
175
|
const animation = { play, stop };
|
|
147
176
|
state.animation = animation;
|
|
148
177
|
};
|
|
149
178
|
const show = (config) => {
|
|
179
|
+
var _a;
|
|
150
180
|
if (!state.object)
|
|
151
181
|
return console.error('ModelEntryDoorGuidePlugin.enable(): object is ', state.object);
|
|
152
|
-
const animationEnable = config
|
|
182
|
+
const animationEnable = (_a = config === null || config === void 0 ? void 0 : config.animationEnable) !== null && _a !== void 0 ? _a : defaultAnimationEnable;
|
|
153
183
|
if (animationEnable) {
|
|
154
184
|
if (!state.animation)
|
|
155
185
|
initAnimation();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SubscribeEventMap } from '@realsee/five';
|
|
2
|
+
import { ItemLabel } from "./typings";
|
|
3
|
+
export interface ItemLabelEvent extends SubscribeEventMap {
|
|
4
|
+
/**
|
|
5
|
+
* 点击标签
|
|
6
|
+
*/
|
|
7
|
+
onLabelClick: (itemLabel: ItemLabel) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare type PluginEvent = ItemLabelEvent;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FivePlugin } from "@realsee/five";
|
|
2
|
+
import { ModelItemLabelPluginExportReturnsType, ModelItemLabelPluginParametersType } from "./typings";
|
|
3
|
+
export declare const ModelItemLabelPlugin: FivePlugin<ModelItemLabelPluginParametersType, ModelItemLabelPluginExportReturnsType>;
|
|
4
|
+
export default ModelItemLabelPlugin;
|