@realsee/dnalogel 2.0.0-alpha.22 → 2.0.0-alpha.23
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 +4 -0
- package/dist/PanoMeasurePlugin/index.js +1 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +1 -2
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +47 -41
- package/dist/index.es.js +48 -42
- package/dist/index.js +48 -42
- package/dist/index.umd.js +48 -42
- 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/index.js +1 -1
- 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
|
@@ -5524,7 +5524,7 @@ class MeasureController {
|
|
|
5524
5524
|
}
|
|
5525
5525
|
}
|
|
5526
5526
|
|
|
5527
|
-
const PanoMeasurePlugin = function
|
|
5527
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
5528
5528
|
return new MeasureController(five, params);
|
|
5529
5529
|
};
|
|
5530
5530
|
|
|
@@ -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,
|
|
@@ -13169,7 +13175,7 @@ class MeasureController {
|
|
|
13169
13175
|
}
|
|
13170
13176
|
}
|
|
13171
13177
|
|
|
13172
|
-
const PanoMeasurePlugin = function
|
|
13178
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
13173
13179
|
return new MeasureController(five, params);
|
|
13174
13180
|
};
|
|
13175
13181
|
|
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,
|
|
@@ -13196,7 +13202,7 @@ class MeasureController {
|
|
|
13196
13202
|
}
|
|
13197
13203
|
}
|
|
13198
13204
|
|
|
13199
|
-
const PanoMeasurePlugin = function
|
|
13205
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
13200
13206
|
return new MeasureController(five, params);
|
|
13201
13207
|
};
|
|
13202
13208
|
|
package/dist/index.umd.js
CHANGED
|
@@ -4691,58 +4691,54 @@
|
|
|
4691
4691
|
};
|
|
4692
4692
|
}
|
|
4693
4693
|
|
|
4694
|
+
function getCameraRotateTransform(longitude) {
|
|
4695
|
+
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
4696
|
+
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
4697
|
+
|
|
4698
|
+
return `rotate(${rotate}deg)`;
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4694
4701
|
function instance$7($$self, $$props, $$invalidate) {
|
|
4702
|
+
let positionTransform;
|
|
4703
|
+
let rotateTransform;
|
|
4695
4704
|
let { five } = $$props;
|
|
4696
4705
|
let { pxmm } = $$props;
|
|
4697
4706
|
let { floorplanData } = $$props;
|
|
4698
4707
|
let { cameraImageUrl } = $$props;
|
|
4708
|
+
let panoIndex = five.getCurrentState().panoIndex;
|
|
4709
|
+
let longitude = five.getCurrentState().longitude;
|
|
4699
4710
|
|
|
4700
4711
|
/** 获取相机在当前 Five 状态下的位移 */
|
|
4701
|
-
function getCameraPositionTransform(panoIndex) {
|
|
4702
|
-
const observer = floorplanData.observers[panoIndex];
|
|
4712
|
+
function getCameraPositionTransform(floorplanData, panoIndex) {
|
|
4703
4713
|
const bounding = floorplanData.bounding;
|
|
4714
|
+
const floorplanObserver = floorplanData.observers[panoIndex];
|
|
4715
|
+
if (!floorplanObserver) return '';
|
|
4704
4716
|
const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
|
|
4705
4717
|
const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
|
|
4706
|
-
|
|
4707
|
-
const
|
|
4708
|
-
const top = Math.floor(observer.positionInImage.y * clientHeight);
|
|
4718
|
+
const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
|
|
4719
|
+
const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
|
|
4709
4720
|
return `translate(${left}px, ${top}px)`;
|
|
4710
4721
|
}
|
|
4711
4722
|
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
const { longitude } = five.getCurrentState();
|
|
4715
|
-
|
|
4716
|
-
// 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
4717
|
-
const rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
4718
|
-
|
|
4719
|
-
return `rotate(${rotate}deg)`;
|
|
4723
|
+
function onFivePanoWillArrive(_panoIndex) {
|
|
4724
|
+
$$invalidate(6, panoIndex = _panoIndex);
|
|
4720
4725
|
}
|
|
4721
4726
|
|
|
4722
|
-
const
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
const changeRotate = throttle(
|
|
4727
|
-
() => {
|
|
4728
|
-
$$invalidate(1, rotateTransform = getCameraRotationTransform());
|
|
4727
|
+
const onFiveCameraDirectionUpdate = throttle(
|
|
4728
|
+
pose => {
|
|
4729
|
+
$$invalidate(7, longitude = pose.longitude);
|
|
4729
4730
|
},
|
|
4730
4731
|
1000 / 60
|
|
4731
4732
|
);
|
|
4732
4733
|
|
|
4733
|
-
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
4734
|
-
let rotateTransform = getCameraRotationTransform();
|
|
4735
|
-
|
|
4736
|
-
let positionTransform = getCameraPositionTransform(five.getCurrentState().panoIndex);
|
|
4737
|
-
|
|
4738
4734
|
svelte.onMount(() => {
|
|
4739
|
-
five.on('panoWillArrive',
|
|
4740
|
-
five.on('cameraDirectionUpdate',
|
|
4735
|
+
five.on('panoWillArrive', onFivePanoWillArrive);
|
|
4736
|
+
five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
4741
4737
|
});
|
|
4742
4738
|
|
|
4743
4739
|
svelte.onDestroy(() => {
|
|
4744
|
-
five.off('panoWillArrive',
|
|
4745
|
-
five.off('cameraDirectionUpdate',
|
|
4740
|
+
five.off('panoWillArrive', onFivePanoWillArrive);
|
|
4741
|
+
five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
|
|
4746
4742
|
});
|
|
4747
4743
|
|
|
4748
4744
|
$$self.$$set = $$props => {
|
|
@@ -4752,7 +4748,27 @@
|
|
|
4752
4748
|
if ('cameraImageUrl' in $$props) $$invalidate(0, cameraImageUrl = $$props.cameraImageUrl);
|
|
4753
4749
|
};
|
|
4754
4750
|
|
|
4755
|
-
|
|
4751
|
+
$$self.$$.update = () => {
|
|
4752
|
+
if ($$self.$$.dirty & /*floorplanData, panoIndex*/ 96) {
|
|
4753
|
+
// 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
|
|
4754
|
+
$$invalidate(2, positionTransform = getCameraPositionTransform(floorplanData, panoIndex));
|
|
4755
|
+
}
|
|
4756
|
+
|
|
4757
|
+
if ($$self.$$.dirty & /*longitude*/ 128) {
|
|
4758
|
+
$$invalidate(1, rotateTransform = getCameraRotateTransform(longitude));
|
|
4759
|
+
}
|
|
4760
|
+
};
|
|
4761
|
+
|
|
4762
|
+
return [
|
|
4763
|
+
cameraImageUrl,
|
|
4764
|
+
rotateTransform,
|
|
4765
|
+
positionTransform,
|
|
4766
|
+
five,
|
|
4767
|
+
pxmm,
|
|
4768
|
+
floorplanData,
|
|
4769
|
+
panoIndex,
|
|
4770
|
+
longitude
|
|
4771
|
+
];
|
|
4756
4772
|
}
|
|
4757
4773
|
|
|
4758
4774
|
class Camera extends internal.SvelteComponent {
|
|
@@ -5459,13 +5475,7 @@
|
|
|
5459
5475
|
enumerable: true,
|
|
5460
5476
|
configurable: true,
|
|
5461
5477
|
writable: true,
|
|
5462
|
-
value:
|
|
5463
|
-
});
|
|
5464
|
-
Object.defineProperty(this, "originExtraObjects", {
|
|
5465
|
-
enumerable: true,
|
|
5466
|
-
configurable: true,
|
|
5467
|
-
writable: true,
|
|
5468
|
-
value: void 0
|
|
5478
|
+
value: []
|
|
5469
5479
|
});
|
|
5470
5480
|
Object.defineProperty(this, "configs", {
|
|
5471
5481
|
enumerable: true,
|
|
@@ -5526,7 +5536,6 @@
|
|
|
5526
5536
|
this.render();
|
|
5527
5537
|
}
|
|
5528
5538
|
setExtraObjectsWith3DPositions(data) {
|
|
5529
|
-
this.originExtraObjects = data;
|
|
5530
5539
|
if (!this.data)
|
|
5531
5540
|
return;
|
|
5532
5541
|
this.extraObjects = formatExtraObjects(data, this.five, this.data);
|
|
@@ -5541,9 +5550,6 @@
|
|
|
5541
5550
|
}
|
|
5542
5551
|
if (!this.data || !this.wrapper)
|
|
5543
5552
|
return;
|
|
5544
|
-
if (!this.extraObjects && this.originExtraObjects) {
|
|
5545
|
-
this.extraObjects = formatExtraObjects(this.originExtraObjects, this.five, this.data);
|
|
5546
|
-
}
|
|
5547
5553
|
const props = {
|
|
5548
5554
|
five: this.five,
|
|
5549
5555
|
floorplanData: this.data,
|
|
@@ -13185,7 +13191,7 @@
|
|
|
13185
13191
|
}
|
|
13186
13192
|
}
|
|
13187
13193
|
|
|
13188
|
-
const PanoMeasurePlugin = function
|
|
13194
|
+
const PanoMeasurePlugin = function PanoMeasurePlugin(five, params) {
|
|
13189
13195
|
return new MeasureController(five, params);
|
|
13190
13196
|
};
|
|
13191
13197
|
|