@realsee/dnalogel 2.0.0-alpha.51 → 2.0.0-alpha.52
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/dist/CSS3DRenderPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/CSS3DRenderPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/CameraMovementPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/CameraMovementPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/CruisePlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/CruisePlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/CruisePlugin/index.d.ts +0 -1
- package/dist/GuideLinePlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/GuideLinePlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ItemLabelPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ItemLabelPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ModelChassisCompassPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ModelEntryDoorGuidePlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ModelEntryDoorGuidePlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ModelItemLabelPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ModelItemLabelPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ModelRoomLabelPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ModelRoomLabelPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ModelTVVideoPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/ModelViewPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/ModelViewPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoCompassPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoCursorRaycasterPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoCursorRaycasterPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoDoorLabelPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoDoorLabelPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoMeasurePlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoRulerPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoRulerPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoRulerProPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoRulerProPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/PanoSpatialTagPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/PanoSpatialTagPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/floorplan/MapviewFloorplanPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/floorplan/MapviewFloorplanPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/floorplan/ModelFloorplanPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/floorplan/TopviewFloorplanPlugin/CruisePlugin/index.d.ts +0 -1
- package/dist/floorplan/TopviewFloorplanPlugin/GuideLinePlugin/index.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +1081 -15
- package/dist/index.js +1084 -14
- package/dist/index.umd.js +1087 -18
- package/docs/assets/search.js +1 -1
- package/docs/classes/CruisePluginController.html +23 -0
- package/docs/classes/Magnifier.html +5 -5
- package/docs/classes/ModelRoomLabelController.html +5 -5
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
- package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
- package/docs/interfaces/FloorplanBounding.html +5 -5
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +8 -8
- package/docs/interfaces/FloorplanExtraObject.html +4 -4
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +7 -7
- package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
- package/docs/interfaces/FloorplanServerBounding.html +5 -5
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
- package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
- package/docs/interfaces/FloorplanServerEntrance.html +8 -8
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +8 -8
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.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/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/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/modules.html +18 -18
- package/libs/CruisePlugin/index.d.ts +0 -1
- package/libs/CruisePlugin/index.js +0 -1
- package/libs/GuideLinePlugin/index.d.ts +1 -1
- package/libs/GuideLinePlugin/index.js +0 -1
- package/libs/index.d.ts +2 -0
- package/libs/index.js +4 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -13,6 +13,7 @@ import * as TWEEN from '@tweenjs/tween.js';
|
|
|
13
13
|
import TWEEN__default from '@tweenjs/tween.js';
|
|
14
14
|
import Hammer from 'hammerjs';
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import getNormals from 'polyline-normals';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Five 模型插件
|
|
@@ -4679,7 +4680,7 @@ function getPxmm(five, container, floorIndex, options) {
|
|
|
4679
4680
|
/**
|
|
4680
4681
|
* plugin 的基本控制器
|
|
4681
4682
|
*/
|
|
4682
|
-
class Controller$
|
|
4683
|
+
class Controller$7 {
|
|
4683
4684
|
constructor(five) {
|
|
4684
4685
|
Object.defineProperty(this, "five", {
|
|
4685
4686
|
enumerable: true,
|
|
@@ -4706,7 +4707,7 @@ class Controller$6 {
|
|
|
4706
4707
|
}
|
|
4707
4708
|
}
|
|
4708
4709
|
|
|
4709
|
-
class Controller$
|
|
4710
|
+
class Controller$6 extends Controller$7 {
|
|
4710
4711
|
}
|
|
4711
4712
|
|
|
4712
4713
|
var FloorplanErrorType;
|
|
@@ -4858,7 +4859,7 @@ function shouldFloorplanShowWithPose$1(pose) {
|
|
|
4858
4859
|
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
4859
4860
|
return latitudeVisible && longitudeVisible;
|
|
4860
4861
|
}
|
|
4861
|
-
class Controller$
|
|
4862
|
+
class Controller$5 extends Controller$6 {
|
|
4862
4863
|
constructor(five, params) {
|
|
4863
4864
|
var _a;
|
|
4864
4865
|
super(five);
|
|
@@ -5527,7 +5528,7 @@ class Controller$4 extends Controller$5 {
|
|
|
5527
5528
|
}
|
|
5528
5529
|
|
|
5529
5530
|
const ModelFloorplanPlugin = (five, params) => {
|
|
5530
|
-
return new Controller$
|
|
5531
|
+
return new Controller$5(five, params);
|
|
5531
5532
|
};
|
|
5532
5533
|
|
|
5533
5534
|
/** 当前 five 的相机视角是否满足户型图自动隐藏条件
|
|
@@ -5552,7 +5553,7 @@ function shouldFloorplanShowWithPose(pose) {
|
|
|
5552
5553
|
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
5553
5554
|
return latitudeVisible && longitudeVisible;
|
|
5554
5555
|
}
|
|
5555
|
-
class Controller$
|
|
5556
|
+
class Controller$4 extends Controller$6 {
|
|
5556
5557
|
constructor(five, params) {
|
|
5557
5558
|
super(five);
|
|
5558
5559
|
// =============== public properties =================
|
|
@@ -6201,10 +6202,10 @@ class Controller$3 extends Controller$5 {
|
|
|
6201
6202
|
}
|
|
6202
6203
|
|
|
6203
6204
|
const MapviewFloorplanPlugin = (five, params) => {
|
|
6204
|
-
return new Controller$
|
|
6205
|
+
return new Controller$4(five, params);
|
|
6205
6206
|
};
|
|
6206
6207
|
|
|
6207
|
-
class Controller$
|
|
6208
|
+
class Controller$3 extends Controller$6 {
|
|
6208
6209
|
constructor(five, params) {
|
|
6209
6210
|
super(five);
|
|
6210
6211
|
// =============== public properties =================
|
|
@@ -6681,7 +6682,7 @@ class Controller$2 extends Controller$5 {
|
|
|
6681
6682
|
}
|
|
6682
6683
|
|
|
6683
6684
|
const TopviewFloorplanPlugin = (five, params) => {
|
|
6684
|
-
return new Controller$
|
|
6685
|
+
return new Controller$3(five, params);
|
|
6685
6686
|
};
|
|
6686
6687
|
|
|
6687
6688
|
/**
|
|
@@ -7560,7 +7561,7 @@ class Main extends SvelteComponent {
|
|
|
7560
7561
|
}
|
|
7561
7562
|
}
|
|
7562
7563
|
|
|
7563
|
-
class Controller$
|
|
7564
|
+
class Controller$2 extends Controller$6 {
|
|
7564
7565
|
constructor(five, params) {
|
|
7565
7566
|
super(five);
|
|
7566
7567
|
// =============== public properties =================
|
|
@@ -7797,7 +7798,7 @@ class Controller$1 extends Controller$5 {
|
|
|
7797
7798
|
}
|
|
7798
7799
|
|
|
7799
7800
|
const PanoFloorplanRadarPlugin = (five, params) => {
|
|
7800
|
-
return new Controller$
|
|
7801
|
+
return new Controller$2(five, params);
|
|
7801
7802
|
};
|
|
7802
7803
|
|
|
7803
7804
|
/** 房屋数据映射表 */
|
|
@@ -9667,7 +9668,7 @@ class RulerItems extends SvelteComponent {
|
|
|
9667
9668
|
}
|
|
9668
9669
|
}
|
|
9669
9670
|
|
|
9670
|
-
class Controller {
|
|
9671
|
+
class Controller$1 {
|
|
9671
9672
|
constructor(five, params) {
|
|
9672
9673
|
var _a, _b;
|
|
9673
9674
|
Object.defineProperty(this, "five", {
|
|
@@ -9781,7 +9782,7 @@ class Controller {
|
|
|
9781
9782
|
* 全景标尺插件
|
|
9782
9783
|
*/
|
|
9783
9784
|
const PanoRulerProPlugin = (five, params) => {
|
|
9784
|
-
return new Controller(five, params);
|
|
9785
|
+
return new Controller$1(five, params);
|
|
9785
9786
|
};
|
|
9786
9787
|
|
|
9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TSnsnWF+b1dKAhk8QrrHpEgsDgC0ndi0oNoEBIuiASBZhGQvnqCz/KCJ/jYZtto7DPRoUU2N11LJIXxqNyUC0VFqeCTpRlP94gEgZMhIL0nbDCIdJswQSQINI9AIRRsNRP+KfvOkgNrKEddr5660YUqw3k8EAhkbvsuCztPVSF7JDqMBIF1IKAxcOl5S8eZLEWCQDcIFBtO2Kv2UOr645lAKkex4VeIpLo5jHbls1KD4eYaWIu4R+UeyYLA2RHQWGAADiJ9P9u2StcheRB4VQSkyzgD2PQppwBH4MaEMpBFRSDcqCYQx9ggDphr0QUb3SMSBJpAQGPiciei9P6oYYAmGphKbA4B6TRrJ+j1HKHYzh8cZbpVBowXZ8bgQhzPNJAOvvD4QjkOAj0hUAbdUOVMoHrqudT1OgSk2zgLkAl2n/LYvh9s900kutYV4UIvQiBXMMlBEAgCQWA1CBRCgUjmHAkI5vk+PACR1BcZmGmfH64GzTQkCASBILBhBAqhgEC9rDFGJI7FGJEcB4EgEASCQBAIAkEgCASBIBAEgkAQCAJBIAgEgSAQBIJAEAgCm0fg/x4jQQWGalpFAAAAAElFTkSuQmCC';
|
|
@@ -9903,7 +9904,7 @@ function tweenProgress(duration, easing = TWEEN__default.Easing.Linear.None) {
|
|
|
9903
9904
|
}
|
|
9904
9905
|
|
|
9905
9906
|
const defaultBaseOptions$1 = { userAction: true };
|
|
9906
|
-
class PanoCompassController extends Controller$
|
|
9907
|
+
class PanoCompassController extends Controller$6 {
|
|
9907
9908
|
constructor(five, config) {
|
|
9908
9909
|
super(five);
|
|
9909
9910
|
/**
|
|
@@ -17355,7 +17356,7 @@ const itemLabelPluginServerParams = {
|
|
|
17355
17356
|
* pano plugin controller 基类
|
|
17356
17357
|
* @author kyleju
|
|
17357
17358
|
*/
|
|
17358
|
-
class BasePanoPluginController extends Controller$
|
|
17359
|
+
class BasePanoPluginController extends Controller$7 {
|
|
17359
17360
|
constructor(five) {
|
|
17360
17361
|
super(five);
|
|
17361
17362
|
Object.defineProperty(this, "state", {
|
|
@@ -18086,6 +18087,1071 @@ const PanoDoorLabelPlugin = (five) => {
|
|
|
18086
18087
|
return new PanoDoorLabelPluginController(five);
|
|
18087
18088
|
};
|
|
18088
18089
|
|
|
18090
|
+
// 定义常量
|
|
18091
|
+
const TRIANGLE_NUMBER_OF_RECTANGLE = 2; // 每个矩形有两个三角形
|
|
18092
|
+
const VERTEX_NUMBER_OF_TRIANGLE = 3; // 每个三角形有三个顶点
|
|
18093
|
+
const AXIS_NUMBER_OF_VERTEX = 3; // 每个顶点有三个轴坐标
|
|
18094
|
+
const UV_NUMBER_OF_VERTEX = 2; // 每个顶点有两个 UV 轴坐标
|
|
18095
|
+
function getLineGeometry(positionList) {
|
|
18096
|
+
if (positionList.length < 2)
|
|
18097
|
+
return;
|
|
18098
|
+
const lineWidth = 1;
|
|
18099
|
+
const halfLineWidth = 1 / 2;
|
|
18100
|
+
const aspect = 1;
|
|
18101
|
+
// 点位向量数组
|
|
18102
|
+
const keyPoints = positionList;
|
|
18103
|
+
// 点位组成的平滑曲线
|
|
18104
|
+
const curve = new THREE.CatmullRomCurve3(keyPoints, false, 'catmullrom', 0.5);
|
|
18105
|
+
// 求顶点和 UV
|
|
18106
|
+
const divisions = Math.ceil(curve.getLength()); // 曲线切片数
|
|
18107
|
+
const curvePoints = curve.getPoints(divisions);
|
|
18108
|
+
const curvePointsLength = curvePoints.length;
|
|
18109
|
+
const normals = getNormals(curvePoints.map((p) => [p.x, p.z])); // curvePoints:每个点切线的向量「二维」
|
|
18110
|
+
const rectangleNumber = curvePoints.length - 1; // 曲线上 N 个点,构成了 N - 1 个矩形
|
|
18111
|
+
const indexNumber = rectangleNumber * TRIANGLE_NUMBER_OF_RECTANGLE * VERTEX_NUMBER_OF_TRIANGLE;
|
|
18112
|
+
const verticesNumber = 2 * curvePointsLength; // 顶点数量(包含公用):每个曲线点对应两个顶点,N 个 点有 2N 个顶点
|
|
18113
|
+
const positionNumber = verticesNumber * AXIS_NUMBER_OF_VERTEX; // 坐标点数量
|
|
18114
|
+
const uvNumber = verticesNumber * UV_NUMBER_OF_VERTEX; // uv 数量
|
|
18115
|
+
const index = new Uint32Array(indexNumber);
|
|
18116
|
+
const positions = new Float32Array(positionNumber);
|
|
18117
|
+
const uv = new Float32Array(uvNumber);
|
|
18118
|
+
let totalLength = 0;
|
|
18119
|
+
for (let i = 0; i < curvePoints.length; i++) {
|
|
18120
|
+
const [nx, nz] = normals[i][0];
|
|
18121
|
+
const curvePoint = curvePoints[i];
|
|
18122
|
+
const { x: curvePointX, y: curvePointY, z: curvePointZ } = curvePoint;
|
|
18123
|
+
// vertices[2i]
|
|
18124
|
+
positions[i * 6 + 0] = curvePointX + nx * halfLineWidth;
|
|
18125
|
+
positions[i * 6 + 1] = curvePointY + 0.05;
|
|
18126
|
+
positions[i * 6 + 2] = curvePointZ + nz * halfLineWidth;
|
|
18127
|
+
// vertices[2i + 1]
|
|
18128
|
+
positions[i * 6 + 3] = curvePointX - nx * halfLineWidth;
|
|
18129
|
+
positions[i * 6 + 4] = curvePointY + 0.05;
|
|
18130
|
+
positions[i * 6 + 5] = curvePointZ - nz * halfLineWidth;
|
|
18131
|
+
totalLength += i > 0 ? curvePoints[i - 1].clone().sub(curvePoints[i]).length() : 0;
|
|
18132
|
+
const end = totalLength / lineWidth / aspect;
|
|
18133
|
+
uv[i * 4 + 0] = 0;
|
|
18134
|
+
uv[i * 4 + 1] = end;
|
|
18135
|
+
uv[i * 4 + 2] = 1;
|
|
18136
|
+
uv[i * 4 + 3] = end;
|
|
18137
|
+
if (i === curvePoints.length - 1)
|
|
18138
|
+
continue;
|
|
18139
|
+
index[i * 6 + 0] = i * 2 + 0;
|
|
18140
|
+
index[i * 6 + 1] = i * 2 + 2;
|
|
18141
|
+
index[i * 6 + 2] = i * 2 + 1;
|
|
18142
|
+
index[i * 6 + 3] = i * 2 + 2;
|
|
18143
|
+
index[i * 6 + 4] = i * 2 + 3;
|
|
18144
|
+
index[i * 6 + 5] = i * 2 + 1;
|
|
18145
|
+
}
|
|
18146
|
+
const geometry = new THREE.BufferGeometry();
|
|
18147
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
|
|
18148
|
+
geometry.setAttribute('uv', new THREE.BufferAttribute(uv, 2));
|
|
18149
|
+
geometry.setIndex(new THREE.BufferAttribute(index, 1));
|
|
18150
|
+
return geometry;
|
|
18151
|
+
}
|
|
18152
|
+
|
|
18153
|
+
function getArrowMaterial(params) {
|
|
18154
|
+
var _a;
|
|
18155
|
+
const texture = new THREE.TextureLoader().load((_a = params === null || params === void 0 ? void 0 : params.textureUtl) !== null && _a !== void 0 ? _a : '//vrlab-static.ljcdn.com/release/web/arrow.c5d028e4.png');
|
|
18156
|
+
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
|
|
18157
|
+
texture.encoding = THREE.sRGBEncoding;
|
|
18158
|
+
const arrowMaterial = new THREE.MeshBasicMaterial({
|
|
18159
|
+
color: 0xffffff,
|
|
18160
|
+
map: texture,
|
|
18161
|
+
transparent: true,
|
|
18162
|
+
opacity: 0.8,
|
|
18163
|
+
});
|
|
18164
|
+
return arrowMaterial;
|
|
18165
|
+
}
|
|
18166
|
+
|
|
18167
|
+
/**
|
|
18168
|
+
* 判断对象是否为`null`或`undefined`。
|
|
18169
|
+
* @param
|
|
18170
|
+
* @return
|
|
18171
|
+
*/
|
|
18172
|
+
/**
|
|
18173
|
+
* 判断对象不为`null`或`undefined`。
|
|
18174
|
+
*/
|
|
18175
|
+
function notNil(value) {
|
|
18176
|
+
return value !== null && value !== undefined;
|
|
18177
|
+
}
|
|
18178
|
+
|
|
18179
|
+
const VERSION$1 = 'v1.0.1';
|
|
18180
|
+
const PLUGIN_NAME$1 = 'GuideLinePlugin';
|
|
18181
|
+
const PLUGIN$1 = `${PLUGIN_NAME$1}@${VERSION$1}`;
|
|
18182
|
+
const pluginFlag = (name) => `${PLUGIN$1}--${name}`;
|
|
18183
|
+
class Controller extends Controller$6 {
|
|
18184
|
+
constructor(five) {
|
|
18185
|
+
super(five);
|
|
18186
|
+
Object.defineProperty(this, "state", {
|
|
18187
|
+
enumerable: true,
|
|
18188
|
+
configurable: true,
|
|
18189
|
+
writable: true,
|
|
18190
|
+
value: {
|
|
18191
|
+
visible: false,
|
|
18192
|
+
enabled: true,
|
|
18193
|
+
disposed: false,
|
|
18194
|
+
}
|
|
18195
|
+
});
|
|
18196
|
+
Object.defineProperty(this, "data", {
|
|
18197
|
+
enumerable: true,
|
|
18198
|
+
configurable: true,
|
|
18199
|
+
writable: true,
|
|
18200
|
+
value: void 0
|
|
18201
|
+
});
|
|
18202
|
+
Object.defineProperty(this, "linesGroup", {
|
|
18203
|
+
enumerable: true,
|
|
18204
|
+
configurable: true,
|
|
18205
|
+
writable: true,
|
|
18206
|
+
value: void 0
|
|
18207
|
+
});
|
|
18208
|
+
Object.defineProperty(this, "disposedErrorLog", {
|
|
18209
|
+
enumerable: true,
|
|
18210
|
+
configurable: true,
|
|
18211
|
+
writable: true,
|
|
18212
|
+
value: () => {
|
|
18213
|
+
console.error(`${PLUGIN$1} is disposed`);
|
|
18214
|
+
}
|
|
18215
|
+
});
|
|
18216
|
+
Object.defineProperty(this, "actionWhenEnabled", {
|
|
18217
|
+
enumerable: true,
|
|
18218
|
+
configurable: true,
|
|
18219
|
+
writable: true,
|
|
18220
|
+
value: (func) => {
|
|
18221
|
+
if (this.state.enabled)
|
|
18222
|
+
return func();
|
|
18223
|
+
}
|
|
18224
|
+
});
|
|
18225
|
+
Object.assign(window, { [`__${PLUGIN_NAME$1}_DEBUG__`]: this });
|
|
18226
|
+
}
|
|
18227
|
+
async load(serverData, state, userAction = true) {
|
|
18228
|
+
const prevData = this.data ? JSON.parse(JSON.stringify(this.data)) : undefined;
|
|
18229
|
+
// format server data to plugin data
|
|
18230
|
+
const data = await this.formatData(serverData);
|
|
18231
|
+
this.hooks.emit('dataChange', data, prevData);
|
|
18232
|
+
this.data = data;
|
|
18233
|
+
// render line group
|
|
18234
|
+
if (this.linesGroup)
|
|
18235
|
+
this.five.scene.remove(this.linesGroup);
|
|
18236
|
+
const linesGroup = this.getLinesGroup(data.routes);
|
|
18237
|
+
if (!linesGroup)
|
|
18238
|
+
return Promise.reject(new Error('no line'));
|
|
18239
|
+
this.linesGroup = linesGroup;
|
|
18240
|
+
this.five.scene.add(linesGroup);
|
|
18241
|
+
this.handleVisible(this.state.visible);
|
|
18242
|
+
this.handleEnable(this.state.enabled);
|
|
18243
|
+
// initialize plugin state
|
|
18244
|
+
if (state)
|
|
18245
|
+
this.setState(state);
|
|
18246
|
+
// load end
|
|
18247
|
+
this.five.needsRender = true;
|
|
18248
|
+
this.hooks.emit('dataLoaded', data);
|
|
18249
|
+
console.log(`${PLUGIN$1} loaded`, data);
|
|
18250
|
+
}
|
|
18251
|
+
async formatData(serverData) {
|
|
18252
|
+
if (typeof serverData === 'object' && serverData !== null && serverData.version && serverData.data) {
|
|
18253
|
+
return serverData.data;
|
|
18254
|
+
}
|
|
18255
|
+
return serverData;
|
|
18256
|
+
}
|
|
18257
|
+
async show(options) {
|
|
18258
|
+
this.setState({ visible: true }, options);
|
|
18259
|
+
}
|
|
18260
|
+
async hide(options) {
|
|
18261
|
+
this.setState({ visible: false }, options);
|
|
18262
|
+
}
|
|
18263
|
+
enable(options) {
|
|
18264
|
+
this.setState({ enabled: true }, options);
|
|
18265
|
+
}
|
|
18266
|
+
disable(options) {
|
|
18267
|
+
this.setState({ enabled: false }, options);
|
|
18268
|
+
}
|
|
18269
|
+
dispose() {
|
|
18270
|
+
this.setState({ disposed: true });
|
|
18271
|
+
}
|
|
18272
|
+
setState(state, options) {
|
|
18273
|
+
var _a;
|
|
18274
|
+
if (this.state.disposed)
|
|
18275
|
+
return this.disposedErrorLog();
|
|
18276
|
+
const prevState = Object.assign({}, this.state);
|
|
18277
|
+
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
18278
|
+
if (state.disposed !== undefined && state.disposed !== prevState.disposed) {
|
|
18279
|
+
if (state.disposed)
|
|
18280
|
+
this.handleDispose();
|
|
18281
|
+
}
|
|
18282
|
+
if (state.visible !== undefined && state.visible !== prevState.visible) {
|
|
18283
|
+
this.handleVisible(state.visible, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18284
|
+
}
|
|
18285
|
+
if (state.enabled !== undefined && state.enabled !== prevState.enabled) {
|
|
18286
|
+
this.handleEnable(state.enabled, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18287
|
+
}
|
|
18288
|
+
if (!equal(prevState, this.state, { deep: true })) {
|
|
18289
|
+
this.hooks.emit('stateChange', { state: this.state, prevState, userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true });
|
|
18290
|
+
this.five.needsRender = true;
|
|
18291
|
+
}
|
|
18292
|
+
}
|
|
18293
|
+
handleEnable(enabled, userAction = true) {
|
|
18294
|
+
if (this.linesGroup) {
|
|
18295
|
+
if (enabled) {
|
|
18296
|
+
this.five.scene.add(this.linesGroup);
|
|
18297
|
+
this.actionWhenEnabled(() => this.hooks.emit('enable', { userAction }));
|
|
18298
|
+
}
|
|
18299
|
+
else {
|
|
18300
|
+
this.five.scene.remove(this.linesGroup);
|
|
18301
|
+
this.hooks.emit('disable', { userAction });
|
|
18302
|
+
}
|
|
18303
|
+
}
|
|
18304
|
+
}
|
|
18305
|
+
handleVisible(visible, userAction = true) {
|
|
18306
|
+
if (this.linesGroup) {
|
|
18307
|
+
if (visible) {
|
|
18308
|
+
this.linesGroup.visible = true;
|
|
18309
|
+
this.actionWhenEnabled(() => this.hooks.emit('show', { userAction }));
|
|
18310
|
+
}
|
|
18311
|
+
else {
|
|
18312
|
+
this.linesGroup.visible = false;
|
|
18313
|
+
this.actionWhenEnabled(() => this.hooks.emit('hide', { userAction }));
|
|
18314
|
+
}
|
|
18315
|
+
}
|
|
18316
|
+
}
|
|
18317
|
+
handleDispose() {
|
|
18318
|
+
if (this.linesGroup)
|
|
18319
|
+
this.five.scene.add(this.linesGroup);
|
|
18320
|
+
}
|
|
18321
|
+
/**
|
|
18322
|
+
* 获取多条路线的 Mesh Group
|
|
18323
|
+
*/
|
|
18324
|
+
getLinesGroup(routes) {
|
|
18325
|
+
/** 'as THREE.Mesh[]' for build check */
|
|
18326
|
+
const meshes = routes.map(this.getLineMesh.bind(this)).filter(notNil);
|
|
18327
|
+
const group = new THREE.Group();
|
|
18328
|
+
group.name = pluginFlag('route-group');
|
|
18329
|
+
if (meshes.length === 0)
|
|
18330
|
+
return;
|
|
18331
|
+
group.add(...meshes);
|
|
18332
|
+
return group;
|
|
18333
|
+
}
|
|
18334
|
+
/**
|
|
18335
|
+
* 获取单条路线的 Mesh
|
|
18336
|
+
*/
|
|
18337
|
+
getLineMesh(data) {
|
|
18338
|
+
const positions = data.panoIndexList.map((panoIndex) => { var _a; return (_a = this.five.work.observers[panoIndex]) === null || _a === void 0 ? void 0 : _a.standingPosition; }).filter(notNil);
|
|
18339
|
+
const geometry = getLineGeometry(positions);
|
|
18340
|
+
if (!geometry)
|
|
18341
|
+
return;
|
|
18342
|
+
const material = getArrowMaterial({ textureUtl: data.arrowTextureUrl });
|
|
18343
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
18344
|
+
mesh.name = pluginFlag('route-line-mesh');
|
|
18345
|
+
mesh.renderOrder = 3;
|
|
18346
|
+
return mesh;
|
|
18347
|
+
}
|
|
18348
|
+
}
|
|
18349
|
+
Object.defineProperty(Controller, "lasestVersion", {
|
|
18350
|
+
enumerable: true,
|
|
18351
|
+
configurable: true,
|
|
18352
|
+
writable: true,
|
|
18353
|
+
value: VERSION$1
|
|
18354
|
+
});
|
|
18355
|
+
|
|
18356
|
+
const GuideLinePlugin = (five) => new Controller(five);
|
|
18357
|
+
|
|
18358
|
+
/** 坐标转换成单位向量 */
|
|
18359
|
+
function coordinatesToVector(coordinates) {
|
|
18360
|
+
const distance = Math.abs(Math.cos(coordinates.latitude));
|
|
18361
|
+
return new THREE.Vector3(
|
|
18362
|
+
/* x */ -Math.sin(coordinates.longitude) * distance,
|
|
18363
|
+
/* y */ -Math.sin(coordinates.latitude),
|
|
18364
|
+
/* z */ -Math.cos(coordinates.longitude) * distance);
|
|
18365
|
+
}
|
|
18366
|
+
|
|
18367
|
+
/**
|
|
18368
|
+
* @description: 获取coordinates间的夹角
|
|
18369
|
+
* @return {number} 夹角角度
|
|
18370
|
+
*/
|
|
18371
|
+
function coordinatesAngle(coordinates1, coordinates2) {
|
|
18372
|
+
const vector1 = coordinatesToVector(coordinates1);
|
|
18373
|
+
const vector2 = coordinatesToVector(coordinates2);
|
|
18374
|
+
const angle = vector1.angleTo(vector2);
|
|
18375
|
+
return angle;
|
|
18376
|
+
}
|
|
18377
|
+
|
|
18378
|
+
const safeCall = async (fn) => {
|
|
18379
|
+
try {
|
|
18380
|
+
// eslint-disable-next-line prettier/prettier
|
|
18381
|
+
fn().then(() => { }, () => { }).catch(() => { });
|
|
18382
|
+
}
|
|
18383
|
+
catch (e) { }
|
|
18384
|
+
};
|
|
18385
|
+
|
|
18386
|
+
const TAU = Math.PI * 2;
|
|
18387
|
+
/**
|
|
18388
|
+
* 将弧度转成 0 - 2PI 中的值
|
|
18389
|
+
* @param rad - 任意弧度值
|
|
18390
|
+
* @return 0 - 2PI 的数值
|
|
18391
|
+
*/
|
|
18392
|
+
function formatRad(rad) {
|
|
18393
|
+
if (rad >= 0 && rad < TAU)
|
|
18394
|
+
return rad;
|
|
18395
|
+
return ((rad % TAU) + TAU) % TAU;
|
|
18396
|
+
}
|
|
18397
|
+
|
|
18398
|
+
/** 单位向量转换成坐标 */
|
|
18399
|
+
function vectorToCoordinates(vector) {
|
|
18400
|
+
return {
|
|
18401
|
+
longitude: formatRad(-Math.atan2(vector.x, -vector.z)),
|
|
18402
|
+
latitude: -Math.asin(vector.y / 1),
|
|
18403
|
+
};
|
|
18404
|
+
}
|
|
18405
|
+
|
|
18406
|
+
// eslint-disable-next-line max-params
|
|
18407
|
+
function linerValue(x0, v0, t1, t) {
|
|
18408
|
+
const a = -x0 / t1;
|
|
18409
|
+
const d = x0;
|
|
18410
|
+
return a * t + d;
|
|
18411
|
+
}
|
|
18412
|
+
|
|
18413
|
+
const VERSION = 'v1.0.5';
|
|
18414
|
+
const PLUGIN_NAME = 'CruisePlugin';
|
|
18415
|
+
const PLUGIN = `${PLUGIN_NAME}@${VERSION}`;
|
|
18416
|
+
const disposedErrorLog = () => {
|
|
18417
|
+
console.error(`${PLUGIN} is disposed`);
|
|
18418
|
+
};
|
|
18419
|
+
const disableWarnLog = () => {
|
|
18420
|
+
console.warn(`${PLUGIN} is disabled`);
|
|
18421
|
+
};
|
|
18422
|
+
const disableErrorLog = () => {
|
|
18423
|
+
console.error(`${PLUGIN} is disabled`);
|
|
18424
|
+
};
|
|
18425
|
+
const pauseDataMap = new Map();
|
|
18426
|
+
class CruisePluginController extends Controller$6 {
|
|
18427
|
+
constructor(five) {
|
|
18428
|
+
super(five);
|
|
18429
|
+
Object.defineProperty(this, "state", {
|
|
18430
|
+
enumerable: true,
|
|
18431
|
+
configurable: true,
|
|
18432
|
+
writable: true,
|
|
18433
|
+
value: {
|
|
18434
|
+
visible: true,
|
|
18435
|
+
enabled: true,
|
|
18436
|
+
disposed: false,
|
|
18437
|
+
playing: false,
|
|
18438
|
+
speed: 1,
|
|
18439
|
+
config: {
|
|
18440
|
+
speedConfig: {
|
|
18441
|
+
rotateSpeed: 0.001,
|
|
18442
|
+
rotateSpeedUnit: 'rad/ms',
|
|
18443
|
+
moveSpeed: 0.003,
|
|
18444
|
+
moveSpeedUnit: 'm/ms',
|
|
18445
|
+
},
|
|
18446
|
+
},
|
|
18447
|
+
}
|
|
18448
|
+
});
|
|
18449
|
+
Object.defineProperty(this, "data", {
|
|
18450
|
+
enumerable: true,
|
|
18451
|
+
configurable: true,
|
|
18452
|
+
writable: true,
|
|
18453
|
+
value: void 0
|
|
18454
|
+
});
|
|
18455
|
+
Object.defineProperty(this, "privateState", {
|
|
18456
|
+
enumerable: true,
|
|
18457
|
+
configurable: true,
|
|
18458
|
+
writable: true,
|
|
18459
|
+
value: {
|
|
18460
|
+
playing: false,
|
|
18461
|
+
currentPlayQueue: [],
|
|
18462
|
+
currentPlayKeyframe: null,
|
|
18463
|
+
broke: false,
|
|
18464
|
+
disposers: [],
|
|
18465
|
+
}
|
|
18466
|
+
});
|
|
18467
|
+
Object.defineProperty(this, "GuideLine", {
|
|
18468
|
+
enumerable: true,
|
|
18469
|
+
configurable: true,
|
|
18470
|
+
writable: true,
|
|
18471
|
+
value: void 0
|
|
18472
|
+
});
|
|
18473
|
+
Object.assign(window, { [`__${PLUGIN_NAME}_DEBUG__`]: this });
|
|
18474
|
+
const setFiveLinearUpdateCamera = this.setFiveLinearUpdateCamera.bind(this);
|
|
18475
|
+
const setFiveOriginUpdateCamera = this.setFiveOriginUpdateCamera.bind(this);
|
|
18476
|
+
this.hooks.on('play', setFiveLinearUpdateCamera);
|
|
18477
|
+
this.hooks.on('broke', setFiveOriginUpdateCamera);
|
|
18478
|
+
this.hooks.on('end', setFiveOriginUpdateCamera);
|
|
18479
|
+
this.hooks.on('pause', setFiveOriginUpdateCamera);
|
|
18480
|
+
this.privateState.disposers.push(() => {
|
|
18481
|
+
this.hooks.off('play', setFiveLinearUpdateCamera);
|
|
18482
|
+
this.hooks.off('broke', setFiveOriginUpdateCamera);
|
|
18483
|
+
this.hooks.off('end', setFiveOriginUpdateCamera);
|
|
18484
|
+
this.hooks.off('pause', setFiveOriginUpdateCamera);
|
|
18485
|
+
});
|
|
18486
|
+
}
|
|
18487
|
+
/**
|
|
18488
|
+
* @description Load Data and State
|
|
18489
|
+
*/
|
|
18490
|
+
async load(serverData, state, userAction) {
|
|
18491
|
+
var _a, _b, _c, _d, _e;
|
|
18492
|
+
if (this.state.disposed)
|
|
18493
|
+
return disposedErrorLog();
|
|
18494
|
+
if (!this.privateState.fiveOriginGetProgress) {
|
|
18495
|
+
if (!((_b = (_a = this.five.controller) === null || _a === void 0 ? void 0 : _a.cameraMotion) === null || _b === void 0 ? void 0 : _b.getProgress)) {
|
|
18496
|
+
await this.waitFiveLoaded();
|
|
18497
|
+
this.privateState.fiveOriginGetProgress = (_d = (_c = this.five.controller) === null || _c === void 0 ? void 0 : _c.cameraMotion) === null || _d === void 0 ? void 0 : _d.getProgress;
|
|
18498
|
+
}
|
|
18499
|
+
}
|
|
18500
|
+
this.clear();
|
|
18501
|
+
// copy this.data
|
|
18502
|
+
const prevData = this.data ? JSON.parse(JSON.stringify(this.data)) : undefined;
|
|
18503
|
+
// format server data to plugin data
|
|
18504
|
+
const data = await this.formatData(serverData);
|
|
18505
|
+
this.data = data;
|
|
18506
|
+
this.hooks.emit('dataChange', data, prevData);
|
|
18507
|
+
let guideLinePanoIndex = [];
|
|
18508
|
+
let tempFloorIndex;
|
|
18509
|
+
// filter panoIndex list Data
|
|
18510
|
+
const hasPanoIndexKeyframes = this.data.keyframes.filter((keyframe) => keyframe.data.panoIndex !== undefined);
|
|
18511
|
+
hasPanoIndexKeyframes
|
|
18512
|
+
.filter((keyframe, index) => { var _a; return keyframe.data.panoIndex !== ((_a = hasPanoIndexKeyframes[index - 1]) === null || _a === void 0 ? void 0 : _a.data.panoIndex); })
|
|
18513
|
+
.map((keyframe) => keyframe.data.panoIndex)
|
|
18514
|
+
.forEach((panoIndex) => {
|
|
18515
|
+
var _a, _b;
|
|
18516
|
+
const floorIndex = (_a = this.five.work.observers[panoIndex]) === null || _a === void 0 ? void 0 : _a.floorIndex;
|
|
18517
|
+
if (floorIndex === undefined)
|
|
18518
|
+
return;
|
|
18519
|
+
if (tempFloorIndex === floorIndex) {
|
|
18520
|
+
const index = guideLinePanoIndex.length - 1;
|
|
18521
|
+
guideLinePanoIndex[index] = [...((_b = guideLinePanoIndex[index]) !== null && _b !== void 0 ? _b : []), panoIndex];
|
|
18522
|
+
}
|
|
18523
|
+
else {
|
|
18524
|
+
tempFloorIndex = floorIndex;
|
|
18525
|
+
const index = guideLinePanoIndex.length;
|
|
18526
|
+
guideLinePanoIndex[index] = [panoIndex];
|
|
18527
|
+
}
|
|
18528
|
+
});
|
|
18529
|
+
// initialize GuideLinePlugin
|
|
18530
|
+
if (!this.GuideLine)
|
|
18531
|
+
this.GuideLine = GuideLinePlugin(this.five);
|
|
18532
|
+
// load GuideLine
|
|
18533
|
+
(_e = this.GuideLine) === null || _e === void 0 ? void 0 : _e.load({ routes: guideLinePanoIndex.map((route) => ({ panoIndexList: route })) });
|
|
18534
|
+
// first pause
|
|
18535
|
+
this.setState({ playing: false });
|
|
18536
|
+
// set state
|
|
18537
|
+
this.handleVisible(this.state.visible);
|
|
18538
|
+
this.handleEnable(this.state.enabled);
|
|
18539
|
+
this.changePlayState(this.state.playing);
|
|
18540
|
+
this.changeSpeed(this.state.speed);
|
|
18541
|
+
// initialize plugin state
|
|
18542
|
+
if (state)
|
|
18543
|
+
this.setState(state, { userAction });
|
|
18544
|
+
// load end
|
|
18545
|
+
console.log(`${PLUGIN} loaded`, data);
|
|
18546
|
+
this.hooks.emit('dataLoaded', data);
|
|
18547
|
+
}
|
|
18548
|
+
/**
|
|
18549
|
+
* @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
|
|
18550
|
+
*/
|
|
18551
|
+
play(options) {
|
|
18552
|
+
this.setState({ playing: true }, options);
|
|
18553
|
+
}
|
|
18554
|
+
/**
|
|
18555
|
+
* @description If playing, first pause, then play from keyframes index/id
|
|
18556
|
+
* @param {number} options.index play from keyframes index
|
|
18557
|
+
* @param {string} options.id play from keyframes id
|
|
18558
|
+
*/
|
|
18559
|
+
playFrom(options) {
|
|
18560
|
+
const { index, id, userAction } = options;
|
|
18561
|
+
if (this.state.playing)
|
|
18562
|
+
this.setState({ playing: false }, { userAction });
|
|
18563
|
+
this.setState({ playing: true }, { userAction, playFromIndex: index, playFromId: id });
|
|
18564
|
+
}
|
|
18565
|
+
/**
|
|
18566
|
+
* @description Play from first keyframe
|
|
18567
|
+
*/
|
|
18568
|
+
playFromStart(options) {
|
|
18569
|
+
return this.playFrom(Object.assign(Object.assign({}, options), { index: 0 }));
|
|
18570
|
+
}
|
|
18571
|
+
/**
|
|
18572
|
+
* @description Pause
|
|
18573
|
+
*/
|
|
18574
|
+
pause(options) {
|
|
18575
|
+
this.setState({ playing: false }, options);
|
|
18576
|
+
}
|
|
18577
|
+
/**
|
|
18578
|
+
* @description Show guide line
|
|
18579
|
+
*/
|
|
18580
|
+
async show(options) {
|
|
18581
|
+
this.setState({ visible: true }, options);
|
|
18582
|
+
}
|
|
18583
|
+
/**
|
|
18584
|
+
* @description Hide guide line
|
|
18585
|
+
*/
|
|
18586
|
+
async hide(options) {
|
|
18587
|
+
this.setState({ visible: false }, options);
|
|
18588
|
+
}
|
|
18589
|
+
/**
|
|
18590
|
+
* @description Enable
|
|
18591
|
+
*/
|
|
18592
|
+
enable(options) {
|
|
18593
|
+
this.setState({ enabled: true }, options);
|
|
18594
|
+
}
|
|
18595
|
+
/**
|
|
18596
|
+
* @description Disable
|
|
18597
|
+
*/
|
|
18598
|
+
disable(options) {
|
|
18599
|
+
this.setState({ enabled: false }, options);
|
|
18600
|
+
}
|
|
18601
|
+
/**
|
|
18602
|
+
* @description Dispose
|
|
18603
|
+
*/
|
|
18604
|
+
dispose() {
|
|
18605
|
+
this.setState({ disposed: true });
|
|
18606
|
+
}
|
|
18607
|
+
/**
|
|
18608
|
+
* @description Set state
|
|
18609
|
+
*/
|
|
18610
|
+
setState(state, options) {
|
|
18611
|
+
var _a;
|
|
18612
|
+
if (this.state.disposed)
|
|
18613
|
+
return disposedErrorLog();
|
|
18614
|
+
if (!this.state.enabled) {
|
|
18615
|
+
// when plugin is disabled, only can change enabled or disposed to true
|
|
18616
|
+
if (state.enabled !== true && state.disposed !== true)
|
|
18617
|
+
return disableErrorLog();
|
|
18618
|
+
}
|
|
18619
|
+
const prevState = Object.assign({}, this.state);
|
|
18620
|
+
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
18621
|
+
if (state.disposed !== undefined && state.disposed !== prevState.disposed) {
|
|
18622
|
+
if (state.disposed)
|
|
18623
|
+
this.handleDispose();
|
|
18624
|
+
}
|
|
18625
|
+
if (state.visible !== undefined && state.visible !== prevState.visible) {
|
|
18626
|
+
this.handleVisible(state.visible, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18627
|
+
}
|
|
18628
|
+
if (state.enabled !== undefined && state.enabled !== prevState.enabled) {
|
|
18629
|
+
this.handleEnable(state.enabled, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18630
|
+
}
|
|
18631
|
+
if (state.playing !== undefined && state.playing !== prevState.playing) {
|
|
18632
|
+
this.changePlayState(state.playing, options);
|
|
18633
|
+
}
|
|
18634
|
+
if (state.speed !== undefined && state.speed !== prevState.speed) {
|
|
18635
|
+
this.changeSpeed(state.speed, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18636
|
+
}
|
|
18637
|
+
if (!equal(prevState, this.state, { deep: true })) {
|
|
18638
|
+
console.log('--emit stateChange--', this.state);
|
|
18639
|
+
this.hooks.emit('stateChange', { state: this.state, prevState, userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true });
|
|
18640
|
+
}
|
|
18641
|
+
}
|
|
18642
|
+
/**
|
|
18643
|
+
* @description Format data
|
|
18644
|
+
*/
|
|
18645
|
+
async formatData(serverData) {
|
|
18646
|
+
if (!this.five.work)
|
|
18647
|
+
await this.waitFiveLoaded();
|
|
18648
|
+
const observers = this.five.work.observers;
|
|
18649
|
+
const data = (() => {
|
|
18650
|
+
const _serverData = serverData;
|
|
18651
|
+
if (typeof _serverData === 'object' && _serverData !== null && _serverData.version && _serverData.data) {
|
|
18652
|
+
return _serverData.data;
|
|
18653
|
+
}
|
|
18654
|
+
return _serverData;
|
|
18655
|
+
})();
|
|
18656
|
+
if (data.keyframes) {
|
|
18657
|
+
return {
|
|
18658
|
+
keyframesId: uuid(),
|
|
18659
|
+
keyframes: data.keyframes.map((keyframe, index) => { var _a; return (Object.assign({ id: (_a = keyframe.uuid) !== null && _a !== void 0 ? _a : uuid(), index }, keyframe)); }),
|
|
18660
|
+
};
|
|
18661
|
+
}
|
|
18662
|
+
else if (data.panoIndexList) {
|
|
18663
|
+
let keyframes = [];
|
|
18664
|
+
const moveEffect = data.moveEffect;
|
|
18665
|
+
data.panoIndexList
|
|
18666
|
+
.filter((panoIndex, index) => panoIndex !== data.panoIndexList[index - 1])
|
|
18667
|
+
.forEach((panoIndex, index) => {
|
|
18668
|
+
const lookatNextPanoIndex = (() => {
|
|
18669
|
+
var _a, _b, _c, _d;
|
|
18670
|
+
const nextPanoIndex = data.panoIndexList[index + 1];
|
|
18671
|
+
if (nextPanoIndex === undefined)
|
|
18672
|
+
return;
|
|
18673
|
+
const vectorFrom = (_a = observers[panoIndex]) === null || _a === void 0 ? void 0 : _a.position;
|
|
18674
|
+
const vectorTo = (_b = observers[nextPanoIndex]) === null || _b === void 0 ? void 0 : _b.position;
|
|
18675
|
+
if (!vectorTo || !vectorFrom)
|
|
18676
|
+
return;
|
|
18677
|
+
// if panoIndex and next panoIndex isn't in same floor, return
|
|
18678
|
+
if (((_c = observers[panoIndex]) === null || _c === void 0 ? void 0 : _c.floorIndex) !== ((_d = observers[nextPanoIndex]) === null || _d === void 0 ? void 0 : _d.floorIndex))
|
|
18679
|
+
return;
|
|
18680
|
+
const vector = new THREE.Vector3().subVectors(vectorTo, vectorFrom);
|
|
18681
|
+
return vectorToCoordinates(vector);
|
|
18682
|
+
})();
|
|
18683
|
+
if (data.moveType === undefined || data.moveType === 'justMove') {
|
|
18684
|
+
// move to panoIndex, latitude, longitude
|
|
18685
|
+
keyframes.push({ data: Object.assign({ effect: 'Move', panoIndex, moveEffect }, (lookatNextPanoIndex !== null && lookatNextPanoIndex !== void 0 ? lookatNextPanoIndex : {})) });
|
|
18686
|
+
}
|
|
18687
|
+
else if (data.moveType === 'moveAndRotate') {
|
|
18688
|
+
// move to panoIndex, then rotate to latitude and longitude
|
|
18689
|
+
keyframes.push({ data: { effect: 'Move', panoIndex, moveEffect } });
|
|
18690
|
+
if (lookatNextPanoIndex)
|
|
18691
|
+
keyframes.push({ data: Object.assign({ effect: 'Rotate', panoIndex }, lookatNextPanoIndex) });
|
|
18692
|
+
}
|
|
18693
|
+
});
|
|
18694
|
+
return { keyframesId: uuid(), keyframes: keyframes.map((keyframe, index) => (Object.assign({ id: uuid(), index }, keyframe))) };
|
|
18695
|
+
}
|
|
18696
|
+
else {
|
|
18697
|
+
throw new Error('format error: data no keyframes or no panoIndexList');
|
|
18698
|
+
}
|
|
18699
|
+
}
|
|
18700
|
+
handleEnable(enabled, userAction = true) {
|
|
18701
|
+
var _a, _b;
|
|
18702
|
+
if (enabled) {
|
|
18703
|
+
(_a = this.GuideLine) === null || _a === void 0 ? void 0 : _a.enable();
|
|
18704
|
+
this.hooks.emit('enable', { userAction });
|
|
18705
|
+
}
|
|
18706
|
+
else {
|
|
18707
|
+
(_b = this.GuideLine) === null || _b === void 0 ? void 0 : _b.disable();
|
|
18708
|
+
this.changePlayState(false, { userAction });
|
|
18709
|
+
this.hooks.emit('disable', { userAction });
|
|
18710
|
+
}
|
|
18711
|
+
this.state.enabled = enabled;
|
|
18712
|
+
}
|
|
18713
|
+
handleVisible(visible, userAction = true) {
|
|
18714
|
+
var _a, _b;
|
|
18715
|
+
if (visible) {
|
|
18716
|
+
(_a = this.GuideLine) === null || _a === void 0 ? void 0 : _a.show();
|
|
18717
|
+
this.actionIfStateIsEnabled(() => this.hooks.emit('show', { userAction }));
|
|
18718
|
+
}
|
|
18719
|
+
else {
|
|
18720
|
+
(_b = this.GuideLine) === null || _b === void 0 ? void 0 : _b.hide();
|
|
18721
|
+
this.actionIfStateIsEnabled(() => this.hooks.emit('hide', { userAction }));
|
|
18722
|
+
}
|
|
18723
|
+
this.state.visible = visible;
|
|
18724
|
+
}
|
|
18725
|
+
changePlayState(play, options) {
|
|
18726
|
+
this.actionIfStateIsEnabled(() => { var _a; return this.hooks.emit('playStateChange', play ? 'playing' : 'pause', { userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true }); });
|
|
18727
|
+
play ? this.handlePlay(options) : this.handlePause(options);
|
|
18728
|
+
this.state.playing = play;
|
|
18729
|
+
}
|
|
18730
|
+
/**
|
|
18731
|
+
* @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
|
|
18732
|
+
* @param {number} options.playFromIndex play from keyframes index
|
|
18733
|
+
* @param {string} options.playFromId play from keyframes id
|
|
18734
|
+
*/
|
|
18735
|
+
// eslint-disable-next-line complexity
|
|
18736
|
+
async handlePlay(options) {
|
|
18737
|
+
var _a;
|
|
18738
|
+
const { data, state, privateState, hooks } = this;
|
|
18739
|
+
// check whether keyframes can be played
|
|
18740
|
+
if (privateState.playing)
|
|
18741
|
+
return;
|
|
18742
|
+
if (!(data === null || data === void 0 ? void 0 : data.keyframes) || (data === null || data === void 0 ? void 0 : data.keyframes.length) === 0)
|
|
18743
|
+
return;
|
|
18744
|
+
// set current play id
|
|
18745
|
+
const currentPlayId = uuid();
|
|
18746
|
+
// if handlePlay function is called again before play end, currentPlayId isn't equal to privateState.playId
|
|
18747
|
+
privateState.playId = currentPlayId;
|
|
18748
|
+
// set state
|
|
18749
|
+
privateState.playing = true;
|
|
18750
|
+
privateState.broke = false;
|
|
18751
|
+
const keyframes = data.keyframes;
|
|
18752
|
+
const pauseData = this.getPauseData();
|
|
18753
|
+
if ((options === null || options === void 0 ? void 0 : options.notEmitEvent) !== true) {
|
|
18754
|
+
hooks.emit('play', { userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true });
|
|
18755
|
+
}
|
|
18756
|
+
const getPlayFromIndex = async () => {
|
|
18757
|
+
var _a, _b;
|
|
18758
|
+
// play from index
|
|
18759
|
+
if ((options === null || options === void 0 ? void 0 : options.playFromIndex) !== undefined)
|
|
18760
|
+
return options.playFromIndex;
|
|
18761
|
+
// play from id
|
|
18762
|
+
else if ((options === null || options === void 0 ? void 0 : options.playFromId) !== undefined)
|
|
18763
|
+
return (_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframes.findIndex((keyframe) => keyframe.id === options.playFromId);
|
|
18764
|
+
// play from pause position
|
|
18765
|
+
else if (pauseData === null || pauseData === void 0 ? void 0 : pauseData.keyframeId) {
|
|
18766
|
+
const pausedKeyframe = (_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframes.find((keyframe) => keyframe.id === pauseData.keyframeId);
|
|
18767
|
+
// restore paused state
|
|
18768
|
+
if (pauseData === null || pauseData === void 0 ? void 0 : pauseData.fiveState)
|
|
18769
|
+
await this.move(pauseData.fiveState);
|
|
18770
|
+
if (pausedKeyframe) {
|
|
18771
|
+
if (pausedKeyframe.data.effect === 'Move')
|
|
18772
|
+
return pausedKeyframe.index;
|
|
18773
|
+
else if (pausedKeyframe.data.effect === 'Rotate') {
|
|
18774
|
+
const duration = pauseData.duration !== undefined ? pauseData.duration * (1 - pauseData.playedProgress) : undefined;
|
|
18775
|
+
await this.playKeyframe(pausedKeyframe, duration);
|
|
18776
|
+
// playFromIndex += 1 cause played last part of paused keyframe
|
|
18777
|
+
return pausedKeyframe.index + 1;
|
|
18778
|
+
}
|
|
18779
|
+
}
|
|
18780
|
+
}
|
|
18781
|
+
};
|
|
18782
|
+
const playFromIndex = await getPlayFromIndex();
|
|
18783
|
+
this.clearPauseData();
|
|
18784
|
+
// play keyframes
|
|
18785
|
+
for (const keyframe of keyframes) {
|
|
18786
|
+
if (privateState.broke || !state.playing || !privateState.playing)
|
|
18787
|
+
return;
|
|
18788
|
+
if (currentPlayId !== privateState.playId)
|
|
18789
|
+
return;
|
|
18790
|
+
// jump to start keyframe
|
|
18791
|
+
if (playFromIndex !== undefined && keyframe.index < playFromIndex)
|
|
18792
|
+
continue;
|
|
18793
|
+
// play single keyframe
|
|
18794
|
+
try {
|
|
18795
|
+
console.log('playIndexChange', keyframe.index);
|
|
18796
|
+
hooks.emit('playIndexChange', keyframe.index, keyframe);
|
|
18797
|
+
await this.playKeyframe(keyframe);
|
|
18798
|
+
}
|
|
18799
|
+
catch (error) {
|
|
18800
|
+
return Promise.resolve('broke');
|
|
18801
|
+
// if think play be interupted by five gesture is an error, return Promise.reject(error)
|
|
18802
|
+
// return Promise.reject(error)
|
|
18803
|
+
}
|
|
18804
|
+
}
|
|
18805
|
+
if (state.playing && currentPlayId === privateState.playId) {
|
|
18806
|
+
this.setState({ playing: false }, { userAction: false });
|
|
18807
|
+
console.log('--emit end--');
|
|
18808
|
+
hooks.emit('end');
|
|
18809
|
+
this.clearPauseData();
|
|
18810
|
+
}
|
|
18811
|
+
}
|
|
18812
|
+
/**
|
|
18813
|
+
* @description: Pause and record pause state
|
|
18814
|
+
*/
|
|
18815
|
+
handlePause(options) {
|
|
18816
|
+
var _a;
|
|
18817
|
+
const { state, privateState, hooks } = this;
|
|
18818
|
+
state.playing = false;
|
|
18819
|
+
if (privateState.playing === false)
|
|
18820
|
+
return;
|
|
18821
|
+
privateState.playing = false;
|
|
18822
|
+
this.setPauseData();
|
|
18823
|
+
if (!privateState.broke)
|
|
18824
|
+
this.forceInteruptUpdateCamera();
|
|
18825
|
+
console.log('--emit pause--');
|
|
18826
|
+
if ((options === null || options === void 0 ? void 0 : options.notEmitEvent) !== true) {
|
|
18827
|
+
hooks.emit('pause', { userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true });
|
|
18828
|
+
}
|
|
18829
|
+
}
|
|
18830
|
+
/**
|
|
18831
|
+
* @description Play single keyframe
|
|
18832
|
+
*/
|
|
18833
|
+
async playKeyframe(keyframe, duration) {
|
|
18834
|
+
var _a;
|
|
18835
|
+
const { privateState } = this;
|
|
18836
|
+
if (((_a = this.privateState.currentPlayKeyframe) === null || _a === void 0 ? void 0 : _a.keyframe.id) !== keyframe.id)
|
|
18837
|
+
this.privateState.currentPlayKeyframe = { keyframe };
|
|
18838
|
+
privateState.currentPlayQueue.push(this.getPlayPromise(keyframe, duration));
|
|
18839
|
+
return this.actionPromiseQueue();
|
|
18840
|
+
}
|
|
18841
|
+
/**
|
|
18842
|
+
* @description: listen interupted by five gesture
|
|
18843
|
+
*/
|
|
18844
|
+
addInterruptListener(callback) {
|
|
18845
|
+
this.five.once('gesture', callback);
|
|
18846
|
+
this.five.once('modeChange', callback);
|
|
18847
|
+
return () => {
|
|
18848
|
+
this.five.off('gesture', callback);
|
|
18849
|
+
this.five.once('modeChange', callback);
|
|
18850
|
+
};
|
|
18851
|
+
}
|
|
18852
|
+
/**
|
|
18853
|
+
* @description: getPlayPromise
|
|
18854
|
+
*/
|
|
18855
|
+
async getPlayPromise(keyframe, paramsDuration) {
|
|
18856
|
+
const data = keyframe.data;
|
|
18857
|
+
const duration = paramsDuration !== null && paramsDuration !== void 0 ? paramsDuration : (keyframe.start !== undefined && keyframe.end !== undefined ? keyframe.end - keyframe.start : undefined);
|
|
18858
|
+
if (!data)
|
|
18859
|
+
return;
|
|
18860
|
+
return new Promise((resolve, reject) => {
|
|
18861
|
+
let fulfilled = false;
|
|
18862
|
+
this.addInterruptListener(() => {
|
|
18863
|
+
if (fulfilled)
|
|
18864
|
+
return;
|
|
18865
|
+
console.log('--emit broke--');
|
|
18866
|
+
this.hooks.emit('broke');
|
|
18867
|
+
this.privateState.broke = true;
|
|
18868
|
+
this.setState({ playing: false });
|
|
18869
|
+
fulfilled = true;
|
|
18870
|
+
return reject(new Error('play is interupted'));
|
|
18871
|
+
});
|
|
18872
|
+
try {
|
|
18873
|
+
if (fulfilled)
|
|
18874
|
+
return;
|
|
18875
|
+
const res = () => {
|
|
18876
|
+
resolve();
|
|
18877
|
+
fulfilled = true;
|
|
18878
|
+
};
|
|
18879
|
+
switch (data.effect) {
|
|
18880
|
+
case 'Move':
|
|
18881
|
+
this.move(data, duration).then(res);
|
|
18882
|
+
break;
|
|
18883
|
+
case 'Rotate':
|
|
18884
|
+
this.rotate(data, duration).then(res);
|
|
18885
|
+
break;
|
|
18886
|
+
default:
|
|
18887
|
+
this.rotate(data, duration).then(res);
|
|
18888
|
+
}
|
|
18889
|
+
}
|
|
18890
|
+
catch (e) { }
|
|
18891
|
+
});
|
|
18892
|
+
}
|
|
18893
|
+
/**
|
|
18894
|
+
* @description Action promise queue in sequence
|
|
18895
|
+
*/
|
|
18896
|
+
async actionPromiseQueue() {
|
|
18897
|
+
const { privateState } = this;
|
|
18898
|
+
return new Promise((resolve, reject) => {
|
|
18899
|
+
if (privateState.currentPlayQueue.length === 0) {
|
|
18900
|
+
resolve();
|
|
18901
|
+
return;
|
|
18902
|
+
}
|
|
18903
|
+
const promise = privateState.currentPlayQueue.shift();
|
|
18904
|
+
if (!promise) {
|
|
18905
|
+
resolve();
|
|
18906
|
+
return;
|
|
18907
|
+
}
|
|
18908
|
+
promise.then(resolve, reject);
|
|
18909
|
+
}).then(() => {
|
|
18910
|
+
if (privateState.currentPlayQueue.length === 0)
|
|
18911
|
+
return Promise.resolve();
|
|
18912
|
+
return this.actionPromiseQueue();
|
|
18913
|
+
});
|
|
18914
|
+
}
|
|
18915
|
+
/**
|
|
18916
|
+
* @description Action move keyframe
|
|
18917
|
+
*/
|
|
18918
|
+
async move(data, duration) {
|
|
18919
|
+
console.log('--move--', data.panoIndex);
|
|
18920
|
+
if (data.mode && data.mode !== this.five.currentMode) {
|
|
18921
|
+
await this.changeMode(data);
|
|
18922
|
+
}
|
|
18923
|
+
else if (data.panoIndex !== this.five.panoIndex) {
|
|
18924
|
+
await this.changePano(data, duration);
|
|
18925
|
+
}
|
|
18926
|
+
else {
|
|
18927
|
+
return Promise.resolve();
|
|
18928
|
+
}
|
|
18929
|
+
// await updateCamera(data)
|
|
18930
|
+
}
|
|
18931
|
+
/**
|
|
18932
|
+
* @description Action rotate keyframe
|
|
18933
|
+
*/
|
|
18934
|
+
async rotate(data, duration) {
|
|
18935
|
+
console.log('--rotate--', data);
|
|
18936
|
+
if (data.mode && data.mode !== this.five.currentMode) {
|
|
18937
|
+
await this.changeMode({ mode: data.mode, panoIndex: data.panoIndex });
|
|
18938
|
+
}
|
|
18939
|
+
else if (data.panoIndex && data.panoIndex !== this.five.panoIndex) {
|
|
18940
|
+
return await this.changePano(data, duration);
|
|
18941
|
+
}
|
|
18942
|
+
await this.updateCamera(data, duration);
|
|
18943
|
+
}
|
|
18944
|
+
/**
|
|
18945
|
+
* @description Update five camera
|
|
18946
|
+
*/
|
|
18947
|
+
async updateCamera(data, paramsDuration = 800) {
|
|
18948
|
+
const { five, privateState, state } = this;
|
|
18949
|
+
let originDuration = paramsDuration;
|
|
18950
|
+
const speed = (() => {
|
|
18951
|
+
var _a, _b;
|
|
18952
|
+
const speedConfig = (_a = state.config) === null || _a === void 0 ? void 0 : _a.speedConfig;
|
|
18953
|
+
const speedValue = (_b = data.rotateSpeed) !== null && _b !== void 0 ? _b : speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.rotateSpeed;
|
|
18954
|
+
if ((speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.rotateSpeedUnit) === undefined)
|
|
18955
|
+
return speedValue;
|
|
18956
|
+
if (speedValue !== undefined) {
|
|
18957
|
+
return speedConfig.rotateSpeedUnit === 'rad/ms' ? speedValue : speedValue / 1000;
|
|
18958
|
+
}
|
|
18959
|
+
})();
|
|
18960
|
+
if (speed) {
|
|
18961
|
+
const coordinates1 = this.five.getCurrentState();
|
|
18962
|
+
const coordinates2 = data;
|
|
18963
|
+
const angle = coordinatesAngle(coordinates1, coordinates2);
|
|
18964
|
+
originDuration = angle / speed;
|
|
18965
|
+
}
|
|
18966
|
+
if (privateState.currentPlayKeyframe)
|
|
18967
|
+
privateState.currentPlayKeyframe.originDuration = originDuration;
|
|
18968
|
+
const duration = this.getSpeededDuration(originDuration);
|
|
18969
|
+
return new Promise((resolve) => {
|
|
18970
|
+
safeCall(() => five.updateCamera(data, duration));
|
|
18971
|
+
setTimeout(() => resolve(), duration);
|
|
18972
|
+
});
|
|
18973
|
+
}
|
|
18974
|
+
/**
|
|
18975
|
+
* @description: Change five pano
|
|
18976
|
+
*/
|
|
18977
|
+
async changePano(data, paramsDuration = 800) {
|
|
18978
|
+
const { five, privateState, state } = this;
|
|
18979
|
+
if (typeof data.panoIndex !== 'number')
|
|
18980
|
+
return;
|
|
18981
|
+
if (data.panoIndex === five.panoIndex)
|
|
18982
|
+
return;
|
|
18983
|
+
let originDuration = paramsDuration;
|
|
18984
|
+
const speed = (() => {
|
|
18985
|
+
var _a, _b;
|
|
18986
|
+
const speedConfig = (_a = state.config) === null || _a === void 0 ? void 0 : _a.speedConfig;
|
|
18987
|
+
const speedValue = (_b = data.moveSpeed) !== null && _b !== void 0 ? _b : speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.moveSpeed;
|
|
18988
|
+
if ((speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.moveSpeedUnit) === undefined)
|
|
18989
|
+
return speedValue;
|
|
18990
|
+
if (speedValue !== undefined) {
|
|
18991
|
+
return speedConfig.moveSpeedUnit === 'm/ms' ? speedValue : speedValue / 1000;
|
|
18992
|
+
}
|
|
18993
|
+
})();
|
|
18994
|
+
if (speed && typeof five.panoIndex === 'number' && typeof data.panoIndex === 'number') {
|
|
18995
|
+
const postion1 = five.work.observers[five.panoIndex].position;
|
|
18996
|
+
const postion2 = five.work.observers[data.panoIndex].position;
|
|
18997
|
+
const distance = postion1.distanceTo(postion2);
|
|
18998
|
+
originDuration = distance / speed;
|
|
18999
|
+
}
|
|
19000
|
+
if (privateState.currentPlayKeyframe)
|
|
19001
|
+
privateState.currentPlayKeyframe.originDuration = originDuration;
|
|
19002
|
+
const duration = this.getSpeededDuration(originDuration);
|
|
19003
|
+
return new Promise((resolve) => {
|
|
19004
|
+
var _a, _b;
|
|
19005
|
+
five.moveToPano(data.panoIndex, {
|
|
19006
|
+
latitude: data.latitude,
|
|
19007
|
+
longitude: data.longitude,
|
|
19008
|
+
fov: data.fov,
|
|
19009
|
+
duration,
|
|
19010
|
+
effect: (_b = (_a = this.state.config) === null || _a === void 0 ? void 0 : _a.moveEffect) !== null && _b !== void 0 ? _b : data.moveEffect,
|
|
19011
|
+
moveCancelCallback: () => resolve(),
|
|
19012
|
+
moveEndCallback: () => resolve(),
|
|
19013
|
+
});
|
|
19014
|
+
});
|
|
19015
|
+
}
|
|
19016
|
+
/**
|
|
19017
|
+
* @description: Change play speed
|
|
19018
|
+
*/
|
|
19019
|
+
changeSpeed(speed, userAction = true) {
|
|
19020
|
+
const { state, privateState, hooks } = this;
|
|
19021
|
+
const { currentPlayKeyframe } = privateState;
|
|
19022
|
+
hooks.emit('speedChange', speed, { userAction });
|
|
19023
|
+
if (state.playing && currentPlayKeyframe) {
|
|
19024
|
+
try {
|
|
19025
|
+
const duration = currentPlayKeyframe.originDuration !== undefined ? currentPlayKeyframe.originDuration * (1 - this.getProgress()) : undefined;
|
|
19026
|
+
console.log('--speedChange--', speed, { duration });
|
|
19027
|
+
const promise = this.playKeyframe(currentPlayKeyframe.keyframe, duration);
|
|
19028
|
+
privateState.currentPlayQueue.push(promise);
|
|
19029
|
+
}
|
|
19030
|
+
catch (e) { }
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
/**
|
|
19034
|
+
* @description Get duration by speed
|
|
19035
|
+
*/
|
|
19036
|
+
getSpeededDuration(duration) {
|
|
19037
|
+
return duration / this.state.speed;
|
|
19038
|
+
}
|
|
19039
|
+
/**
|
|
19040
|
+
* @description Get ratate progress
|
|
19041
|
+
*/
|
|
19042
|
+
getProgress() {
|
|
19043
|
+
return this.five.controller.cameraMotion.progress;
|
|
19044
|
+
}
|
|
19045
|
+
/**
|
|
19046
|
+
* @description Change five mode
|
|
19047
|
+
*/
|
|
19048
|
+
async changeMode(data, duration) {
|
|
19049
|
+
if (data.mode && data.mode !== this.five.currentMode) {
|
|
19050
|
+
await this.five.changeMode(data.mode, data, duration);
|
|
19051
|
+
}
|
|
19052
|
+
}
|
|
19053
|
+
/**
|
|
19054
|
+
* @description Force interupt five updateCamera
|
|
19055
|
+
*/
|
|
19056
|
+
forceInteruptUpdateCamera() {
|
|
19057
|
+
this.five.updateCamera({}, 0);
|
|
19058
|
+
}
|
|
19059
|
+
getPauseData() {
|
|
19060
|
+
var _a, _b;
|
|
19061
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframesId)
|
|
19062
|
+
return pauseDataMap.get((_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframesId);
|
|
19063
|
+
}
|
|
19064
|
+
/**
|
|
19065
|
+
* @description Set pause data
|
|
19066
|
+
*/
|
|
19067
|
+
setPauseData() {
|
|
19068
|
+
var _a, _b, _c, _d;
|
|
19069
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframesId)
|
|
19070
|
+
return pauseDataMap.set((_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframesId, {
|
|
19071
|
+
keyframeId: (_c = this.privateState.currentPlayKeyframe) === null || _c === void 0 ? void 0 : _c.keyframe.id,
|
|
19072
|
+
fiveState: this.five.getCurrentState(),
|
|
19073
|
+
duration: (_d = this.privateState.currentPlayKeyframe) === null || _d === void 0 ? void 0 : _d.originDuration,
|
|
19074
|
+
playedProgress: this.getProgress(),
|
|
19075
|
+
});
|
|
19076
|
+
}
|
|
19077
|
+
/**
|
|
19078
|
+
* @description Clear pause data
|
|
19079
|
+
*/
|
|
19080
|
+
clearPauseData() {
|
|
19081
|
+
var _a, _b;
|
|
19082
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframesId)
|
|
19083
|
+
return pauseDataMap.delete((_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframesId);
|
|
19084
|
+
}
|
|
19085
|
+
/**
|
|
19086
|
+
* @description: Restore state that before loaded
|
|
19087
|
+
*/
|
|
19088
|
+
clear() {
|
|
19089
|
+
this.clearPauseData();
|
|
19090
|
+
this.privateState.currentPlayKeyframe = null;
|
|
19091
|
+
}
|
|
19092
|
+
// TODO
|
|
19093
|
+
handleDispose() {
|
|
19094
|
+
var _a, _b;
|
|
19095
|
+
this.setState({ playing: false });
|
|
19096
|
+
this.clearPauseData();
|
|
19097
|
+
this.clear();
|
|
19098
|
+
(_a = this.GuideLine) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
19099
|
+
this.GuideLine = undefined;
|
|
19100
|
+
(_b = this.privateState.disposers) === null || _b === void 0 ? void 0 : _b.forEach((d) => d === null || d === void 0 ? void 0 : d());
|
|
19101
|
+
}
|
|
19102
|
+
/**
|
|
19103
|
+
* @description Action function if plugin is enable
|
|
19104
|
+
*/
|
|
19105
|
+
actionIfStateIsEnabled(func, options) {
|
|
19106
|
+
if (this.state.enabled)
|
|
19107
|
+
return func();
|
|
19108
|
+
else {
|
|
19109
|
+
if (options === null || options === void 0 ? void 0 : options.warnLog)
|
|
19110
|
+
disableWarnLog();
|
|
19111
|
+
}
|
|
19112
|
+
}
|
|
19113
|
+
/**
|
|
19114
|
+
* @description: Wait for five work ready
|
|
19115
|
+
*/
|
|
19116
|
+
async waitFiveLoaded() {
|
|
19117
|
+
return new Promise((resolve) => {
|
|
19118
|
+
if (this.five.work) {
|
|
19119
|
+
resolve();
|
|
19120
|
+
return;
|
|
19121
|
+
}
|
|
19122
|
+
this.five.once('loaded', () => {
|
|
19123
|
+
resolve();
|
|
19124
|
+
});
|
|
19125
|
+
});
|
|
19126
|
+
}
|
|
19127
|
+
setFiveLinearUpdateCamera() {
|
|
19128
|
+
if (!this.privateState.fiveOriginGetProgress)
|
|
19129
|
+
return;
|
|
19130
|
+
this.five.controller.cameraMotion.getProgress = (time) => {
|
|
19131
|
+
const cameraMotion = this.five.controller.cameraMotion;
|
|
19132
|
+
const deltaTime = time - cameraMotion.startTime;
|
|
19133
|
+
if (deltaTime < 0)
|
|
19134
|
+
return 0;
|
|
19135
|
+
if (deltaTime >= cameraMotion.duration)
|
|
19136
|
+
return 1;
|
|
19137
|
+
return 1 - linerValue(1, cameraMotion.startVelocity, cameraMotion.duration, deltaTime);
|
|
19138
|
+
};
|
|
19139
|
+
}
|
|
19140
|
+
setFiveOriginUpdateCamera() {
|
|
19141
|
+
if (!this.privateState.fiveOriginGetProgress)
|
|
19142
|
+
return;
|
|
19143
|
+
this.five.controller.cameraMotion.getProgress = this.privateState.fiveOriginGetProgress;
|
|
19144
|
+
}
|
|
19145
|
+
}
|
|
19146
|
+
Object.defineProperty(CruisePluginController, "PluginVersion", {
|
|
19147
|
+
enumerable: true,
|
|
19148
|
+
configurable: true,
|
|
19149
|
+
writable: true,
|
|
19150
|
+
value: VERSION
|
|
19151
|
+
});
|
|
19152
|
+
|
|
19153
|
+
const CruisePlugin = (five) => new CruisePluginController(five);
|
|
19154
|
+
|
|
18089
19155
|
const DnalogelVersion = '2.0.0-alpha.49';
|
|
18090
19156
|
|
|
18091
|
-
export { CSS3DRenderPlugin, CameraMovementEffect, CameraMovementPlugin, DIRECTION, DISPLAY_STRATEGY_TYPE, DnalogelVersion, FLOOR_PLAN_ATTACHED_TO, FLOOR_TYPE_MAP, ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE, Plugin as ItemLabelPlugin, Magnifier, MapviewFloorplanPlugin, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelItemLabelPlugin, ModelRoomLabelPlugin, ModelTVVideoPlugin, ModelViewPlugin, PanoCompassPlugin, PanoCursorRaycasterPlugin, PanoDoorLabelPlugin, PanoFloorplanRadarPlugin, PanoMeasurePlugin, PanoRulerPlugin, PanoRulerProPlugin, PanoSpatialTagPlugin, ROOM_FETILE_TYPE_MAP, ROOM_TYPE_MAP, Rotation, TopviewFloorplanPlugin, itemLabelPluginServerParams, modelItemLabelPluginServerParams, modelRoomLabelPluginServerParams };
|
|
19157
|
+
export { CSS3DRenderPlugin, CameraMovementEffect, CameraMovementPlugin, CruisePlugin, CruisePluginController, DIRECTION, DISPLAY_STRATEGY_TYPE, DnalogelVersion, FLOOR_PLAN_ATTACHED_TO, FLOOR_TYPE_MAP, GuideLinePlugin, ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE, Plugin as ItemLabelPlugin, Magnifier, MapviewFloorplanPlugin, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelItemLabelPlugin, ModelRoomLabelPlugin, ModelTVVideoPlugin, ModelViewPlugin, PanoCompassPlugin, PanoCursorRaycasterPlugin, PanoDoorLabelPlugin, PanoFloorplanRadarPlugin, PanoMeasurePlugin, PanoRulerPlugin, PanoRulerProPlugin, PanoSpatialTagPlugin, ROOM_FETILE_TYPE_MAP, ROOM_TYPE_MAP, Rotation, TopviewFloorplanPlugin, itemLabelPluginServerParams, modelItemLabelPluginServerParams, modelRoomLabelPluginServerParams };
|