@realsee/dnalogel 2.0.0-alpha.21 → 2.0.0-alpha.24
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 +10 -0
- package/dist/PanoMeasurePlugin/index.js +6 -1
- package/dist/PanoRulerPlugin/index.js +5 -3
- package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +1 -2
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +47 -41
- package/dist/index.es.js +58 -45
- package/dist/index.js +58 -45
- package/dist/index.umd.js +58 -45
- 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/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 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- 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 +8 -8
- package/docs/modules.html +12 -12
- package/libs/PanoMeasurePlugin/Controller/index.js +5 -0
- package/libs/PanoMeasurePlugin/index.js +1 -1
- package/libs/PanoRulerPlugin/index.js +5 -3
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +46 -30
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +1 -2
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +1 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.24
|
|
4
|
+
- 1.feat: PanoRulerPlugin 支持数据 reload。
|
|
5
|
+
|
|
6
|
+
## 2.0.0-alpha.23
|
|
7
|
+
- 1.fix: 修复 PanoFloorplanRadarPlugin reload 数据时报错
|
|
8
|
+
- 2.fix: 修复 PanoFloorplanRadarPlugin reload 户型图数据后雷达图标位置没有适配
|
|
9
|
+
|
|
10
|
+
## 2.0.0-alpha.22
|
|
11
|
+
- 1.fix: 修复 PanoMeasurePlugin disable 状态下仍有背景色占位问题。
|
|
12
|
+
|
|
3
13
|
## 2.0.0-alpha.21
|
|
4
14
|
- 1.fix: 修复 PanoMeasurePlugin 仅初始化 UI 面板仍占位为题。
|
|
5
15
|
|
|
@@ -5407,6 +5407,7 @@ class MeasureController {
|
|
|
5407
5407
|
this.container.style.pointerEvents = 'none';
|
|
5408
5408
|
this.container.style.width = '100%';
|
|
5409
5409
|
this.container.style.height = '100%';
|
|
5410
|
+
this.container.style.opacity = '0';
|
|
5410
5411
|
this.container.style.background = 'rgba(0, 0, 0, 0.15)';
|
|
5411
5412
|
this.controllerParams = {
|
|
5412
5413
|
five: this.five,
|
|
@@ -5452,6 +5453,8 @@ class MeasureController {
|
|
|
5452
5453
|
return;
|
|
5453
5454
|
this.hasOpen = true;
|
|
5454
5455
|
this.five.scene.add(this.group);
|
|
5456
|
+
// 修改透明度
|
|
5457
|
+
this.container.style.opacity = '1';
|
|
5455
5458
|
// 隐藏点位和鼠标聚焦环
|
|
5456
5459
|
this.five.helperVisible = false;
|
|
5457
5460
|
this.controller = new WatchController(this.controllerParams);
|
|
@@ -5467,6 +5470,8 @@ class MeasureController {
|
|
|
5467
5470
|
disable() {
|
|
5468
5471
|
var _a, _b, _c, _d;
|
|
5469
5472
|
this.hasOpen = false;
|
|
5473
|
+
// 修改透明度
|
|
5474
|
+
this.container.style.opacity = '0';
|
|
5470
5475
|
// 展示点位和鼠标聚焦环
|
|
5471
5476
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5472
5477
|
(_b = this.useUIController) === null || _b === void 0 ? void 0 : _b.hide();
|
|
@@ -5519,7 +5524,7 @@ class MeasureController {
|
|
|
5519
5524
|
}
|
|
5520
5525
|
}
|
|
5521
5526
|
|
|
5522
|
-
const PanoMeasurePlugin = function
|
|
5527
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
5523
5528
|
return new MeasureController(five, params);
|
|
5524
5529
|
};
|
|
5525
5530
|
|
|
@@ -296,9 +296,9 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
296
296
|
$rule.appendChild(style);
|
|
297
297
|
const __rule = {};
|
|
298
298
|
const _load = (roomInfo, roomRules) => {
|
|
299
|
-
if (state.loaded) {
|
|
300
|
-
|
|
301
|
-
}
|
|
299
|
+
// if (state.loaded) {
|
|
300
|
+
// throw new Error('标尺被重复初始化!')
|
|
301
|
+
// }
|
|
302
302
|
const roomHeightInfo = getRoomHeightInfo(roomInfo, five$1);
|
|
303
303
|
const work = five$1.work;
|
|
304
304
|
if (!work)
|
|
@@ -374,6 +374,7 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
state.loaded = true;
|
|
377
|
+
freshRule();
|
|
377
378
|
return true;
|
|
378
379
|
};
|
|
379
380
|
const load = async (_roomInfo, _roomRules, options) => {
|
|
@@ -382,6 +383,7 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
382
383
|
if (!roomInfo || !roomRules) {
|
|
383
384
|
throw new Error('标尺数据依赖不齐全!');
|
|
384
385
|
}
|
|
386
|
+
state.loaded = false;
|
|
385
387
|
state.options = Object.assign({}, state.options, options || {});
|
|
386
388
|
if (five$1.model.loaded) {
|
|
387
389
|
return _load(roomInfo, roomRules);
|
|
@@ -14,8 +14,7 @@ export default class PanoFloorplanRadarPluginController {
|
|
|
14
14
|
private wrapperSelector;
|
|
15
15
|
private data?;
|
|
16
16
|
private wrapper;
|
|
17
|
-
private extraObjects
|
|
18
|
-
private originExtraObjects?;
|
|
17
|
+
private extraObjects;
|
|
19
18
|
private configs;
|
|
20
19
|
constructor(five: Five, params?: PanoFloorplanRadarPluginControllerParameter);
|
|
21
20
|
dispose: () => void;
|
|
@@ -75,58 +75,54 @@ function create_fragment$8(ctx) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function getCameraRotateTransform(longitude) {
|
|
79
|
+
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
80
|
+
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
81
|
+
|
|
82
|
+
return `rotate(${rotate}deg)`;
|
|
83
|
+
}
|
|
84
|
+
|
|
78
85
|
function instance$8($$self, $$props, $$invalidate) {
|
|
86
|
+
let positionTransform;
|
|
87
|
+
let rotateTransform;
|
|
79
88
|
let { five } = $$props;
|
|
80
89
|
let { pxmm } = $$props;
|
|
81
90
|
let { floorplanData } = $$props;
|
|
82
91
|
let { cameraImageUrl } = $$props;
|
|
92
|
+
let panoIndex = five.getCurrentState().panoIndex;
|
|
93
|
+
let longitude = five.getCurrentState().longitude;
|
|
83
94
|
|
|
84
95
|
/** 获取相机在当前 Five 状态下的位移 */
|
|
85
|
-
function getCameraPositionTransform(panoIndex) {
|
|
86
|
-
const observer = floorplanData.observers[panoIndex];
|
|
96
|
+
function getCameraPositionTransform(floorplanData, panoIndex) {
|
|
87
97
|
const bounding = floorplanData.bounding;
|
|
98
|
+
const floorplanObserver = floorplanData.observers[panoIndex];
|
|
99
|
+
if (!floorplanObserver) return '';
|
|
88
100
|
const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
|
|
89
101
|
const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
const top = Math.floor(observer.positionInImage.y * clientHeight);
|
|
102
|
+
const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
|
|
103
|
+
const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
|
|
93
104
|
return `translate(${left}px, ${top}px)`;
|
|
94
105
|
}
|
|
95
106
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const { longitude } = five.getCurrentState();
|
|
99
|
-
|
|
100
|
-
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
101
|
-
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
102
|
-
|
|
103
|
-
return `rotate(${rotate}deg)`;
|
|
107
|
+
function onFivePanoWillArrive(_panoIndex) {
|
|
108
|
+
$$invalidate(6, panoIndex = _panoIndex);
|
|
104
109
|
}
|
|
105
110
|
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const changeRotate = throttle(
|
|
111
|
-
() => {
|
|
112
|
-
$$invalidate(1, rotateTransform = getCameraRotationTransform());
|
|
111
|
+
const onFiveCameraDirectionUpdate = throttle(
|
|
112
|
+
pose => {
|
|
113
|
+
$$invalidate(7, longitude = pose.longitude);
|
|
113
114
|
},
|
|
114
115
|
1000 / 60
|
|
115
116
|
);
|
|
116
117
|
|
|
117
|
-
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
118
|
-
let rotateTransform = getCameraRotationTransform();
|
|
119
|
-
|
|
120
|
-
let positionTransform = getCameraPositionTransform(five.getCurrentState().panoIndex);
|
|
121
|
-
|
|
122
118
|
svelte.onMount(() => {
|
|
123
|
-
five.on('panoWillArrive',
|
|
124
|
-
five.on('cameraDirectionUpdate',
|
|
119
|
+
five.on('panoWillArrive', onFivePanoWillArrive);
|
|
120
|
+
five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
125
121
|
});
|
|
126
122
|
|
|
127
123
|
svelte.onDestroy(() => {
|
|
128
|
-
five.off('panoWillArrive',
|
|
129
|
-
five.off('cameraDirectionUpdate',
|
|
124
|
+
five.off('panoWillArrive', onFivePanoWillArrive);
|
|
125
|
+
five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
130
126
|
});
|
|
131
127
|
|
|
132
128
|
$$self.$$set = $$props => {
|
|
@@ -136,7 +132,27 @@ function instance$8($$self, $$props, $$invalidate) {
|
|
|
136
132
|
if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
|
|
137
133
|
};
|
|
138
134
|
|
|
139
|
-
|
|
135
|
+
$$self.$$.update = () => {
|
|
136
|
+
if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
|
|
137
|
+
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
138
|
+
$$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if ($$self.$$.dirty & /*longitude*/ 128) {
|
|
142
|
+
$$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return [
|
|
147
|
+
cameraImageUrl,
|
|
148
|
+
rotateTransform,
|
|
149
|
+
positionTransform,
|
|
150
|
+
five,
|
|
151
|
+
pxmm,
|
|
152
|
+
floorplanData,
|
|
153
|
+
panoIndex,
|
|
154
|
+
longitude
|
|
155
|
+
];
|
|
140
156
|
}
|
|
141
157
|
|
|
142
158
|
class Camera extends internal.SvelteComponent {
|
|
@@ -1531,13 +1547,7 @@ class PanoFloorplanRadarPluginController {
|
|
|
1531
1547
|
enumerable: true,
|
|
1532
1548
|
configurable: true,
|
|
1533
1549
|
writable: true,
|
|
1534
|
-
value:
|
|
1535
|
-
});
|
|
1536
|
-
Object.defineProperty(this, "originExtraObjects", {
|
|
1537
|
-
enumerable: true,
|
|
1538
|
-
configurable: true,
|
|
1539
|
-
writable: true,
|
|
1540
|
-
value: void 0
|
|
1550
|
+
value: []
|
|
1541
1551
|
});
|
|
1542
1552
|
Object.defineProperty(this, "configs", {
|
|
1543
1553
|
enumerable: true,
|
|
@@ -1598,7 +1608,6 @@ class PanoFloorplanRadarPluginController {
|
|
|
1598
1608
|
this.render();
|
|
1599
1609
|
}
|
|
1600
1610
|
setExtraObjectsWith3DPositions(data) {
|
|
1601
|
-
this.originExtraObjects = data;
|
|
1602
1611
|
if (!this.data)
|
|
1603
1612
|
return;
|
|
1604
1613
|
this.extraObjects = formatExtraObjects(data, this.five, this.data);
|
|
@@ -1613,9 +1622,6 @@ class PanoFloorplanRadarPluginController {
|
|
|
1613
1622
|
}
|
|
1614
1623
|
if (!this.data || !this.wrapper)
|
|
1615
1624
|
return;
|
|
1616
|
-
if (!this.extraObjects && this.originExtraObjects) {
|
|
1617
|
-
this.extraObjects = formatExtraObjects(this.originExtraObjects, this.five, this.data);
|
|
1618
|
-
}
|
|
1619
1625
|
const props = {
|
|
1620
1626
|
five: this.five,
|
|
1621
1627
|
floorplanData: this.data,
|
package/dist/index.es.js
CHANGED
|
@@ -4675,58 +4675,54 @@ function create_fragment$7(ctx) {
|
|
|
4675
4675
|
};
|
|
4676
4676
|
}
|
|
4677
4677
|
|
|
4678
|
+
function getCameraRotateTransform(longitude) {
|
|
4679
|
+
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
4680
|
+
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
4681
|
+
|
|
4682
|
+
return `rotate(${rotate}deg)`;
|
|
4683
|
+
}
|
|
4684
|
+
|
|
4678
4685
|
function instance$7($$self, $$props, $$invalidate) {
|
|
4686
|
+
let positionTransform;
|
|
4687
|
+
let rotateTransform;
|
|
4679
4688
|
let { five } = $$props;
|
|
4680
4689
|
let { pxmm } = $$props;
|
|
4681
4690
|
let { floorplanData } = $$props;
|
|
4682
4691
|
let { cameraImageUrl } = $$props;
|
|
4692
|
+
let panoIndex = five.getCurrentState().panoIndex;
|
|
4693
|
+
let longitude = five.getCurrentState().longitude;
|
|
4683
4694
|
|
|
4684
4695
|
/** 获取相机在当前 Five 状态下的位移 */
|
|
4685
|
-
function getCameraPositionTransform(panoIndex) {
|
|
4686
|
-
const observer = floorplanData.observers[panoIndex];
|
|
4696
|
+
function getCameraPositionTransform(floorplanData, panoIndex) {
|
|
4687
4697
|
const bounding = floorplanData.bounding;
|
|
4698
|
+
const floorplanObserver = floorplanData.observers[panoIndex];
|
|
4699
|
+
if (!floorplanObserver) return '';
|
|
4688
4700
|
const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
|
|
4689
4701
|
const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
|
|
4690
|
-
|
|
4691
|
-
const
|
|
4692
|
-
const top = Math.floor(observer.positionInImage.y * clientHeight);
|
|
4702
|
+
const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
|
|
4703
|
+
const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
|
|
4693
4704
|
return `translate(${left}px, ${top}px)`;
|
|
4694
4705
|
}
|
|
4695
4706
|
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
const { longitude } = five.getCurrentState();
|
|
4699
|
-
|
|
4700
|
-
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
4701
|
-
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
4702
|
-
|
|
4703
|
-
return `rotate(${rotate}deg)`;
|
|
4707
|
+
function onFivePanoWillArrive(_panoIndex) {
|
|
4708
|
+
$$invalidate(6, panoIndex = _panoIndex);
|
|
4704
4709
|
}
|
|
4705
4710
|
|
|
4706
|
-
const
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
const changeRotate = throttle(
|
|
4711
|
-
() => {
|
|
4712
|
-
$$invalidate(1, rotateTransform = getCameraRotationTransform());
|
|
4711
|
+
const onFiveCameraDirectionUpdate = throttle(
|
|
4712
|
+
pose => {
|
|
4713
|
+
$$invalidate(7, longitude = pose.longitude);
|
|
4713
4714
|
},
|
|
4714
4715
|
1000 / 60
|
|
4715
4716
|
);
|
|
4716
4717
|
|
|
4717
|
-
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
4718
|
-
let rotateTransform = getCameraRotationTransform();
|
|
4719
|
-
|
|
4720
|
-
let positionTransform = getCameraPositionTransform(five.getCurrentState().panoIndex);
|
|
4721
|
-
|
|
4722
4718
|
onMount(() => {
|
|
4723
|
-
five.on('panoWillArrive',
|
|
4724
|
-
five.on('cameraDirectionUpdate',
|
|
4719
|
+
five.on('panoWillArrive', onFivePanoWillArrive);
|
|
4720
|
+
five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
4725
4721
|
});
|
|
4726
4722
|
|
|
4727
4723
|
onDestroy(() => {
|
|
4728
|
-
five.off('panoWillArrive',
|
|
4729
|
-
five.off('cameraDirectionUpdate',
|
|
4724
|
+
five.off('panoWillArrive', onFivePanoWillArrive);
|
|
4725
|
+
five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
4730
4726
|
});
|
|
4731
4727
|
|
|
4732
4728
|
$$self.$$set = $$props => {
|
|
@@ -4736,7 +4732,27 @@ function instance$7($$self, $$props, $$invalidate) {
|
|
|
4736
4732
|
if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
|
|
4737
4733
|
};
|
|
4738
4734
|
|
|
4739
|
-
|
|
4735
|
+
$$self.$$.update = () => {
|
|
4736
|
+
if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
|
|
4737
|
+
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
4738
|
+
$$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
if ($$self.$$.dirty & /*longitude*/ 128) {
|
|
4742
|
+
$$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
|
|
4743
|
+
}
|
|
4744
|
+
};
|
|
4745
|
+
|
|
4746
|
+
return [
|
|
4747
|
+
cameraImageUrl,
|
|
4748
|
+
rotateTransform,
|
|
4749
|
+
positionTransform,
|
|
4750
|
+
five,
|
|
4751
|
+
pxmm,
|
|
4752
|
+
floorplanData,
|
|
4753
|
+
panoIndex,
|
|
4754
|
+
longitude
|
|
4755
|
+
];
|
|
4740
4756
|
}
|
|
4741
4757
|
|
|
4742
4758
|
class Camera extends SvelteComponent {
|
|
@@ -5443,13 +5459,7 @@ class PanoFloorplanRadarPluginController {
|
|
|
5443
5459
|
enumerable: true,
|
|
5444
5460
|
configurable: true,
|
|
5445
5461
|
writable: true,
|
|
5446
|
-
value:
|
|
5447
|
-
});
|
|
5448
|
-
Object.defineProperty(this, "originExtraObjects", {
|
|
5449
|
-
enumerable: true,
|
|
5450
|
-
configurable: true,
|
|
5451
|
-
writable: true,
|
|
5452
|
-
value: void 0
|
|
5462
|
+
value: []
|
|
5453
5463
|
});
|
|
5454
5464
|
Object.defineProperty(this, "configs", {
|
|
5455
5465
|
enumerable: true,
|
|
@@ -5510,7 +5520,6 @@ class PanoFloorplanRadarPluginController {
|
|
|
5510
5520
|
this.render();
|
|
5511
5521
|
}
|
|
5512
5522
|
setExtraObjectsWith3DPositions(data) {
|
|
5513
|
-
this.originExtraObjects = data;
|
|
5514
5523
|
if (!this.data)
|
|
5515
5524
|
return;
|
|
5516
5525
|
this.extraObjects = formatExtraObjects(data, this.five, this.data);
|
|
@@ -5525,9 +5534,6 @@ class PanoFloorplanRadarPluginController {
|
|
|
5525
5534
|
}
|
|
5526
5535
|
if (!this.data || !this.wrapper)
|
|
5527
5536
|
return;
|
|
5528
|
-
if (!this.extraObjects && this.originExtraObjects) {
|
|
5529
|
-
this.extraObjects = formatExtraObjects(this.originExtraObjects, this.five, this.data);
|
|
5530
|
-
}
|
|
5531
5537
|
const props = {
|
|
5532
5538
|
five: this.five,
|
|
5533
5539
|
floorplanData: this.data,
|
|
@@ -7092,9 +7098,9 @@ const PanoRulerPlugin = (five, params) => {
|
|
|
7092
7098
|
$rule.appendChild(style);
|
|
7093
7099
|
const __rule = {};
|
|
7094
7100
|
const _load = (roomInfo, roomRules) => {
|
|
7095
|
-
if (state.loaded) {
|
|
7096
|
-
|
|
7097
|
-
}
|
|
7101
|
+
// if (state.loaded) {
|
|
7102
|
+
// throw new Error('标尺被重复初始化!')
|
|
7103
|
+
// }
|
|
7098
7104
|
const roomHeightInfo = getRoomHeightInfo(roomInfo, five);
|
|
7099
7105
|
const work = five.work;
|
|
7100
7106
|
if (!work)
|
|
@@ -7170,6 +7176,7 @@ const PanoRulerPlugin = (five, params) => {
|
|
|
7170
7176
|
}
|
|
7171
7177
|
}
|
|
7172
7178
|
state.loaded = true;
|
|
7179
|
+
freshRule();
|
|
7173
7180
|
return true;
|
|
7174
7181
|
};
|
|
7175
7182
|
const load = async (_roomInfo, _roomRules, options) => {
|
|
@@ -7178,6 +7185,7 @@ const PanoRulerPlugin = (five, params) => {
|
|
|
7178
7185
|
if (!roomInfo || !roomRules) {
|
|
7179
7186
|
throw new Error('标尺数据依赖不齐全!');
|
|
7180
7187
|
}
|
|
7188
|
+
state.loaded = false;
|
|
7181
7189
|
state.options = Object.assign({}, state.options, options || {});
|
|
7182
7190
|
if (five.model.loaded) {
|
|
7183
7191
|
return _load(roomInfo, roomRules);
|
|
@@ -13052,6 +13060,7 @@ class MeasureController {
|
|
|
13052
13060
|
this.container.style.pointerEvents = 'none';
|
|
13053
13061
|
this.container.style.width = '100%';
|
|
13054
13062
|
this.container.style.height = '100%';
|
|
13063
|
+
this.container.style.opacity = '0';
|
|
13055
13064
|
this.container.style.background = 'rgba(0, 0, 0, 0.15)';
|
|
13056
13065
|
this.controllerParams = {
|
|
13057
13066
|
five: this.five,
|
|
@@ -13097,6 +13106,8 @@ class MeasureController {
|
|
|
13097
13106
|
return;
|
|
13098
13107
|
this.hasOpen = true;
|
|
13099
13108
|
this.five.scene.add(this.group);
|
|
13109
|
+
// 修改透明度
|
|
13110
|
+
this.container.style.opacity = '1';
|
|
13100
13111
|
// 隐藏点位和鼠标聚焦环
|
|
13101
13112
|
this.five.helperVisible = false;
|
|
13102
13113
|
this.controller = new WatchController(this.controllerParams);
|
|
@@ -13112,6 +13123,8 @@ class MeasureController {
|
|
|
13112
13123
|
disable() {
|
|
13113
13124
|
var _a, _b, _c, _d;
|
|
13114
13125
|
this.hasOpen = false;
|
|
13126
|
+
// 修改透明度
|
|
13127
|
+
this.container.style.opacity = '0';
|
|
13115
13128
|
// 展示点位和鼠标聚焦环
|
|
13116
13129
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
13117
13130
|
(_b = this.useUIController) === null || _b === void 0 ? void 0 : _b.hide();
|
|
@@ -13164,7 +13177,7 @@ class MeasureController {
|
|
|
13164
13177
|
}
|
|
13165
13178
|
}
|
|
13166
13179
|
|
|
13167
|
-
const PanoMeasurePlugin = function
|
|
13180
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
13168
13181
|
return new MeasureController(five, params);
|
|
13169
13182
|
};
|
|
13170
13183
|
|
package/dist/index.js
CHANGED
|
@@ -4702,58 +4702,54 @@ function create_fragment$7(ctx) {
|
|
|
4702
4702
|
};
|
|
4703
4703
|
}
|
|
4704
4704
|
|
|
4705
|
+
function getCameraRotateTransform(longitude) {
|
|
4706
|
+
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
4707
|
+
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
4708
|
+
|
|
4709
|
+
return `rotate(${rotate}deg)`;
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4705
4712
|
function instance$7($$self, $$props, $$invalidate) {
|
|
4713
|
+
let positionTransform;
|
|
4714
|
+
let rotateTransform;
|
|
4706
4715
|
let { five } = $$props;
|
|
4707
4716
|
let { pxmm } = $$props;
|
|
4708
4717
|
let { floorplanData } = $$props;
|
|
4709
4718
|
let { cameraImageUrl } = $$props;
|
|
4719
|
+
let panoIndex = five.getCurrentState().panoIndex;
|
|
4720
|
+
let longitude = five.getCurrentState().longitude;
|
|
4710
4721
|
|
|
4711
4722
|
/** 获取相机在当前 Five 状态下的位移 */
|
|
4712
|
-
function getCameraPositionTransform(panoIndex) {
|
|
4713
|
-
const observer = floorplanData.observers[panoIndex];
|
|
4723
|
+
function getCameraPositionTransform(floorplanData, panoIndex) {
|
|
4714
4724
|
const bounding = floorplanData.bounding;
|
|
4725
|
+
const floorplanObserver = floorplanData.observers[panoIndex];
|
|
4726
|
+
if (!floorplanObserver) return '';
|
|
4715
4727
|
const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
|
|
4716
4728
|
const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
|
|
4717
|
-
|
|
4718
|
-
const
|
|
4719
|
-
const top = Math.floor(observer.positionInImage.y * clientHeight);
|
|
4729
|
+
const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
|
|
4730
|
+
const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
|
|
4720
4731
|
return `translate(${left}px, ${top}px)`;
|
|
4721
4732
|
}
|
|
4722
4733
|
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
const { longitude } = five.getCurrentState();
|
|
4726
|
-
|
|
4727
|
-
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
4728
|
-
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
4729
|
-
|
|
4730
|
-
return `rotate(${rotate}deg)`;
|
|
4734
|
+
function onFivePanoWillArrive(_panoIndex) {
|
|
4735
|
+
$$invalidate(6, panoIndex = _panoIndex);
|
|
4731
4736
|
}
|
|
4732
4737
|
|
|
4733
|
-
const
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
const changeRotate = throttle(
|
|
4738
|
-
() => {
|
|
4739
|
-
$$invalidate(1, rotateTransform = getCameraRotationTransform());
|
|
4738
|
+
const onFiveCameraDirectionUpdate = throttle(
|
|
4739
|
+
pose => {
|
|
4740
|
+
$$invalidate(7, longitude = pose.longitude);
|
|
4740
4741
|
},
|
|
4741
4742
|
1000 / 60
|
|
4742
4743
|
);
|
|
4743
4744
|
|
|
4744
|
-
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
4745
|
-
let rotateTransform = getCameraRotationTransform();
|
|
4746
|
-
|
|
4747
|
-
let positionTransform = getCameraPositionTransform(five.getCurrentState().panoIndex);
|
|
4748
|
-
|
|
4749
4745
|
svelte.onMount(() => {
|
|
4750
|
-
five.on('panoWillArrive',
|
|
4751
|
-
five.on('cameraDirectionUpdate',
|
|
4746
|
+
five.on('panoWillArrive', onFivePanoWillArrive);
|
|
4747
|
+
five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
4752
4748
|
});
|
|
4753
4749
|
|
|
4754
4750
|
svelte.onDestroy(() => {
|
|
4755
|
-
five.off('panoWillArrive',
|
|
4756
|
-
five.off('cameraDirectionUpdate',
|
|
4751
|
+
five.off('panoWillArrive', onFivePanoWillArrive);
|
|
4752
|
+
five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
4757
4753
|
});
|
|
4758
4754
|
|
|
4759
4755
|
$$self.$$set = $$props => {
|
|
@@ -4763,7 +4759,27 @@ function instance$7($$self, $$props, $$invalidate) {
|
|
|
4763
4759
|
if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
|
|
4764
4760
|
};
|
|
4765
4761
|
|
|
4766
|
-
|
|
4762
|
+
$$self.$$.update = () => {
|
|
4763
|
+
if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
|
|
4764
|
+
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
4765
|
+
$$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
|
|
4766
|
+
}
|
|
4767
|
+
|
|
4768
|
+
if ($$self.$$.dirty & /*longitude*/ 128) {
|
|
4769
|
+
$$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
|
|
4770
|
+
}
|
|
4771
|
+
};
|
|
4772
|
+
|
|
4773
|
+
return [
|
|
4774
|
+
cameraImageUrl,
|
|
4775
|
+
rotateTransform,
|
|
4776
|
+
positionTransform,
|
|
4777
|
+
five,
|
|
4778
|
+
pxmm,
|
|
4779
|
+
floorplanData,
|
|
4780
|
+
panoIndex,
|
|
4781
|
+
longitude
|
|
4782
|
+
];
|
|
4767
4783
|
}
|
|
4768
4784
|
|
|
4769
4785
|
class Camera extends internal.SvelteComponent {
|
|
@@ -5470,13 +5486,7 @@ class PanoFloorplanRadarPluginController {
|
|
|
5470
5486
|
enumerable: true,
|
|
5471
5487
|
configurable: true,
|
|
5472
5488
|
writable: true,
|
|
5473
|
-
value:
|
|
5474
|
-
});
|
|
5475
|
-
Object.defineProperty(this, "originExtraObjects", {
|
|
5476
|
-
enumerable: true,
|
|
5477
|
-
configurable: true,
|
|
5478
|
-
writable: true,
|
|
5479
|
-
value: void 0
|
|
5489
|
+
value: []
|
|
5480
5490
|
});
|
|
5481
5491
|
Object.defineProperty(this, "configs", {
|
|
5482
5492
|
enumerable: true,
|
|
@@ -5537,7 +5547,6 @@ class PanoFloorplanRadarPluginController {
|
|
|
5537
5547
|
this.render();
|
|
5538
5548
|
}
|
|
5539
5549
|
setExtraObjectsWith3DPositions(data) {
|
|
5540
|
-
this.originExtraObjects = data;
|
|
5541
5550
|
if (!this.data)
|
|
5542
5551
|
return;
|
|
5543
5552
|
this.extraObjects = formatExtraObjects(data, this.five, this.data);
|
|
@@ -5552,9 +5561,6 @@ class PanoFloorplanRadarPluginController {
|
|
|
5552
5561
|
}
|
|
5553
5562
|
if (!this.data || !this.wrapper)
|
|
5554
5563
|
return;
|
|
5555
|
-
if (!this.extraObjects && this.originExtraObjects) {
|
|
5556
|
-
this.extraObjects = formatExtraObjects(this.originExtraObjects, this.five, this.data);
|
|
5557
|
-
}
|
|
5558
5564
|
const props = {
|
|
5559
5565
|
five: this.five,
|
|
5560
5566
|
floorplanData: this.data,
|
|
@@ -7119,9 +7125,9 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
7119
7125
|
$rule.appendChild(style);
|
|
7120
7126
|
const __rule = {};
|
|
7121
7127
|
const _load = (roomInfo, roomRules) => {
|
|
7122
|
-
if (state.loaded) {
|
|
7123
|
-
|
|
7124
|
-
}
|
|
7128
|
+
// if (state.loaded) {
|
|
7129
|
+
// throw new Error('标尺被重复初始化!')
|
|
7130
|
+
// }
|
|
7125
7131
|
const roomHeightInfo = getRoomHeightInfo(roomInfo, five$1);
|
|
7126
7132
|
const work = five$1.work;
|
|
7127
7133
|
if (!work)
|
|
@@ -7197,6 +7203,7 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
7197
7203
|
}
|
|
7198
7204
|
}
|
|
7199
7205
|
state.loaded = true;
|
|
7206
|
+
freshRule();
|
|
7200
7207
|
return true;
|
|
7201
7208
|
};
|
|
7202
7209
|
const load = async (_roomInfo, _roomRules, options) => {
|
|
@@ -7205,6 +7212,7 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
7205
7212
|
if (!roomInfo || !roomRules) {
|
|
7206
7213
|
throw new Error('标尺数据依赖不齐全!');
|
|
7207
7214
|
}
|
|
7215
|
+
state.loaded = false;
|
|
7208
7216
|
state.options = Object.assign({}, state.options, options || {});
|
|
7209
7217
|
if (five$1.model.loaded) {
|
|
7210
7218
|
return _load(roomInfo, roomRules);
|
|
@@ -13079,6 +13087,7 @@ class MeasureController {
|
|
|
13079
13087
|
this.container.style.pointerEvents = 'none';
|
|
13080
13088
|
this.container.style.width = '100%';
|
|
13081
13089
|
this.container.style.height = '100%';
|
|
13090
|
+
this.container.style.opacity = '0';
|
|
13082
13091
|
this.container.style.background = 'rgba(0, 0, 0, 0.15)';
|
|
13083
13092
|
this.controllerParams = {
|
|
13084
13093
|
five: this.five,
|
|
@@ -13124,6 +13133,8 @@ class MeasureController {
|
|
|
13124
13133
|
return;
|
|
13125
13134
|
this.hasOpen = true;
|
|
13126
13135
|
this.five.scene.add(this.group);
|
|
13136
|
+
// 修改透明度
|
|
13137
|
+
this.container.style.opacity = '1';
|
|
13127
13138
|
// 隐藏点位和鼠标聚焦环
|
|
13128
13139
|
this.five.helperVisible = false;
|
|
13129
13140
|
this.controller = new WatchController(this.controllerParams);
|
|
@@ -13139,6 +13150,8 @@ class MeasureController {
|
|
|
13139
13150
|
disable() {
|
|
13140
13151
|
var _a, _b, _c, _d;
|
|
13141
13152
|
this.hasOpen = false;
|
|
13153
|
+
// 修改透明度
|
|
13154
|
+
this.container.style.opacity = '0';
|
|
13142
13155
|
// 展示点位和鼠标聚焦环
|
|
13143
13156
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
13144
13157
|
(_b = this.useUIController) === null || _b === void 0 ? void 0 : _b.hide();
|
|
@@ -13191,7 +13204,7 @@ class MeasureController {
|
|
|
13191
13204
|
}
|
|
13192
13205
|
}
|
|
13193
13206
|
|
|
13194
|
-
const PanoMeasurePlugin = function
|
|
13207
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
13195
13208
|
return new MeasureController(five, params);
|
|
13196
13209
|
};
|
|
13197
13210
|
|