@realsee/dnalogel 2.0.0-alpha.13 → 2.0.0-alpha.16
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 +56 -0
- package/README.md +78 -28
- package/dist/ModelItemLabelPlugin/index.js +72 -83
- package/dist/ModelItemLabelPlugin/typings.d.ts +2 -1
- package/dist/ModelRoomLabelPlugin/index.js +1 -0
- 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/PanoMeasurePlugin/index.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +349 -86
- package/dist/index.js +349 -85
- package/dist/index.umd.js +349 -85
- package/docs/assets/main.js +1 -1
- 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/ModelItemLabelPlugin/ItemLabelComponent.js +48 -61
- package/libs/ModelItemLabelPlugin/index.js +5 -57
- package/libs/ModelItemLabelPlugin/typings.d.ts +2 -1
- package/libs/ModelItemLabelPlugin/typings.js +1 -0
- package/libs/ModelRoomLabelPlugin/Controller.js +1 -0
- 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/index.d.ts +3 -0
- package/libs/index.js +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 2.0.0-alpha.16
|
|
4
|
+
- 1.fix: 修复 z-index 问题;
|
|
5
|
+
- 2.fix: 修复 ModelItemLabelPlugin 事件监听问题。
|
|
6
|
+
|
|
7
|
+
## 2.0.0-alpha.15
|
|
8
|
+
- 1.refactor: 优化 ModelItemLabelPlugin 在调用 five.setState() 时的动画显示。
|
|
9
|
+
|
|
10
|
+
## 2.0.0-alpha.14
|
|
11
|
+
- 1.feat: 新增 ModelTVVideoPlugin 插件;
|
|
12
|
+
- 2.fix: 修复 ModelItemLabelPlugin disable & enable 方法逻辑;
|
|
13
|
+
- 3.refactor: 增加 ModelItemLabelPlugin 类型导出。
|
|
14
|
+
|
|
15
|
+
## 2.0.0-alpha.13
|
|
16
|
+
- 1.chore: 修改 tsconfig.json target 配置项为 es6。
|
|
17
|
+
|
|
18
|
+
## 2.0.0-alpha.12
|
|
19
|
+
- 1.feat: 新增 ModelItemLabelPlugin
|
|
20
|
+
|
|
21
|
+
## 2.0.0-alpha.11
|
|
22
|
+
- 1.fix: 修复 ModelRoomLabelPlugin 未监听多楼层切换 rerender 问题。
|
|
23
|
+
- 2.feat: ModelFloorplanPlugin & TopviewFloorplanPlugin 新增 `northDesc?: string` 配置项,支持用户修改指北针名称。
|
|
24
|
+
|
|
25
|
+
## 2.0.0-alpha.10
|
|
26
|
+
- 1.feat: 新增空间三维标签插件 PanoSpatialTagPlugin
|
|
27
|
+
- 2.feat: 新增轻量 ejs 渲染模板函数 shared-utils/tinyEJSrender.js
|
|
28
|
+
|
|
29
|
+
## 2.0.0-alpha.9
|
|
30
|
+
- 1.refactor: 增加插件独立 js 输出及对 svelte 的编译。
|
|
31
|
+
|
|
32
|
+
## 2.0.0-alpha.8
|
|
33
|
+
- 1.fix: 修复 ModelViewPlugin 实景 VR 模型不居中问题;
|
|
34
|
+
- 2.fix: 修复 ModelRoomLabelPlugin fov 更新未 rerender 问题;
|
|
35
|
+
- 2.fix: 修复 ModelRoomLabelPlugin enable 判断问题;
|
|
36
|
+
- 4.fix: 修改 ModelFloorplanPlugin 在全景态满足户型图的俯仰角时会自动切换户型图问题。
|
|
37
|
+
|
|
38
|
+
## 2.0.0-alpha.7
|
|
39
|
+
- 1.fix: PanoCompassPlugin 向下兼容;
|
|
40
|
+
- 2.feat: 新增 PC 全景测量插件:PanoMeasurePlugin;
|
|
41
|
+
- 3.docs: 修改 README.md;
|
|
42
|
+
|
|
43
|
+
## 2.0.0-alpha.6
|
|
44
|
+
- 1.fix: 标尺插件 PanoRulerPlugin 所有标尺仅展示一次问题;
|
|
45
|
+
- 2.fix: TopviewFloorplanPlugin && ModelFloorplanPlugin 插件小雷达位置显示不正确问题;
|
|
46
|
+
- 3.feat: 为 TopviewFloorplanPlugin && ModelFloorplanPlugin 插件新增线框图吸附位置配置选项。
|
|
47
|
+
- 可选地板、天花板、模型中心,默认吸附选项为模型中心。
|
|
48
|
+
|
|
49
|
+
## 2.0.0-alpha.5
|
|
50
|
+
1.修复全景指南针插件 PanoCompassPlugin 默认导出 name
|
|
51
|
+
|
|
52
|
+
## 2.0.0-alpha.4
|
|
53
|
+
1.新增全景标尺插件 PanoRulerPlugin
|
|
54
|
+
|
|
55
|
+
## 2.0.0-alpha.3
|
|
56
|
+
1.新增全景指南针插件 PanoCompassPlugin
|
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)
|
|
@@ -36,6 +36,7 @@ var DISPLAY_STRATEGY_TYPE;
|
|
|
36
36
|
DISPLAY_STRATEGY_TYPE["SMALL"] = "small";
|
|
37
37
|
DISPLAY_STRATEGY_TYPE["MIDLLE"] = "middle";
|
|
38
38
|
DISPLAY_STRATEGY_TYPE["LARGE"] = "large";
|
|
39
|
+
DISPLAY_STRATEGY_TYPE["EXTRA_LARGE"] = "x-large";
|
|
39
40
|
})(DISPLAY_STRATEGY_TYPE || (DISPLAY_STRATEGY_TYPE = {}));
|
|
40
41
|
|
|
41
42
|
/* src/ModelItemLabelPlugin/ItemLabelItem.svelte generated by Svelte v3.47.0 */
|
|
@@ -149,6 +150,21 @@ class ItemLabelItem extends internal.SvelteComponent {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
/**
|
|
154
|
+
* 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
|
|
155
|
+
* @param func - 要防抖动的函数
|
|
156
|
+
* @param [wait=0] - 需要延迟的毫秒数
|
|
157
|
+
*/
|
|
158
|
+
function debounce(func, wait = 200) {
|
|
159
|
+
let last;
|
|
160
|
+
return function (...args) {
|
|
161
|
+
clearTimeout(last);
|
|
162
|
+
last = setTimeout(() => {
|
|
163
|
+
func(...args);
|
|
164
|
+
}, wait);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
152
168
|
/* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
153
169
|
|
|
154
170
|
function add_css(target) {
|
|
@@ -157,11 +173,11 @@ function add_css(target) {
|
|
|
157
173
|
|
|
158
174
|
function get_each_context(ctx, list, i) {
|
|
159
175
|
const child_ctx = ctx.slice();
|
|
160
|
-
child_ctx[
|
|
176
|
+
child_ctx[28] = list[i];
|
|
161
177
|
return child_ctx;
|
|
162
178
|
}
|
|
163
179
|
|
|
164
|
-
// (
|
|
180
|
+
// (162:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
165
181
|
function create_each_block(key_1, ctx) {
|
|
166
182
|
let first;
|
|
167
183
|
let itemlabelitem;
|
|
@@ -169,7 +185,7 @@ function create_each_block(key_1, ctx) {
|
|
|
169
185
|
|
|
170
186
|
itemlabelitem = new ItemLabelItem({
|
|
171
187
|
props: {
|
|
172
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
188
|
+
itemLabel: /*itemLabelItem*/ ctx[28],
|
|
173
189
|
hooks: /*hooks*/ ctx[0]
|
|
174
190
|
}
|
|
175
191
|
});
|
|
@@ -190,7 +206,7 @@ function create_each_block(key_1, ctx) {
|
|
|
190
206
|
p(new_ctx, dirty) {
|
|
191
207
|
ctx = new_ctx;
|
|
192
208
|
const itemlabelitem_changes = {};
|
|
193
|
-
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
209
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[28];
|
|
194
210
|
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
195
211
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
196
212
|
},
|
|
@@ -217,7 +233,7 @@ function create_fragment(ctx) {
|
|
|
217
233
|
let div_resize_listener;
|
|
218
234
|
let current;
|
|
219
235
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
220
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
236
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[28].id;
|
|
221
237
|
|
|
222
238
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
223
239
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -234,7 +250,8 @@ function create_fragment(ctx) {
|
|
|
234
250
|
}
|
|
235
251
|
|
|
236
252
|
internal.attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
237
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
253
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
|
|
254
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
238
255
|
},
|
|
239
256
|
m(target, anchor) {
|
|
240
257
|
internal.insert(target, div, anchor);
|
|
@@ -243,7 +260,7 @@ function create_fragment(ctx) {
|
|
|
243
260
|
each_blocks[i].m(div, null);
|
|
244
261
|
}
|
|
245
262
|
|
|
246
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
263
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
|
|
247
264
|
current = true;
|
|
248
265
|
},
|
|
249
266
|
p(ctx, [dirty]) {
|
|
@@ -253,6 +270,10 @@ function create_fragment(ctx) {
|
|
|
253
270
|
each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, internal.outro_and_destroy_block, create_each_block, null, get_each_context);
|
|
254
271
|
internal.check_outros();
|
|
255
272
|
}
|
|
273
|
+
|
|
274
|
+
if (dirty & /*itemsVisible*/ 16) {
|
|
275
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
276
|
+
}
|
|
256
277
|
},
|
|
257
278
|
i(local) {
|
|
258
279
|
if (current) return;
|
|
@@ -302,6 +323,14 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
302
323
|
// 计算重叠
|
|
303
324
|
let cssOffsetLists = [];
|
|
304
325
|
|
|
326
|
+
// 动画过程中 itemsVisible 为 false
|
|
327
|
+
let itemsVisible = true;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 可见性策略:
|
|
331
|
+
* 1、当前楼层(假设先不考虑多楼层)
|
|
332
|
+
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
333
|
+
* */
|
|
305
334
|
const getLabelVisible = (five, itemLabel) => {
|
|
306
335
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
307
336
|
const raycaster = new Raycaster();
|
|
@@ -355,6 +384,8 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
355
384
|
return Math.ceil(-38.9 * itemSpaceHeight + 130);
|
|
356
385
|
case DISPLAY_STRATEGY_TYPE.LARGE:
|
|
357
386
|
return Math.ceil(-44.44 * itemSpaceHeight + 140);
|
|
387
|
+
case DISPLAY_STRATEGY_TYPE.EXTRA_LARGE:
|
|
388
|
+
return Math.ceil(-92.59 * itemSpaceHeight + 300);
|
|
358
389
|
}
|
|
359
390
|
}
|
|
360
391
|
|
|
@@ -401,15 +432,27 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
401
432
|
addDataUpdateListener();
|
|
402
433
|
});
|
|
403
434
|
|
|
435
|
+
const handleCameraUpdateCallback = () => {
|
|
436
|
+
$$invalidate(4, itemsVisible = false);
|
|
437
|
+
handleCameraUpdate();
|
|
438
|
+
};
|
|
439
|
+
|
|
404
440
|
svelte.onMount(() => {
|
|
405
441
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
406
442
|
curItemLabels = itemLabels;
|
|
407
443
|
onItemLabelUpdate();
|
|
408
|
-
|
|
409
|
-
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
410
444
|
addResizeListener();
|
|
445
|
+
five.on('cameraUpdate', handleCameraUpdateCallback);
|
|
411
446
|
});
|
|
412
447
|
|
|
448
|
+
const handleCameraUpdate = debounce(
|
|
449
|
+
() => {
|
|
450
|
+
$$invalidate(4, itemsVisible = true);
|
|
451
|
+
onItemLabelUpdate();
|
|
452
|
+
},
|
|
453
|
+
300
|
|
454
|
+
);
|
|
455
|
+
|
|
413
456
|
const addResizeListener = () => {
|
|
414
457
|
wrapperSize = {
|
|
415
458
|
width: wrapper.clientWidth,
|
|
@@ -423,7 +466,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
423
466
|
if (curItemLabels !== itemLabels) {
|
|
424
467
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
425
468
|
curItemLabels = itemLabels;
|
|
426
|
-
console.log('--debug--update--');
|
|
427
469
|
onItemLabelUpdate();
|
|
428
470
|
}
|
|
429
471
|
};
|
|
@@ -441,13 +483,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
441
483
|
});
|
|
442
484
|
|
|
443
485
|
svelte.onDestroy(() => {
|
|
444
|
-
|
|
486
|
+
five.off('cameraUpdate', handleCameraUpdateCallback);
|
|
445
487
|
resizeObserver.unobserve(wrapper);
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
wrapperSize = { width: 0, height: 0 };
|
|
450
|
-
});
|
|
488
|
+
}); // curItemLabels = null
|
|
489
|
+
// renderItemLabels = null
|
|
490
|
+
// wrapperSize = { width: 0, height: 0 }
|
|
451
491
|
|
|
452
492
|
function div_elementresize_handler() {
|
|
453
493
|
containerWidth = this.clientWidth;
|
|
@@ -457,12 +497,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
457
497
|
}
|
|
458
498
|
|
|
459
499
|
$$self.$$set = $$props => {
|
|
460
|
-
if ('five' in $$props) $$invalidate(
|
|
461
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
462
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
463
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
500
|
+
if ('five' in $$props) $$invalidate(5, five = $$props.five);
|
|
501
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
502
|
+
if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
|
|
503
|
+
if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
|
|
464
504
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
465
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
505
|
+
if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
|
|
466
506
|
};
|
|
467
507
|
|
|
468
508
|
return [
|
|
@@ -470,6 +510,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
470
510
|
renderItemLabels,
|
|
471
511
|
containerWidth,
|
|
472
512
|
containerHeight,
|
|
513
|
+
itemsVisible,
|
|
473
514
|
five,
|
|
474
515
|
modelOcclusionEnable,
|
|
475
516
|
itemLabels,
|
|
@@ -490,12 +531,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
|
|
|
490
531
|
create_fragment,
|
|
491
532
|
internal.safe_not_equal,
|
|
492
533
|
{
|
|
493
|
-
five:
|
|
494
|
-
modelOcclusionEnable:
|
|
495
|
-
itemLabels:
|
|
496
|
-
wrapper:
|
|
534
|
+
five: 5,
|
|
535
|
+
modelOcclusionEnable: 6,
|
|
536
|
+
itemLabels: 7,
|
|
537
|
+
wrapper: 8,
|
|
497
538
|
hooks: 0,
|
|
498
|
-
displayStrategyType:
|
|
539
|
+
displayStrategyType: 9
|
|
499
540
|
},
|
|
500
541
|
add_css
|
|
501
542
|
);
|
|
@@ -519,7 +560,7 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
519
560
|
app: undefined,
|
|
520
561
|
hooks: new five.Subscribe(),
|
|
521
562
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
522
|
-
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL
|
|
563
|
+
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
523
564
|
};
|
|
524
565
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
525
566
|
pluginState.container.style.cssText = `
|
|
@@ -528,8 +569,9 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
528
569
|
top: 0;
|
|
529
570
|
width: 100%;
|
|
530
571
|
height: 100%;
|
|
531
|
-
|
|
572
|
+
z-index: 5;
|
|
532
573
|
`;
|
|
574
|
+
pluginState.container.style.pointerEvents = 'none'; // 写到 cssText 里不生效
|
|
533
575
|
const appendTo = (wrapper) => {
|
|
534
576
|
pluginState.wrapper = wrapper;
|
|
535
577
|
wrapper.appendChild(pluginState.container);
|
|
@@ -537,7 +579,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
537
579
|
return true;
|
|
538
580
|
};
|
|
539
581
|
const load = (data) => {
|
|
540
|
-
console.log('🐶--当前标签总条数: ', data.model_item_labels.length);
|
|
541
582
|
pluginState.itemLabels = parseModelItemLabelPluginData(data);
|
|
542
583
|
render();
|
|
543
584
|
};
|
|
@@ -559,40 +600,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
559
600
|
removeListener4Five();
|
|
560
601
|
pluginState.container.remove();
|
|
561
602
|
};
|
|
562
|
-
const handleRerender = () => {
|
|
563
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled)
|
|
564
|
-
return;
|
|
565
|
-
disable();
|
|
566
|
-
};
|
|
567
|
-
const rerender = (a, b, c) => {
|
|
568
|
-
if (!pluginState.fiveModeEnabled)
|
|
569
|
-
return;
|
|
570
|
-
if (!c)
|
|
571
|
-
return;
|
|
572
|
-
enable();
|
|
573
|
-
render();
|
|
574
|
-
};
|
|
575
|
-
const handleInteriaPanRerender = (a, b) => {
|
|
576
|
-
if (!pluginState.fiveModeEnabled)
|
|
577
|
-
return;
|
|
578
|
-
if (!b)
|
|
579
|
-
return;
|
|
580
|
-
enable();
|
|
581
|
-
render();
|
|
582
|
-
};
|
|
583
|
-
const handleWantsPanGesture = (pose, final) => {
|
|
584
|
-
if (pose) {
|
|
585
|
-
handleRerender();
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
const handlePanGesture = (pose, final) => {
|
|
589
|
-
if (!pluginState.fiveModeEnabled)
|
|
590
|
-
return;
|
|
591
|
-
if (!final)
|
|
592
|
-
return;
|
|
593
|
-
enable();
|
|
594
|
-
render();
|
|
595
|
-
};
|
|
596
603
|
const render = () => {
|
|
597
604
|
var _a;
|
|
598
605
|
if (!pluginState.wrapper)
|
|
@@ -628,32 +635,14 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
628
635
|
const addListener4Five = () => {
|
|
629
636
|
five$1.on('modeChange', onFiveModeChange);
|
|
630
637
|
five$1.once('dispose', dispose);
|
|
631
|
-
// five.on('wantsGesture', handleRerender)
|
|
632
|
-
// five.on('gesture', rerender)
|
|
633
|
-
five$1.on('wantsMouseWheel', handleRerender);
|
|
634
|
-
five$1.on('mouseWheel', rerender);
|
|
635
|
-
five$1.on('wantsInteriaPan', handleRerender);
|
|
636
|
-
five$1.on('interiaPan', handleInteriaPanRerender);
|
|
637
|
-
five$1.on('wantsPanGesture', handleWantsPanGesture);
|
|
638
|
-
five$1.on('panGesture', handlePanGesture);
|
|
639
|
-
five$1.on('wantsPinchGesture', handleRerender);
|
|
640
|
-
five$1.on('pinchGesture', rerender);
|
|
641
638
|
};
|
|
642
639
|
// 取消 five 监听
|
|
643
640
|
const removeListener4Five = () => {
|
|
644
641
|
five$1.off('modeChange', onFiveModeChange);
|
|
645
|
-
// five.off('wantsGesture', handleRerender)
|
|
646
|
-
// five.off('gesture', rerender)
|
|
647
|
-
five$1.off('wantsMouseWheel', handleRerender);
|
|
648
|
-
five$1.off('mouseWheel', rerender);
|
|
649
|
-
five$1.off('wantsInteriaPan', handleRerender);
|
|
650
|
-
five$1.off('interiaPan', handleInteriaPanRerender);
|
|
651
|
-
five$1.off('wantsPanGesture', handleWantsPanGesture);
|
|
652
|
-
five$1.off('panGesture', handlePanGesture);
|
|
653
|
-
five$1.off('wantsPinchGesture', handleRerender);
|
|
654
|
-
five$1.off('pinchGesture', rerender);
|
|
655
642
|
};
|
|
656
643
|
const onFiveModeChange = (mode) => {
|
|
644
|
+
if (!pluginState.enabled)
|
|
645
|
+
return;
|
|
657
646
|
if (mode !== five.Five.Mode.Floorplan) {
|
|
658
647
|
pluginState.fiveModeEnabled = false;
|
|
659
648
|
render();
|
|
@@ -4,7 +4,8 @@ import { PluginEvent } from "./events.type";
|
|
|
4
4
|
export declare enum DISPLAY_STRATEGY_TYPE {
|
|
5
5
|
SMALL = "small",
|
|
6
6
|
MIDLLE = "middle",
|
|
7
|
-
LARGE = "large"
|
|
7
|
+
LARGE = "large",
|
|
8
|
+
EXTRA_LARGE = "x-large"
|
|
8
9
|
}
|
|
9
10
|
export interface ModelItemLabelPluginParametersType {
|
|
10
11
|
modelOcclusionEnable?: boolean;
|
|
@@ -425,6 +425,7 @@ class ModelRoomLabelController {
|
|
|
425
425
|
this.container.style.pointerEvents = 'none';
|
|
426
426
|
this.container.style.left = '0';
|
|
427
427
|
this.container.style.top = '0';
|
|
428
|
+
this.container.style.zIndex = '5';
|
|
428
429
|
// five listener
|
|
429
430
|
this.five.once('dispose', () => this.dispose());
|
|
430
431
|
this.five.on('modeChange', this.onFiveModeChange);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FivePlugin } from '@realsee/five';
|
|
2
|
+
import { ModelTVVideoPluginExportType, ModelTVVideoPluginParameterType } from "./typings";
|
|
3
|
+
export declare const ModelTVVideoPlugin: FivePlugin<ModelTVVideoPluginParameterType, ModelTVVideoPluginExportType>;
|
|
4
|
+
export default ModelTVVideoPlugin;
|