@realsee/dnalogel 2.0.0-alpha.51 → 2.0.0-alpha.54
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 +2 -3
- package/dist/CSS3DRenderPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/CSS3DRenderPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/CSS3DRenderPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/CSS3DRenderPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/CameraMovementPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/CameraMovementPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/CameraMovementPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/CameraMovementPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/CameraMovementPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/CruisePlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/CruisePlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/CruisePlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/CruisePlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/CruisePlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/CruisePlugin/index.d.ts +2 -3
- package/dist/CruisePlugin/index.js +265 -41
- package/dist/CruisePlugin/typing.d.ts +11 -1
- package/dist/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/GuideLinePlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/GuideLinePlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/GuideLinePlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/GuideLinePlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/GuideLinePlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/GuideLinePlugin/index.js +201 -13
- package/dist/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ItemLabelPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ItemLabelPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ItemLabelPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ItemLabelPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ItemLabelPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ModelChassisCompassPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ModelChassisCompassPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ModelChassisCompassPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ModelEntryDoorGuidePlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ModelEntryDoorGuidePlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ModelEntryDoorGuidePlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ModelEntryDoorGuidePlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ModelEntryDoorGuidePlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ModelItemLabelPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ModelItemLabelPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ModelItemLabelPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ModelItemLabelPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ModelItemLabelPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ModelRoomLabelPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ModelRoomLabelPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ModelRoomLabelPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ModelRoomLabelPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ModelRoomLabelPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ModelTVVideoPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ModelTVVideoPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ModelTVVideoPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/ModelViewPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/ModelViewPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/ModelViewPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/ModelViewPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/ModelViewPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoCompassPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoCompassPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoCompassPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoCompassPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoCompassPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoCursorRaycasterPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoCursorRaycasterPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoCursorRaycasterPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoCursorRaycasterPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoCursorRaycasterPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoDoorLabelPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoDoorLabelPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoDoorLabelPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoDoorLabelPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoDoorLabelPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoMeasurePlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoMeasurePlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoMeasurePlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoMeasurePlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoMeasurePlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoRulerPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoRulerPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoRulerPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoRulerPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoRulerPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoRulerProPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoRulerProPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoRulerProPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoRulerProPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoRulerProPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/PanoSpatialTagPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/PanoSpatialTagPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/PanoSpatialTagPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/PanoSpatialTagPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/PanoSpatialTagPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/floorplan/MapviewFloorplanPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/floorplan/MapviewFloorplanPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/floorplan/MapviewFloorplanPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/floorplan/MapviewFloorplanPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/floorplan/MapviewFloorplanPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/floorplan/ModelFloorplanPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/floorplan/ModelFloorplanPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/floorplan/ModelFloorplanPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/floorplan/PanoFloorplanRadarPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/floorplan/TopviewFloorplanPlugin/CruisePlugin/index.d.ts +2 -3
- package/dist/floorplan/TopviewFloorplanPlugin/CruisePlugin/typing.d.ts +11 -1
- package/dist/floorplan/TopviewFloorplanPlugin/CruisePlugin/utils/sleep.d.ts +1 -0
- package/dist/floorplan/TopviewFloorplanPlugin/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/dist/floorplan/TopviewFloorplanPlugin/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +1308 -15
- package/dist/index.js +1310 -14
- package/dist/index.umd.js +1310 -14
- 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/EventMap.html +15 -0
- 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/PluginData.html +1 -0
- package/docs/interfaces/PluginServerData.html +3 -0
- package/docs/interfaces/PluginState.html +5 -0
- 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/interfaces/Route.html +1 -0
- package/docs/modules.html +18 -18
- package/libs/CruisePlugin/Controller.js +57 -28
- package/libs/CruisePlugin/index.d.ts +2 -3
- package/libs/CruisePlugin/index.js +1 -3
- package/libs/CruisePlugin/typing.d.ts +11 -1
- package/libs/CruisePlugin/utils/sleep.d.ts +1 -0
- package/libs/CruisePlugin/utils/sleep.js +7 -0
- package/libs/GuideLinePlugin/Controller.js +3 -3
- package/libs/GuideLinePlugin/utils/getArrowMaterial.d.ts +1 -1
- package/libs/GuideLinePlugin/utils/getArrowMaterial.js +6 -1
- package/libs/GuideLinePlugin/utils/getLineGeometry.d.ts +1 -1
- package/libs/GuideLinePlugin/utils/getLineGeometry.js +4 -4
- package/libs/index.d.ts +2 -0
- package/libs/index.js +4 -0
- package/package.json +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -4695,7 +4695,7 @@
|
|
|
4695
4695
|
/**
|
|
4696
4696
|
* plugin 的基本控制器
|
|
4697
4697
|
*/
|
|
4698
|
-
class Controller$
|
|
4698
|
+
class Controller$7 {
|
|
4699
4699
|
constructor(five$1) {
|
|
4700
4700
|
Object.defineProperty(this, "five", {
|
|
4701
4701
|
enumerable: true,
|
|
@@ -4722,7 +4722,7 @@
|
|
|
4722
4722
|
}
|
|
4723
4723
|
}
|
|
4724
4724
|
|
|
4725
|
-
class Controller$
|
|
4725
|
+
class Controller$6 extends Controller$7 {
|
|
4726
4726
|
}
|
|
4727
4727
|
|
|
4728
4728
|
var FloorplanErrorType;
|
|
@@ -4874,7 +4874,7 @@
|
|
|
4874
4874
|
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
4875
4875
|
return latitudeVisible && longitudeVisible;
|
|
4876
4876
|
}
|
|
4877
|
-
class Controller$
|
|
4877
|
+
class Controller$5 extends Controller$6 {
|
|
4878
4878
|
constructor(five, params) {
|
|
4879
4879
|
var _a;
|
|
4880
4880
|
super(five);
|
|
@@ -5543,7 +5543,7 @@
|
|
|
5543
5543
|
}
|
|
5544
5544
|
|
|
5545
5545
|
const ModelFloorplanPlugin = (five, params) => {
|
|
5546
|
-
return new Controller$
|
|
5546
|
+
return new Controller$5(five, params);
|
|
5547
5547
|
};
|
|
5548
5548
|
|
|
5549
5549
|
/** 当前 five 的相机视角是否满足户型图自动隐藏条件
|
|
@@ -5568,7 +5568,7 @@
|
|
|
5568
5568
|
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
5569
5569
|
return latitudeVisible && longitudeVisible;
|
|
5570
5570
|
}
|
|
5571
|
-
class Controller$
|
|
5571
|
+
class Controller$4 extends Controller$6 {
|
|
5572
5572
|
constructor(five, params) {
|
|
5573
5573
|
super(five);
|
|
5574
5574
|
// =============== public properties =================
|
|
@@ -6217,10 +6217,10 @@
|
|
|
6217
6217
|
}
|
|
6218
6218
|
|
|
6219
6219
|
const MapviewFloorplanPlugin = (five, params) => {
|
|
6220
|
-
return new Controller$
|
|
6220
|
+
return new Controller$4(five, params);
|
|
6221
6221
|
};
|
|
6222
6222
|
|
|
6223
|
-
class Controller$
|
|
6223
|
+
class Controller$3 extends Controller$6 {
|
|
6224
6224
|
constructor(five, params) {
|
|
6225
6225
|
super(five);
|
|
6226
6226
|
// =============== public properties =================
|
|
@@ -6697,7 +6697,7 @@
|
|
|
6697
6697
|
}
|
|
6698
6698
|
|
|
6699
6699
|
const TopviewFloorplanPlugin = (five, params) => {
|
|
6700
|
-
return new Controller$
|
|
6700
|
+
return new Controller$3(five, params);
|
|
6701
6701
|
};
|
|
6702
6702
|
|
|
6703
6703
|
/**
|
|
@@ -7576,7 +7576,7 @@
|
|
|
7576
7576
|
}
|
|
7577
7577
|
}
|
|
7578
7578
|
|
|
7579
|
-
class Controller$
|
|
7579
|
+
class Controller$2 extends Controller$6 {
|
|
7580
7580
|
constructor(five, params) {
|
|
7581
7581
|
super(five);
|
|
7582
7582
|
// =============== public properties =================
|
|
@@ -7813,7 +7813,7 @@
|
|
|
7813
7813
|
}
|
|
7814
7814
|
|
|
7815
7815
|
const PanoFloorplanRadarPlugin = (five, params) => {
|
|
7816
|
-
return new Controller$
|
|
7816
|
+
return new Controller$2(five, params);
|
|
7817
7817
|
};
|
|
7818
7818
|
|
|
7819
7819
|
/** 房屋数据映射表 */
|
|
@@ -9683,7 +9683,7 @@
|
|
|
9683
9683
|
}
|
|
9684
9684
|
}
|
|
9685
9685
|
|
|
9686
|
-
class Controller {
|
|
9686
|
+
class Controller$1 {
|
|
9687
9687
|
constructor(five, params) {
|
|
9688
9688
|
var _a, _b;
|
|
9689
9689
|
Object.defineProperty(this, "five", {
|
|
@@ -9797,7 +9797,7 @@
|
|
|
9797
9797
|
* 全景标尺插件
|
|
9798
9798
|
*/
|
|
9799
9799
|
const PanoRulerProPlugin = (five, params) => {
|
|
9800
|
-
return new Controller(five, params);
|
|
9800
|
+
return new Controller$1(five, params);
|
|
9801
9801
|
};
|
|
9802
9802
|
|
|
9803
9803
|
const roomInfoIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZIAAABCCAYAAAB9y1BhAAAAAXNSR0IArs4c6QAADh5JREFUeAHtnVuPLDcVhedwC/dACKAICDxEIBQpygNI/Ab+MX8B8YCQEAjxgBAQLsm5Jjkn58r6Sl4jT52qnu4zXd121dqSx67q7ip7eXsv721XzcVFJAgEgSAQBIJAEAgCQeC4CLx48eKbSu+RH/fKuVoQWB8Cn1tfk9KiIHAUBH6tq/xKiTwSBILADgRCJDvAyUebRuAbpfXxSDatBmn8Pgh8YZ8v5TtBYIMIvFCbSZEgEASuQSBEcg1A+XizCDzfbMvT8CBwIAIhkgMBy9c3g0CIZDNdnYbeFIEQyU0RzO/XikCIZK09m3YdHYEQydEhzQVXgkCIZCUdmWYsj0CIZHmMc4c+EchCe5/9llqfAYEQyRlAzy27QCAeSRfdlEq2gECIpIVeSB1aRAAiudVixVKnINAaAiGS1nok9WkFAUJb8Upa6Y3Uo2kEQiRNd08qd0YEQiJnBD+37guBEElf/ZXang6BEMnpsM6dOkcgRNJ5B66x+nrjLmsTX1J6bSJHZ7+o9HklynWaOse1eKcc+XVlvxYFEnlfaThWfb7mcsn5nPRM6WmVU55KfO+J0mdKj8f5rVu3skNMoET6RSBE0m/fdVNzGWII4StKXy65y18t58aEAVGcUjDkGHsLhIOYfCC1xUT4QDJjgnmkc58qkT8saSiLeCCkSBBoBoEQSTNd0V9FZADRH8iAGfvXS06Zc5CFCePQt0y3EFaq61CX1ayjC56U8br24sKd+kAuJhkI55OSPi75pyIcvKNIEFgcgRDJ4hD3ewMZLDwDXqfOq9RNFCYOCAMPYx851BDjIXiWzky9Tpyvw0kOL/nc+Jh7DyGqko+P+cznVLwMf31Uypz7jZLJ0GEy8jqURnl8zPjyObDEsxknztsDUnFvMfF8e+4X6j88F4hlTDT3de6BiAYsI0HgxgiESG4MYd8XkLEhrARZTKUxUWB0MXrkiA3wdYYQg8Xs2cmzaR977cCE8eSM6wYDsQiXSyOrulDPRUT3AbsxydAnYO9kz87HfH9Kxv3D976lNEk2ujf9ANE8GCe1OeEzgRLZD4EQyX44df8tGQ08iNdHCU+jnhGPDVG9bgAGGD3Iw8TB5xgjz3jr3CTxSEapxxAL7VxcCmGaQPe6n/qScWtSIcdLrD1FhxbtRZn4x/3rtanvlBtffq57UCcI5l6dVF9CaJEgcAWBEMkVOPo+0ODHwGNEIAxIwsRBea6vdxlMPsNwYFAcIoEsnB4WQ6hTqxOMqg1wU40rxEx/kCal6AKejEnGOSFKvE8mFiYaFV8S9AVP5oo3o+syKSA0ZoJxmTWZJvFSXSMLIzBnXBa+bS5/UwQ0oDECEIRDF87n+nSOMDAMkIUNU51v2TjM4SWo2pdi1E34L1W4mnRALFOJtZ0pQe/QNVItT3XNOzpxV8n5fdWjaxzrBqY8j8Cc0Zn/RT45OQIaoPQT3oUHMDnHUzPKuYFLqGJYZFXObNILroSmIi8jMIfjy9/s8EwhGu/0+s+4CdI5vBkmKngv6Bo5x3NbodFFQmQOk6l48VzXQdcgF6d7unePoU7aE5lBIEQyA8y5TmvgEZ5iwBJSeKMkBrHXJVS8lCljZ8IwaZgwFlswvqzNugpT2K6rhTtaI2PPBIN0hWSkn6zJmFSc7yIYSIj0Y6VBdA108nZJd5TjuSQsNqDT558QyZn7rQxMSKNO435hkE0NNEIXzPhIzPiY7cXDEBBHkE0TyRx+0i9vovhf/R3pMR6MPWWTB+syU+JQ2tvlQ8Ji6C/kArHcKfcpHydrHYGxwWq9vl3XT4MFr4JZHO4/3gbkMTXYxkYMEmHtAsJgNsegYxaH9xFZBgH6YMoLXOZunV+1TGCYxHzgpkjfCYPhrUAw5BAMJDLGlbAY44E0iH7LJAlSgVw+UuK5l6nJlD6KnBuBEMmCPaDBwACpiYOBwuCqB0S9xZYBxmfs4YcsGEjkiSsLhBML/VD304lv3//tykTnQ7WENIjGBDYHQoFcSEym2IaMWP/JCaG9VZKyi8f6LaRSE8t4wsX3ImdAIERyRNALcTBIGByeYY13v4yJg+P7SiaOhKcERgMSI7VAJ4hcWGjHwyANonFTh8UYO3gv440kjKPvlqTs4llFLEy4GDfpM5A5g4RIbgi6lNkeh8NV4wEwVm7CUSg+CfLAZR9/R6cjZ0YgfXKiDpD+e2F/CIuVCRnjyh4L5DLeLYbXUu8Sg1gYUwNJ6ZoPVI6cCAE6I3IAAlJW3HCTBl6H3fK5qxCmMnGwiMiWy0jjCKiff6kqDuNDffbbxqu7+uqpP3iAEkJx2mfcOQx2W32YV74sqCUhkmvAlQLjUjMzcqiKxcJdwuwKT2NIUmAWDSOdIaB+/4WrrD78ncvJ20BA/cMmFcalE+GxXcJmFa+x3FWf1iHmXb/LZ3sgkNDWBEhSUhb67DYzA6rDVeOQBy/3gzQGJZWC5nkNgbECGffzCpq0niaUCRqTtH/RqjJmPdmDXMYvtoR4SD9U4kHJOgyWMStQbiLxSISelAoc6rUOFG5O2MnD4ni9xpHdPXNodXpeOvG+qy6j9XuXk7ePQDWeIRQmgizeT9k6zjF2IaRhbUV5thkLhENlCtxDr9Hl96VseGMommcxu7wzwlUmDnaHxC3ustf3r7T04z1/W/39B5eT94eA+pLw9OtKJpZdYTB2ldUhsLzOZY8u32U89/h5X1+RQuHuQhyErVCsmkjrUAazlHtKkEeeshUIGxT0odaPDUKwjiaXiZ/JwWEwL9qP7QBh7DdLkskY3hWGt8KC/eX/qFkHMsdrxeoHihSBbYP2OnBx58RrHZBHvI45lDZyXnrzrpsqA/JHl5OvCwH1s70ViAWPZby2Ujf4vg4GQpJO5K0SFTKrJBIpB1sDUQwIZNcuK2Kjd0v6RMqRtQ6BERnWzX5uHKQXf3I5+XoRkN3AHrLNGEIh7Vor9S4wIhab31q8GiKpyAMCQRmmBKLgOQ68DrYAbl4BpkDKuYFIfiYchvEhPflzMNkeAsWmQCi2KXP2kgkpnspmSWUOmC60Rh3NGg+dTJrzPCAPZg+D5yGjkDinwIjsRkC69VN/QzrzF5eTbxMB6QMhL3sq2Jo524mt8drqZhbq58BoVlvUocQ0WeswebA45pAU7XGZVyTcI8kQbKZD1d7IERCQnr3jy0h//upy8iAg3WACyyI9iccGbEexPbZBnsBCKrype9U7PbvYtaWOgyyYBTAjgET8gCCdxe4ak4c9j9V3nNocWRaBehffsnfK1btCoExMh+dOqokttslRERMLIXbO8QAkC/VERT7W71enW26w2teeCPz6raB4IlPiV5JAHvE8phDKuYMRkO79xD+SXv3N5eRBYA4B6QwTcya6kMrcsyp4JkRKWKPFdq1CmiOSUWfMvZiNRXIYPv/caRVq2F4jpIdvu1Ya8H93OXkQ2AcB6Q+PHUAqpDk7xqtZIJXuJ8FNEIlApx64gYA+t5DFIjnrHrzCIO/GERCR5RCQTv5IVx9CptK3fyx3p1x57QhIl/x/7llPmXpOBT1jNymk0uVjCGclkoq1AXhqvQaAWffA+3ioAe21EB1GgsByCEg3f+CrS+/+6XLyIPCqCEinsLeEvHZNmAnPM2HuKtpyciIpYNr7AFTIwfVwGY8DMFe5MKV2RRpHQHr6lqsoIvnA5eRB4BgISL+8gYhJNB4LYvvnCTN2kEl0816KDTiNWFQEHC4doBG68q6r+p7sZMD7gDzy+oEamZRPjoD09fu66TA+pI//PnkFcsPNICBdYz0Fu3idbSSs3+RzcIsSiQDi+ngdAGTWVfGKsHOB+GBCV1dgycE5EZDufs/31+D9r8vJg8BSCFT2kojN3K4vvBQm3E3Zy0WIRICwVRcwSFPbdu194LKt+kEdtT/SIQLS4Tddbenohy4nDwKnQGAPG4rdZALehA09KpGo8bhou9iUbbs0/jMNTscBdRgJAm0hIF1+wzWSrt52OXkQOCUC0kNsNNuHsatz24iHqI709GxLAjcmktJQEwj5WPA+aCiuWB4YHKOT4yYRkF7zUNkg0lueSI4EgbMiIJ1kZyshL9LUOjNEwkT9sXT2pBP1VyaSQiCse9Coqa27LApBIPE+BEKkLwSk32zRHESDkp0zkSDQBALF9uKdYHunnkthwo7tfXQqQjmYSNQImBACIU2xIuGreB8CIdIvAtJzNogMosHI4mYkCDSHgPTUXspU2ItoEIvzEArlxWRvIlGFWTSnsnWF+b1dKAhk8QrrHpEgsDgC0ndi0oNoEBIuiASBZhGQvnqCz/KCJ/jYZtto7DPRoUU2N11LJIXxqNyUC0VFqeCTpRlP94gEgZMhIL0nbDCIdJswQSQINI9AIRRsNRP+KfvOkgNrKEddr5660YUqw3k8EAhkbvsuCztPVSF7JDqMBIF1IKAxcOl5S8eZLEWCQDcIFBtO2Kv2UOr645lAKkex4VeIpLo5jHbls1KD4eYaWIu4R+UeyYLA2RHQWGAADiJ9P9u2StcheRB4VQSkyzgD2PQppwBH4MaEMpBFRSDcqCYQx9ggDphr0QUb3SMSBJpAQGPiciei9P6oYYAmGphKbA4B6TRrJ+j1HKHYzh8cZbpVBowXZ8bgQhzPNJAOvvD4QjkOAj0hUAbdUOVMoHrqudT1OgSk2zgLkAl2n/LYvh9s900kutYV4UIvQiBXMMlBEAgCQWA1CBRCgUjmHAkI5vk+PACR1BcZmGmfH64GzTQkCASBILBhBAqhgEC9rDFGJI7FGJEcB4EgEASCQBAIAkEgCASBIBAEgkAQCAJBIAgEgSAQBIJAEAgCm0fg/x4jQQWGalpFAAAAAElFTkSuQmCC';
|
|
@@ -9919,7 +9919,7 @@
|
|
|
9919
9919
|
}
|
|
9920
9920
|
|
|
9921
9921
|
const defaultBaseOptions$1 = { userAction: true };
|
|
9922
|
-
class PanoCompassController extends Controller$
|
|
9922
|
+
class PanoCompassController extends Controller$6 {
|
|
9923
9923
|
constructor(five$1, config) {
|
|
9924
9924
|
super(five$1);
|
|
9925
9925
|
/**
|
|
@@ -17371,7 +17371,7 @@ void main() {
|
|
|
17371
17371
|
* pano plugin controller 基类
|
|
17372
17372
|
* @author kyleju
|
|
17373
17373
|
*/
|
|
17374
|
-
class BasePanoPluginController extends Controller$
|
|
17374
|
+
class BasePanoPluginController extends Controller$7 {
|
|
17375
17375
|
constructor(five) {
|
|
17376
17376
|
super(five);
|
|
17377
17377
|
Object.defineProperty(this, "state", {
|
|
@@ -18102,12 +18102,1308 @@ void main() {
|
|
|
18102
18102
|
return new PanoDoorLabelPluginController(five);
|
|
18103
18103
|
};
|
|
18104
18104
|
|
|
18105
|
+
var polylineMiterUtil = {};
|
|
18106
|
+
|
|
18107
|
+
var add_1 = add$1;
|
|
18108
|
+
|
|
18109
|
+
/**
|
|
18110
|
+
* Adds two vec2's
|
|
18111
|
+
*
|
|
18112
|
+
* @param {vec2} out the receiving vector
|
|
18113
|
+
* @param {vec2} a the first operand
|
|
18114
|
+
* @param {vec2} b the second operand
|
|
18115
|
+
* @returns {vec2} out
|
|
18116
|
+
*/
|
|
18117
|
+
function add$1(out, a, b) {
|
|
18118
|
+
out[0] = a[0] + b[0];
|
|
18119
|
+
out[1] = a[1] + b[1];
|
|
18120
|
+
return out
|
|
18121
|
+
}
|
|
18122
|
+
|
|
18123
|
+
var set_1 = set$1;
|
|
18124
|
+
|
|
18125
|
+
/**
|
|
18126
|
+
* Set the components of a vec2 to the given values
|
|
18127
|
+
*
|
|
18128
|
+
* @param {vec2} out the receiving vector
|
|
18129
|
+
* @param {Number} x X component
|
|
18130
|
+
* @param {Number} y Y component
|
|
18131
|
+
* @returns {vec2} out
|
|
18132
|
+
*/
|
|
18133
|
+
function set$1(out, x, y) {
|
|
18134
|
+
out[0] = x;
|
|
18135
|
+
out[1] = y;
|
|
18136
|
+
return out
|
|
18137
|
+
}
|
|
18138
|
+
|
|
18139
|
+
var normalize_1 = normalize$1;
|
|
18140
|
+
|
|
18141
|
+
/**
|
|
18142
|
+
* Normalize a vec2
|
|
18143
|
+
*
|
|
18144
|
+
* @param {vec2} out the receiving vector
|
|
18145
|
+
* @param {vec2} a vector to normalize
|
|
18146
|
+
* @returns {vec2} out
|
|
18147
|
+
*/
|
|
18148
|
+
function normalize$1(out, a) {
|
|
18149
|
+
var x = a[0],
|
|
18150
|
+
y = a[1];
|
|
18151
|
+
var len = x*x + y*y;
|
|
18152
|
+
if (len > 0) {
|
|
18153
|
+
//TODO: evaluate use of glm_invsqrt here?
|
|
18154
|
+
len = 1 / Math.sqrt(len);
|
|
18155
|
+
out[0] = a[0] * len;
|
|
18156
|
+
out[1] = a[1] * len;
|
|
18157
|
+
}
|
|
18158
|
+
return out
|
|
18159
|
+
}
|
|
18160
|
+
|
|
18161
|
+
var subtract_1 = subtract$1;
|
|
18162
|
+
|
|
18163
|
+
/**
|
|
18164
|
+
* Subtracts vector b from vector a
|
|
18165
|
+
*
|
|
18166
|
+
* @param {vec2} out the receiving vector
|
|
18167
|
+
* @param {vec2} a the first operand
|
|
18168
|
+
* @param {vec2} b the second operand
|
|
18169
|
+
* @returns {vec2} out
|
|
18170
|
+
*/
|
|
18171
|
+
function subtract$1(out, a, b) {
|
|
18172
|
+
out[0] = a[0] - b[0];
|
|
18173
|
+
out[1] = a[1] - b[1];
|
|
18174
|
+
return out
|
|
18175
|
+
}
|
|
18176
|
+
|
|
18177
|
+
var dot_1 = dot$1;
|
|
18178
|
+
|
|
18179
|
+
/**
|
|
18180
|
+
* Calculates the dot product of two vec2's
|
|
18181
|
+
*
|
|
18182
|
+
* @param {vec2} a the first operand
|
|
18183
|
+
* @param {vec2} b the second operand
|
|
18184
|
+
* @returns {Number} dot product of a and b
|
|
18185
|
+
*/
|
|
18186
|
+
function dot$1(a, b) {
|
|
18187
|
+
return a[0] * b[0] + a[1] * b[1]
|
|
18188
|
+
}
|
|
18189
|
+
|
|
18190
|
+
var add = add_1;
|
|
18191
|
+
var set = set_1;
|
|
18192
|
+
var normalize = normalize_1;
|
|
18193
|
+
var subtract = subtract_1;
|
|
18194
|
+
var dot = dot_1;
|
|
18195
|
+
|
|
18196
|
+
var tmp = [0, 0];
|
|
18197
|
+
|
|
18198
|
+
polylineMiterUtil.computeMiter = function computeMiter(tangent, miter, lineA, lineB, halfThick) {
|
|
18199
|
+
//get tangent line
|
|
18200
|
+
add(tangent, lineA, lineB);
|
|
18201
|
+
normalize(tangent, tangent);
|
|
18202
|
+
|
|
18203
|
+
//get miter as a unit vector
|
|
18204
|
+
set(miter, -tangent[1], tangent[0]);
|
|
18205
|
+
set(tmp, -lineA[1], lineA[0]);
|
|
18206
|
+
|
|
18207
|
+
//get the necessary length of our miter
|
|
18208
|
+
return halfThick / dot(miter, tmp)
|
|
18209
|
+
};
|
|
18210
|
+
|
|
18211
|
+
polylineMiterUtil.normal = function normal(out, dir) {
|
|
18212
|
+
//get perpendicular
|
|
18213
|
+
set(out, -dir[1], dir[0]);
|
|
18214
|
+
return out
|
|
18215
|
+
};
|
|
18216
|
+
|
|
18217
|
+
polylineMiterUtil.direction = function direction(out, a, b) {
|
|
18218
|
+
//get unit dir of two lines
|
|
18219
|
+
subtract(out, a, b);
|
|
18220
|
+
normalize(out, out);
|
|
18221
|
+
return out
|
|
18222
|
+
};
|
|
18223
|
+
|
|
18224
|
+
var util = polylineMiterUtil;
|
|
18225
|
+
|
|
18226
|
+
var lineA = [0, 0];
|
|
18227
|
+
var lineB = [0, 0];
|
|
18228
|
+
var tangent = [0, 0];
|
|
18229
|
+
var miter = [0, 0];
|
|
18230
|
+
|
|
18231
|
+
var polylineNormals = function(points, closed) {
|
|
18232
|
+
var curNormal = null;
|
|
18233
|
+
var out = [];
|
|
18234
|
+
if (closed) {
|
|
18235
|
+
points = points.slice();
|
|
18236
|
+
points.push(points[0]);
|
|
18237
|
+
}
|
|
18238
|
+
|
|
18239
|
+
var total = points.length;
|
|
18240
|
+
for (var i=1; i<total; i++) {
|
|
18241
|
+
var last = points[i-1];
|
|
18242
|
+
var cur = points[i];
|
|
18243
|
+
var next = i<points.length-1 ? points[i+1] : null;
|
|
18244
|
+
|
|
18245
|
+
util.direction(lineA, cur, last);
|
|
18246
|
+
if (!curNormal) {
|
|
18247
|
+
curNormal = [0, 0];
|
|
18248
|
+
util.normal(curNormal, lineA);
|
|
18249
|
+
}
|
|
18250
|
+
|
|
18251
|
+
if (i === 1) //add initial normals
|
|
18252
|
+
addNext(out, curNormal, 1);
|
|
18253
|
+
|
|
18254
|
+
if (!next) { //no miter, simple segment
|
|
18255
|
+
util.normal(curNormal, lineA); //reset normal
|
|
18256
|
+
addNext(out, curNormal, 1);
|
|
18257
|
+
} else { //miter with last
|
|
18258
|
+
//get unit dir of next line
|
|
18259
|
+
util.direction(lineB, next, cur);
|
|
18260
|
+
|
|
18261
|
+
//stores tangent & miter
|
|
18262
|
+
var miterLen = util.computeMiter(tangent, miter, lineA, lineB, 1);
|
|
18263
|
+
addNext(out, miter, miterLen);
|
|
18264
|
+
}
|
|
18265
|
+
}
|
|
18266
|
+
|
|
18267
|
+
//if the polyline is a closed loop, clean up the last normal
|
|
18268
|
+
if (points.length > 2 && closed) {
|
|
18269
|
+
var last2 = points[total-2];
|
|
18270
|
+
var cur2 = points[0];
|
|
18271
|
+
var next2 = points[1];
|
|
18272
|
+
|
|
18273
|
+
util.direction(lineA, cur2, last2);
|
|
18274
|
+
util.direction(lineB, next2, cur2);
|
|
18275
|
+
util.normal(curNormal, lineA);
|
|
18276
|
+
|
|
18277
|
+
var miterLen2 = util.computeMiter(tangent, miter, lineA, lineB, 1);
|
|
18278
|
+
out[0][0] = miter.slice();
|
|
18279
|
+
out[total-1][0] = miter.slice();
|
|
18280
|
+
out[0][1] = miterLen2;
|
|
18281
|
+
out[total-1][1] = miterLen2;
|
|
18282
|
+
out.pop();
|
|
18283
|
+
}
|
|
18284
|
+
|
|
18285
|
+
return out
|
|
18286
|
+
};
|
|
18287
|
+
|
|
18288
|
+
function addNext(out, normal, length) {
|
|
18289
|
+
out.push([[normal[0], normal[1]], length]);
|
|
18290
|
+
}
|
|
18291
|
+
|
|
18292
|
+
// 定义常量
|
|
18293
|
+
const TRIANGLE_NUMBER_OF_RECTANGLE = 2; // 每个矩形有两个三角形
|
|
18294
|
+
const VERTEX_NUMBER_OF_TRIANGLE = 3; // 每个三角形有三个顶点
|
|
18295
|
+
const AXIS_NUMBER_OF_VERTEX = 3; // 每个顶点有三个轴坐标
|
|
18296
|
+
const UV_NUMBER_OF_VERTEX = 2; // 每个顶点有两个 UV 轴坐标
|
|
18297
|
+
function getLineGeometry(positionList) {
|
|
18298
|
+
if (positionList.length < 2)
|
|
18299
|
+
return console.warn('positionList length must be greater than 1');
|
|
18300
|
+
const lineWidth = 0.6;
|
|
18301
|
+
const halfLineWidth = lineWidth / 2;
|
|
18302
|
+
const aspect = 0.67; // 纵横比 width / height
|
|
18303
|
+
// 点位向量数组
|
|
18304
|
+
const keyPoints = positionList;
|
|
18305
|
+
// 点位组成的平滑曲线
|
|
18306
|
+
const curve = new THREE__namespace.CatmullRomCurve3(keyPoints, false, 'catmullrom', 0.5);
|
|
18307
|
+
// 求顶点和 UV
|
|
18308
|
+
const divisions = Math.ceil(curve.getLength()); // 曲线切片数
|
|
18309
|
+
const curvePoints = curve.getPoints(divisions);
|
|
18310
|
+
const curvePointsLength = curvePoints.length;
|
|
18311
|
+
const normals = polylineNormals(curvePoints.map((p) => [p.x, p.z])); // curvePoints:每个点切线的向量「二维」
|
|
18312
|
+
const rectangleNumber = curvePoints.length - 1; // 曲线上 N 个点,构成了 N - 1 个矩形
|
|
18313
|
+
const indexNumber = rectangleNumber * TRIANGLE_NUMBER_OF_RECTANGLE * VERTEX_NUMBER_OF_TRIANGLE;
|
|
18314
|
+
const verticesNumber = 2 * curvePointsLength; // 顶点数量(包含公用):每个曲线点对应两个顶点,N 个 点有 2N 个顶点
|
|
18315
|
+
const positionNumber = verticesNumber * AXIS_NUMBER_OF_VERTEX; // 坐标点数量
|
|
18316
|
+
const uvNumber = verticesNumber * UV_NUMBER_OF_VERTEX; // uv 数量
|
|
18317
|
+
const index = new Uint32Array(indexNumber);
|
|
18318
|
+
const positions = new Float32Array(positionNumber);
|
|
18319
|
+
const uv = new Float32Array(uvNumber);
|
|
18320
|
+
let totalLength = 0;
|
|
18321
|
+
for (let i = 0; i < curvePoints.length; i++) {
|
|
18322
|
+
const [nx, nz] = normals[i][0];
|
|
18323
|
+
const curvePoint = curvePoints[i];
|
|
18324
|
+
const { x: curvePointX, y: curvePointY, z: curvePointZ } = curvePoint;
|
|
18325
|
+
// vertices[2i]
|
|
18326
|
+
positions[i * 6 + 0] = curvePointX + nx * halfLineWidth;
|
|
18327
|
+
positions[i * 6 + 1] = curvePointY + 0.05;
|
|
18328
|
+
positions[i * 6 + 2] = curvePointZ + nz * halfLineWidth;
|
|
18329
|
+
// vertices[2i + 1]
|
|
18330
|
+
positions[i * 6 + 3] = curvePointX - nx * halfLineWidth;
|
|
18331
|
+
positions[i * 6 + 4] = curvePointY + 0.05;
|
|
18332
|
+
positions[i * 6 + 5] = curvePointZ - nz * halfLineWidth;
|
|
18333
|
+
totalLength += i > 0 ? curvePoints[i - 1].clone().sub(curvePoints[i]).length() : 0;
|
|
18334
|
+
const end = totalLength / lineWidth / aspect;
|
|
18335
|
+
uv[i * 4 + 0] = 0;
|
|
18336
|
+
uv[i * 4 + 1] = end;
|
|
18337
|
+
uv[i * 4 + 2] = 1;
|
|
18338
|
+
uv[i * 4 + 3] = end;
|
|
18339
|
+
if (i === curvePoints.length - 1)
|
|
18340
|
+
continue;
|
|
18341
|
+
index[i * 6 + 0] = i * 2 + 0;
|
|
18342
|
+
index[i * 6 + 1] = i * 2 + 2;
|
|
18343
|
+
index[i * 6 + 2] = i * 2 + 1;
|
|
18344
|
+
index[i * 6 + 3] = i * 2 + 2;
|
|
18345
|
+
index[i * 6 + 4] = i * 2 + 3;
|
|
18346
|
+
index[i * 6 + 5] = i * 2 + 1;
|
|
18347
|
+
}
|
|
18348
|
+
const geometry = new THREE__namespace.BufferGeometry();
|
|
18349
|
+
geometry.setAttribute('position', new THREE__namespace.BufferAttribute(positions, 3));
|
|
18350
|
+
geometry.setAttribute('uv', new THREE__namespace.BufferAttribute(uv, 2));
|
|
18351
|
+
geometry.setIndex(new THREE__namespace.BufferAttribute(index, 1));
|
|
18352
|
+
return geometry;
|
|
18353
|
+
}
|
|
18354
|
+
|
|
18355
|
+
function getArrowMaterial(params) {
|
|
18356
|
+
var _a;
|
|
18357
|
+
// const texture = new THREE.TextureLoader().load(params?.textureUrl ?? '//vrlab-static.ljcdn.com/release/web/arrow.c5d028e4.png')
|
|
18358
|
+
// const texture = new THREE.TextureLoader().load(params?.textureUrl ?? '//vrlab-static.ljcdn.com/release/web/arrow2.aa1762e4.png')
|
|
18359
|
+
// const texture = new THREE.TextureLoader().load(params?.textureUrl ?? '//vrlab-static.ljcdn.com/release/web/arrow3.06c5b657.png')
|
|
18360
|
+
// const texture = new THREE.TextureLoader().load(params?.textureUrl ?? '//vrlab-static.ljcdn.com/release/web/arrow4.b1427685.png')
|
|
18361
|
+
// const texture = new THREE.TextureLoader().load(params?.textureUrl ?? '//vrlab-static.ljcdn.com/release/web/arrow5.ae49f3c8.png')
|
|
18362
|
+
const texture = new THREE__namespace.TextureLoader().load((_a = params === null || params === void 0 ? void 0 : params.textureUrl) !== null && _a !== void 0 ? _a : '//vrlab-static.ljcdn.com/release/web/arrow6.b6ce0c62.png');
|
|
18363
|
+
texture.wrapS = texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
18364
|
+
texture.encoding = THREE__namespace.sRGBEncoding;
|
|
18365
|
+
const arrowMaterial = new THREE__namespace.MeshBasicMaterial({
|
|
18366
|
+
color: 0xffffff,
|
|
18367
|
+
map: texture,
|
|
18368
|
+
transparent: true,
|
|
18369
|
+
opacity: 0.8,
|
|
18370
|
+
});
|
|
18371
|
+
return arrowMaterial;
|
|
18372
|
+
}
|
|
18373
|
+
|
|
18374
|
+
/**
|
|
18375
|
+
* 判断对象是否为`null`或`undefined`。
|
|
18376
|
+
* @param
|
|
18377
|
+
* @return
|
|
18378
|
+
*/
|
|
18379
|
+
/**
|
|
18380
|
+
* 判断对象不为`null`或`undefined`。
|
|
18381
|
+
*/
|
|
18382
|
+
function notNil(value) {
|
|
18383
|
+
return value !== null && value !== undefined;
|
|
18384
|
+
}
|
|
18385
|
+
|
|
18386
|
+
const VERSION$1 = 'v1.0.1';
|
|
18387
|
+
const PLUGIN_NAME$1 = 'GuideLinePlugin';
|
|
18388
|
+
const PLUGIN$1 = `${PLUGIN_NAME$1}@${VERSION$1}`;
|
|
18389
|
+
const pluginFlag = (name) => `${PLUGIN$1}--${name}`;
|
|
18390
|
+
class Controller extends Controller$6 {
|
|
18391
|
+
constructor(five) {
|
|
18392
|
+
super(five);
|
|
18393
|
+
Object.defineProperty(this, "state", {
|
|
18394
|
+
enumerable: true,
|
|
18395
|
+
configurable: true,
|
|
18396
|
+
writable: true,
|
|
18397
|
+
value: {
|
|
18398
|
+
visible: false,
|
|
18399
|
+
enabled: true,
|
|
18400
|
+
disposed: false,
|
|
18401
|
+
}
|
|
18402
|
+
});
|
|
18403
|
+
Object.defineProperty(this, "data", {
|
|
18404
|
+
enumerable: true,
|
|
18405
|
+
configurable: true,
|
|
18406
|
+
writable: true,
|
|
18407
|
+
value: void 0
|
|
18408
|
+
});
|
|
18409
|
+
Object.defineProperty(this, "linesGroup", {
|
|
18410
|
+
enumerable: true,
|
|
18411
|
+
configurable: true,
|
|
18412
|
+
writable: true,
|
|
18413
|
+
value: void 0
|
|
18414
|
+
});
|
|
18415
|
+
Object.defineProperty(this, "disposedErrorLog", {
|
|
18416
|
+
enumerable: true,
|
|
18417
|
+
configurable: true,
|
|
18418
|
+
writable: true,
|
|
18419
|
+
value: () => {
|
|
18420
|
+
console.error(`${PLUGIN$1} is disposed`);
|
|
18421
|
+
}
|
|
18422
|
+
});
|
|
18423
|
+
Object.defineProperty(this, "actionWhenEnabled", {
|
|
18424
|
+
enumerable: true,
|
|
18425
|
+
configurable: true,
|
|
18426
|
+
writable: true,
|
|
18427
|
+
value: (func) => {
|
|
18428
|
+
if (this.state.enabled)
|
|
18429
|
+
return func();
|
|
18430
|
+
}
|
|
18431
|
+
});
|
|
18432
|
+
Object.assign(window, { [`__${PLUGIN_NAME$1}_DEBUG__`]: this });
|
|
18433
|
+
}
|
|
18434
|
+
async load(serverData, state, userAction = true) {
|
|
18435
|
+
const prevData = this.data ? JSON.parse(JSON.stringify(this.data)) : undefined;
|
|
18436
|
+
// format server data to plugin data
|
|
18437
|
+
const data = await this.formatData(serverData);
|
|
18438
|
+
this.hooks.emit('dataChange', data, prevData);
|
|
18439
|
+
this.data = data;
|
|
18440
|
+
// render line group
|
|
18441
|
+
if (this.linesGroup)
|
|
18442
|
+
this.five.scene.remove(this.linesGroup);
|
|
18443
|
+
const linesGroup = this.getLinesGroup(data.routes);
|
|
18444
|
+
if (!linesGroup)
|
|
18445
|
+
return;
|
|
18446
|
+
this.linesGroup = linesGroup;
|
|
18447
|
+
this.five.scene.add(linesGroup);
|
|
18448
|
+
this.handleVisible(this.state.visible);
|
|
18449
|
+
this.handleEnable(this.state.enabled);
|
|
18450
|
+
// initialize plugin state
|
|
18451
|
+
if (state)
|
|
18452
|
+
this.setState(state);
|
|
18453
|
+
// load end
|
|
18454
|
+
this.five.needsRender = true;
|
|
18455
|
+
this.hooks.emit('dataLoaded', data);
|
|
18456
|
+
console.log(`${PLUGIN$1} loaded`, data);
|
|
18457
|
+
}
|
|
18458
|
+
async formatData(serverData) {
|
|
18459
|
+
if (typeof serverData === 'object' && serverData !== null && serverData.version && serverData.data) {
|
|
18460
|
+
return serverData.data;
|
|
18461
|
+
}
|
|
18462
|
+
return serverData;
|
|
18463
|
+
}
|
|
18464
|
+
async show(options) {
|
|
18465
|
+
this.setState({ visible: true }, options);
|
|
18466
|
+
}
|
|
18467
|
+
async hide(options) {
|
|
18468
|
+
this.setState({ visible: false }, options);
|
|
18469
|
+
}
|
|
18470
|
+
enable(options) {
|
|
18471
|
+
this.setState({ enabled: true }, options);
|
|
18472
|
+
}
|
|
18473
|
+
disable(options) {
|
|
18474
|
+
this.setState({ enabled: false }, options);
|
|
18475
|
+
}
|
|
18476
|
+
dispose() {
|
|
18477
|
+
this.setState({ disposed: true });
|
|
18478
|
+
}
|
|
18479
|
+
setState(state, options) {
|
|
18480
|
+
var _a;
|
|
18481
|
+
if (this.state.disposed)
|
|
18482
|
+
return this.disposedErrorLog();
|
|
18483
|
+
const prevState = Object.assign({}, this.state);
|
|
18484
|
+
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
18485
|
+
if (state.disposed !== undefined && state.disposed !== prevState.disposed) {
|
|
18486
|
+
if (state.disposed)
|
|
18487
|
+
this.handleDispose();
|
|
18488
|
+
}
|
|
18489
|
+
if (state.visible !== undefined && state.visible !== prevState.visible) {
|
|
18490
|
+
this.handleVisible(state.visible, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18491
|
+
}
|
|
18492
|
+
if (state.enabled !== undefined && state.enabled !== prevState.enabled) {
|
|
18493
|
+
this.handleEnable(state.enabled, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18494
|
+
}
|
|
18495
|
+
if (!equal(prevState, this.state, { deep: true })) {
|
|
18496
|
+
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 });
|
|
18497
|
+
this.five.needsRender = true;
|
|
18498
|
+
}
|
|
18499
|
+
}
|
|
18500
|
+
handleEnable(enabled, userAction = true) {
|
|
18501
|
+
if (this.linesGroup) {
|
|
18502
|
+
if (enabled) {
|
|
18503
|
+
this.five.scene.add(this.linesGroup);
|
|
18504
|
+
this.actionWhenEnabled(() => this.hooks.emit('enable', { userAction }));
|
|
18505
|
+
}
|
|
18506
|
+
else {
|
|
18507
|
+
this.five.scene.remove(this.linesGroup);
|
|
18508
|
+
this.hooks.emit('disable', { userAction });
|
|
18509
|
+
}
|
|
18510
|
+
}
|
|
18511
|
+
}
|
|
18512
|
+
handleVisible(visible, userAction = true) {
|
|
18513
|
+
if (this.linesGroup) {
|
|
18514
|
+
if (visible) {
|
|
18515
|
+
this.linesGroup.visible = true;
|
|
18516
|
+
this.actionWhenEnabled(() => this.hooks.emit('show', { userAction }));
|
|
18517
|
+
}
|
|
18518
|
+
else {
|
|
18519
|
+
this.linesGroup.visible = false;
|
|
18520
|
+
this.actionWhenEnabled(() => this.hooks.emit('hide', { userAction }));
|
|
18521
|
+
}
|
|
18522
|
+
}
|
|
18523
|
+
}
|
|
18524
|
+
handleDispose() {
|
|
18525
|
+
if (this.linesGroup)
|
|
18526
|
+
this.five.scene.add(this.linesGroup);
|
|
18527
|
+
}
|
|
18528
|
+
/**
|
|
18529
|
+
* 获取多条路线的 Mesh Group
|
|
18530
|
+
*/
|
|
18531
|
+
getLinesGroup(routes) {
|
|
18532
|
+
/** 'as THREE.Mesh[]' for build check */
|
|
18533
|
+
const meshes = routes.map(this.getLineMesh.bind(this)).filter(notNil);
|
|
18534
|
+
const group = new THREE__namespace.Group();
|
|
18535
|
+
group.name = pluginFlag('route-group');
|
|
18536
|
+
if (meshes.length === 0)
|
|
18537
|
+
return;
|
|
18538
|
+
group.add(...meshes);
|
|
18539
|
+
return group;
|
|
18540
|
+
}
|
|
18541
|
+
/**
|
|
18542
|
+
* 获取单条路线的 Mesh
|
|
18543
|
+
*/
|
|
18544
|
+
getLineMesh(data) {
|
|
18545
|
+
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);
|
|
18546
|
+
const geometry = getLineGeometry(positions);
|
|
18547
|
+
if (!geometry)
|
|
18548
|
+
return;
|
|
18549
|
+
const material = getArrowMaterial({ textureUrl: data.arrowTextureUrl });
|
|
18550
|
+
const mesh = new THREE__namespace.Mesh(geometry, material);
|
|
18551
|
+
mesh.name = pluginFlag('route-line-mesh');
|
|
18552
|
+
// mesh.renderOrder = 3
|
|
18553
|
+
return mesh;
|
|
18554
|
+
}
|
|
18555
|
+
}
|
|
18556
|
+
Object.defineProperty(Controller, "lasestVersion", {
|
|
18557
|
+
enumerable: true,
|
|
18558
|
+
configurable: true,
|
|
18559
|
+
writable: true,
|
|
18560
|
+
value: VERSION$1
|
|
18561
|
+
});
|
|
18562
|
+
|
|
18563
|
+
const GuideLinePlugin = (five) => new Controller(five);
|
|
18564
|
+
|
|
18565
|
+
/** 坐标转换成单位向量 */
|
|
18566
|
+
function coordinatesToVector(coordinates) {
|
|
18567
|
+
const distance = Math.abs(Math.cos(coordinates.latitude));
|
|
18568
|
+
return new THREE__namespace.Vector3(
|
|
18569
|
+
/* x */ -Math.sin(coordinates.longitude) * distance,
|
|
18570
|
+
/* y */ -Math.sin(coordinates.latitude),
|
|
18571
|
+
/* z */ -Math.cos(coordinates.longitude) * distance);
|
|
18572
|
+
}
|
|
18573
|
+
|
|
18574
|
+
/**
|
|
18575
|
+
* @description: 获取coordinates间的夹角
|
|
18576
|
+
* @return {number} 夹角角度
|
|
18577
|
+
*/
|
|
18578
|
+
function coordinatesAngle(coordinates1, coordinates2) {
|
|
18579
|
+
const vector1 = coordinatesToVector(coordinates1);
|
|
18580
|
+
const vector2 = coordinatesToVector(coordinates2);
|
|
18581
|
+
const angle = vector1.angleTo(vector2);
|
|
18582
|
+
return angle;
|
|
18583
|
+
}
|
|
18584
|
+
|
|
18585
|
+
const safeCall = async (fn) => {
|
|
18586
|
+
try {
|
|
18587
|
+
// eslint-disable-next-line prettier/prettier
|
|
18588
|
+
fn().then(() => { }, () => { }).catch(() => { });
|
|
18589
|
+
}
|
|
18590
|
+
catch (e) { }
|
|
18591
|
+
};
|
|
18592
|
+
|
|
18593
|
+
const TAU = Math.PI * 2;
|
|
18594
|
+
/**
|
|
18595
|
+
* 将弧度转成 0 - 2PI 中的值
|
|
18596
|
+
* @param rad - 任意弧度值
|
|
18597
|
+
* @return 0 - 2PI 的数值
|
|
18598
|
+
*/
|
|
18599
|
+
function formatRad(rad) {
|
|
18600
|
+
if (rad >= 0 && rad < TAU)
|
|
18601
|
+
return rad;
|
|
18602
|
+
return ((rad % TAU) + TAU) % TAU;
|
|
18603
|
+
}
|
|
18604
|
+
|
|
18605
|
+
/** 单位向量转换成坐标 */
|
|
18606
|
+
function vectorToCoordinates(vector) {
|
|
18607
|
+
return {
|
|
18608
|
+
longitude: formatRad(-Math.atan2(vector.x, -vector.z)),
|
|
18609
|
+
latitude: -Math.asin(vector.y / 1),
|
|
18610
|
+
};
|
|
18611
|
+
}
|
|
18612
|
+
|
|
18613
|
+
// eslint-disable-next-line max-params
|
|
18614
|
+
function linerValue(x0, v0, t1, t) {
|
|
18615
|
+
const a = -x0 / t1;
|
|
18616
|
+
const d = x0;
|
|
18617
|
+
return a * t + d;
|
|
18618
|
+
}
|
|
18619
|
+
|
|
18620
|
+
function sleep(duration) {
|
|
18621
|
+
return new Promise((resolve) => {
|
|
18622
|
+
setTimeout(() => {
|
|
18623
|
+
resolve();
|
|
18624
|
+
}, duration);
|
|
18625
|
+
});
|
|
18626
|
+
}
|
|
18627
|
+
|
|
18628
|
+
const VERSION = 'v1.0.6';
|
|
18629
|
+
const PLUGIN_NAME = 'CruisePlugin';
|
|
18630
|
+
const PLUGIN = `${PLUGIN_NAME}@${VERSION}`;
|
|
18631
|
+
const disposedErrorLog = () => {
|
|
18632
|
+
console.error(`${PLUGIN} is disposed`);
|
|
18633
|
+
};
|
|
18634
|
+
const disableWarnLog = () => {
|
|
18635
|
+
console.warn(`${PLUGIN} is disabled`);
|
|
18636
|
+
};
|
|
18637
|
+
const disableErrorLog = () => {
|
|
18638
|
+
console.error(`${PLUGIN} is disabled`);
|
|
18639
|
+
};
|
|
18640
|
+
const pauseDataMap = new Map();
|
|
18641
|
+
class CruisePluginController extends Controller$6 {
|
|
18642
|
+
constructor(five) {
|
|
18643
|
+
super(five);
|
|
18644
|
+
Object.defineProperty(this, "state", {
|
|
18645
|
+
enumerable: true,
|
|
18646
|
+
configurable: true,
|
|
18647
|
+
writable: true,
|
|
18648
|
+
value: {
|
|
18649
|
+
visible: true,
|
|
18650
|
+
enabled: true,
|
|
18651
|
+
disposed: false,
|
|
18652
|
+
playing: false,
|
|
18653
|
+
speed: 1,
|
|
18654
|
+
config: {
|
|
18655
|
+
speedConfig: {
|
|
18656
|
+
rotateSpeed: 0.001,
|
|
18657
|
+
rotateSpeedUnit: 'rad/ms',
|
|
18658
|
+
moveSpeed: 0.002,
|
|
18659
|
+
moveSpeedUnit: 'm/ms',
|
|
18660
|
+
},
|
|
18661
|
+
},
|
|
18662
|
+
}
|
|
18663
|
+
});
|
|
18664
|
+
Object.defineProperty(this, "data", {
|
|
18665
|
+
enumerable: true,
|
|
18666
|
+
configurable: true,
|
|
18667
|
+
writable: true,
|
|
18668
|
+
value: void 0
|
|
18669
|
+
});
|
|
18670
|
+
Object.defineProperty(this, "privateState", {
|
|
18671
|
+
enumerable: true,
|
|
18672
|
+
configurable: true,
|
|
18673
|
+
writable: true,
|
|
18674
|
+
value: {
|
|
18675
|
+
playing: false,
|
|
18676
|
+
currentPlayQueue: [],
|
|
18677
|
+
currentPlayKeyframe: null,
|
|
18678
|
+
broke: false,
|
|
18679
|
+
disposers: [],
|
|
18680
|
+
}
|
|
18681
|
+
});
|
|
18682
|
+
Object.defineProperty(this, "GuideLine", {
|
|
18683
|
+
enumerable: true,
|
|
18684
|
+
configurable: true,
|
|
18685
|
+
writable: true,
|
|
18686
|
+
value: void 0
|
|
18687
|
+
});
|
|
18688
|
+
Object.assign(window, { [`__${PLUGIN_NAME}_DEBUG__`]: this });
|
|
18689
|
+
const setFiveLinearUpdateCamera = this.setFiveLinearUpdateCamera.bind(this);
|
|
18690
|
+
const setFiveOriginUpdateCamera = this.setFiveOriginUpdateCamera.bind(this);
|
|
18691
|
+
this.hooks.on('play', setFiveLinearUpdateCamera);
|
|
18692
|
+
this.hooks.on('broke', setFiveOriginUpdateCamera);
|
|
18693
|
+
this.hooks.on('end', setFiveOriginUpdateCamera);
|
|
18694
|
+
this.hooks.on('pause', setFiveOriginUpdateCamera);
|
|
18695
|
+
this.privateState.disposers.push(() => {
|
|
18696
|
+
this.hooks.off('play', setFiveLinearUpdateCamera);
|
|
18697
|
+
this.hooks.off('broke', setFiveOriginUpdateCamera);
|
|
18698
|
+
this.hooks.off('end', setFiveOriginUpdateCamera);
|
|
18699
|
+
this.hooks.off('pause', setFiveOriginUpdateCamera);
|
|
18700
|
+
});
|
|
18701
|
+
}
|
|
18702
|
+
/**
|
|
18703
|
+
* @description Load Data and State
|
|
18704
|
+
*/
|
|
18705
|
+
async load(serverData, state, userAction) {
|
|
18706
|
+
var _a, _b, _c, _d, _e;
|
|
18707
|
+
if (this.state.disposed)
|
|
18708
|
+
return disposedErrorLog();
|
|
18709
|
+
if (!this.privateState.fiveOriginGetProgress) {
|
|
18710
|
+
if (!((_b = (_a = this.five.controller) === null || _a === void 0 ? void 0 : _a.cameraMotion) === null || _b === void 0 ? void 0 : _b.getProgress)) {
|
|
18711
|
+
await this.waitFiveLoaded();
|
|
18712
|
+
this.privateState.fiveOriginGetProgress = (_d = (_c = this.five.controller) === null || _c === void 0 ? void 0 : _c.cameraMotion) === null || _d === void 0 ? void 0 : _d.getProgress;
|
|
18713
|
+
}
|
|
18714
|
+
}
|
|
18715
|
+
this.clear();
|
|
18716
|
+
// copy this.data
|
|
18717
|
+
const prevData = this.data ? JSON.parse(JSON.stringify(this.data)) : undefined;
|
|
18718
|
+
// format server data to plugin data
|
|
18719
|
+
const data = await this.formatData(serverData);
|
|
18720
|
+
this.data = data;
|
|
18721
|
+
this.hooks.emit('dataChange', data, prevData);
|
|
18722
|
+
let guideLinePanoIndex = [];
|
|
18723
|
+
let tempFloorIndex;
|
|
18724
|
+
// filter panoIndex list Data
|
|
18725
|
+
const hasPanoIndexKeyframes = this.data.keyframes.filter((keyframe) => keyframe.data.panoIndex !== undefined);
|
|
18726
|
+
hasPanoIndexKeyframes
|
|
18727
|
+
.filter((keyframe, index) => { var _a; return keyframe.data.panoIndex !== ((_a = hasPanoIndexKeyframes[index - 1]) === null || _a === void 0 ? void 0 : _a.data.panoIndex); })
|
|
18728
|
+
.map((keyframe) => keyframe.data.panoIndex)
|
|
18729
|
+
.forEach((panoIndex) => {
|
|
18730
|
+
var _a, _b;
|
|
18731
|
+
const floorIndex = (_a = this.five.work.observers[panoIndex]) === null || _a === void 0 ? void 0 : _a.floorIndex;
|
|
18732
|
+
if (floorIndex === undefined)
|
|
18733
|
+
return;
|
|
18734
|
+
if (tempFloorIndex === floorIndex) {
|
|
18735
|
+
const index = guideLinePanoIndex.length - 1;
|
|
18736
|
+
guideLinePanoIndex[index] = [...((_b = guideLinePanoIndex[index]) !== null && _b !== void 0 ? _b : []), panoIndex];
|
|
18737
|
+
}
|
|
18738
|
+
else {
|
|
18739
|
+
tempFloorIndex = floorIndex;
|
|
18740
|
+
const index = guideLinePanoIndex.length;
|
|
18741
|
+
guideLinePanoIndex[index] = [panoIndex];
|
|
18742
|
+
}
|
|
18743
|
+
});
|
|
18744
|
+
// initialize GuideLinePlugin
|
|
18745
|
+
if (!this.GuideLine)
|
|
18746
|
+
this.GuideLine = GuideLinePlugin(this.five);
|
|
18747
|
+
// load GuideLine
|
|
18748
|
+
(_e = this.GuideLine) === null || _e === void 0 ? void 0 : _e.load({ routes: guideLinePanoIndex.map((route) => ({ panoIndexList: route })) });
|
|
18749
|
+
// first pause
|
|
18750
|
+
this.setState({ playing: false });
|
|
18751
|
+
// set state
|
|
18752
|
+
this.handleVisible(this.state.visible);
|
|
18753
|
+
this.handleEnable(this.state.enabled);
|
|
18754
|
+
this.changePlayState(this.state.playing);
|
|
18755
|
+
this.changeSpeed(this.state.speed);
|
|
18756
|
+
// initialize plugin state
|
|
18757
|
+
if (state)
|
|
18758
|
+
this.setState(state, { userAction });
|
|
18759
|
+
// load end
|
|
18760
|
+
console.log(`${PLUGIN} loaded`, data);
|
|
18761
|
+
this.hooks.emit('dataLoaded', data);
|
|
18762
|
+
}
|
|
18763
|
+
/**
|
|
18764
|
+
* @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
|
|
18765
|
+
*/
|
|
18766
|
+
play(options) {
|
|
18767
|
+
this.setState({ playing: true }, options);
|
|
18768
|
+
}
|
|
18769
|
+
/**
|
|
18770
|
+
* @description If playing, first pause, then play from keyframes index/id
|
|
18771
|
+
* @param {number} options.index play from keyframes index
|
|
18772
|
+
* @param {string} options.id play from keyframes id
|
|
18773
|
+
*/
|
|
18774
|
+
playFrom(options) {
|
|
18775
|
+
const { index, id, userAction } = options;
|
|
18776
|
+
if (this.state.playing)
|
|
18777
|
+
this.setState({ playing: false }, { userAction });
|
|
18778
|
+
this.setState({ playing: true }, { userAction, playFromIndex: index, playFromId: id });
|
|
18779
|
+
}
|
|
18780
|
+
/**
|
|
18781
|
+
* @description Play from first keyframe
|
|
18782
|
+
*/
|
|
18783
|
+
playFromStart(options) {
|
|
18784
|
+
return this.playFrom(Object.assign(Object.assign({}, options), { index: 0 }));
|
|
18785
|
+
}
|
|
18786
|
+
/**
|
|
18787
|
+
* @description Pause
|
|
18788
|
+
*/
|
|
18789
|
+
pause(options) {
|
|
18790
|
+
this.setState({ playing: false }, options);
|
|
18791
|
+
}
|
|
18792
|
+
/**
|
|
18793
|
+
* @description Show guide line
|
|
18794
|
+
*/
|
|
18795
|
+
async show(options) {
|
|
18796
|
+
this.setState({ visible: true }, options);
|
|
18797
|
+
}
|
|
18798
|
+
/**
|
|
18799
|
+
* @description Hide guide line
|
|
18800
|
+
*/
|
|
18801
|
+
async hide(options) {
|
|
18802
|
+
this.setState({ visible: false }, options);
|
|
18803
|
+
}
|
|
18804
|
+
/**
|
|
18805
|
+
* @description Enable
|
|
18806
|
+
*/
|
|
18807
|
+
enable(options) {
|
|
18808
|
+
this.setState({ enabled: true }, options);
|
|
18809
|
+
}
|
|
18810
|
+
/**
|
|
18811
|
+
* @description Disable
|
|
18812
|
+
*/
|
|
18813
|
+
disable(options) {
|
|
18814
|
+
this.setState({ enabled: false }, options);
|
|
18815
|
+
}
|
|
18816
|
+
/**
|
|
18817
|
+
* @description Dispose
|
|
18818
|
+
*/
|
|
18819
|
+
dispose() {
|
|
18820
|
+
this.setState({ disposed: true });
|
|
18821
|
+
}
|
|
18822
|
+
/**
|
|
18823
|
+
* @description Set state
|
|
18824
|
+
*/
|
|
18825
|
+
setState(state, options) {
|
|
18826
|
+
var _a;
|
|
18827
|
+
if (this.state.disposed)
|
|
18828
|
+
return disposedErrorLog();
|
|
18829
|
+
if (!this.state.enabled) {
|
|
18830
|
+
// when plugin is disabled, only can change enabled or disposed to true
|
|
18831
|
+
if (state.enabled !== true && state.disposed !== true)
|
|
18832
|
+
return disableErrorLog();
|
|
18833
|
+
}
|
|
18834
|
+
const prevState = Object.assign({}, this.state);
|
|
18835
|
+
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
18836
|
+
if (state.disposed !== undefined && state.disposed !== prevState.disposed) {
|
|
18837
|
+
if (state.disposed)
|
|
18838
|
+
this.handleDispose();
|
|
18839
|
+
}
|
|
18840
|
+
if (state.visible !== undefined && state.visible !== prevState.visible) {
|
|
18841
|
+
this.handleVisible(state.visible, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18842
|
+
}
|
|
18843
|
+
if (state.enabled !== undefined && state.enabled !== prevState.enabled) {
|
|
18844
|
+
this.handleEnable(state.enabled, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18845
|
+
}
|
|
18846
|
+
if (state.playing !== undefined && state.playing !== prevState.playing) {
|
|
18847
|
+
this.changePlayState(state.playing, options);
|
|
18848
|
+
}
|
|
18849
|
+
if (state.speed !== undefined && state.speed !== prevState.speed) {
|
|
18850
|
+
this.changeSpeed(state.speed, options === null || options === void 0 ? void 0 : options.userAction);
|
|
18851
|
+
}
|
|
18852
|
+
if (!equal(prevState, this.state, { deep: true })) {
|
|
18853
|
+
console.log('--emit stateChange--', this.state);
|
|
18854
|
+
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 });
|
|
18855
|
+
}
|
|
18856
|
+
}
|
|
18857
|
+
/**
|
|
18858
|
+
* @description Format data
|
|
18859
|
+
*/
|
|
18860
|
+
async formatData(serverData) {
|
|
18861
|
+
if (!this.five.work)
|
|
18862
|
+
await this.waitFiveLoaded();
|
|
18863
|
+
const observers = this.five.work.observers;
|
|
18864
|
+
const data = (() => {
|
|
18865
|
+
const _serverData = serverData;
|
|
18866
|
+
if (typeof _serverData === 'object' && _serverData !== null && _serverData.version && _serverData.data) {
|
|
18867
|
+
return _serverData.data;
|
|
18868
|
+
}
|
|
18869
|
+
return _serverData;
|
|
18870
|
+
})();
|
|
18871
|
+
if (data.keyframes) {
|
|
18872
|
+
return {
|
|
18873
|
+
keyframesId: uuid(),
|
|
18874
|
+
keyframes: data.keyframes.map((keyframe, index) => {
|
|
18875
|
+
var _a;
|
|
18876
|
+
const nextKeyframe = data.keyframes[index + 1];
|
|
18877
|
+
const stay = (() => {
|
|
18878
|
+
if (!nextKeyframe)
|
|
18879
|
+
return 0;
|
|
18880
|
+
if (nextKeyframe.start === undefined || keyframe.end === undefined)
|
|
18881
|
+
return 0;
|
|
18882
|
+
return nextKeyframe.start - keyframe.end;
|
|
18883
|
+
})();
|
|
18884
|
+
return Object.assign({ id: (_a = keyframe.uuid) !== null && _a !== void 0 ? _a : uuid(), moveIndex: index, stay, index }, keyframe);
|
|
18885
|
+
}),
|
|
18886
|
+
};
|
|
18887
|
+
}
|
|
18888
|
+
else if (data.panoIndexList) {
|
|
18889
|
+
let keyframes = [];
|
|
18890
|
+
const { moveEffect, moveToFirstPanoEffect } = data;
|
|
18891
|
+
this.privateState.moveToFirstPanoEffect = moveToFirstPanoEffect;
|
|
18892
|
+
data.panoIndexList
|
|
18893
|
+
.filter((panoIndex, index) => panoIndex !== data.panoIndexList[index - 1])
|
|
18894
|
+
.forEach((panoIndex, index) => {
|
|
18895
|
+
const lookatNextPanoIndex = (() => {
|
|
18896
|
+
var _a, _b, _c, _d;
|
|
18897
|
+
const nextPanoIndex = data.panoIndexList[index + 1];
|
|
18898
|
+
if (nextPanoIndex === undefined)
|
|
18899
|
+
return;
|
|
18900
|
+
const vectorFrom = (_a = observers[panoIndex]) === null || _a === void 0 ? void 0 : _a.position;
|
|
18901
|
+
const vectorTo = (_b = observers[nextPanoIndex]) === null || _b === void 0 ? void 0 : _b.position;
|
|
18902
|
+
if (!vectorTo || !vectorFrom)
|
|
18903
|
+
return;
|
|
18904
|
+
// if panoIndex and next panoIndex isn't in same floor, return
|
|
18905
|
+
if (((_c = observers[panoIndex]) === null || _c === void 0 ? void 0 : _c.floorIndex) !== ((_d = observers[nextPanoIndex]) === null || _d === void 0 ? void 0 : _d.floorIndex))
|
|
18906
|
+
return;
|
|
18907
|
+
const vector = new THREE__namespace.Vector3().subVectors(vectorTo, vectorFrom);
|
|
18908
|
+
return vectorToCoordinates(vector);
|
|
18909
|
+
})();
|
|
18910
|
+
if (data.moveType === undefined || data.moveType === 'justMove') {
|
|
18911
|
+
// move to panoIndex, latitude, longitude
|
|
18912
|
+
keyframes.push({
|
|
18913
|
+
moveIndex: index,
|
|
18914
|
+
stay: data.stay,
|
|
18915
|
+
data: Object.assign({ effect: 'Move', panoIndex, moveEffect }, (lookatNextPanoIndex !== null && lookatNextPanoIndex !== void 0 ? lookatNextPanoIndex : {})),
|
|
18916
|
+
});
|
|
18917
|
+
}
|
|
18918
|
+
else if (data.moveType === 'moveAndRotate') {
|
|
18919
|
+
// move to panoIndex, then rotate to latitude and longitude
|
|
18920
|
+
keyframes.push({ moveIndex: index, stay: data.stay, data: { effect: 'Move', panoIndex, moveEffect } });
|
|
18921
|
+
if (lookatNextPanoIndex)
|
|
18922
|
+
keyframes.push({ moveIndex: index, stay: data.stay, data: Object.assign({ effect: 'Rotate', panoIndex }, lookatNextPanoIndex) });
|
|
18923
|
+
}
|
|
18924
|
+
});
|
|
18925
|
+
return { keyframesId: uuid(), keyframes: keyframes.map((keyframe, index) => (Object.assign({ id: uuid(), index }, keyframe))) };
|
|
18926
|
+
}
|
|
18927
|
+
else {
|
|
18928
|
+
throw new Error('format error: data no keyframes or no panoIndexList');
|
|
18929
|
+
}
|
|
18930
|
+
}
|
|
18931
|
+
handleEnable(enabled, userAction = true) {
|
|
18932
|
+
var _a, _b;
|
|
18933
|
+
if (enabled) {
|
|
18934
|
+
(_a = this.GuideLine) === null || _a === void 0 ? void 0 : _a.enable();
|
|
18935
|
+
this.hooks.emit('enable', { userAction });
|
|
18936
|
+
}
|
|
18937
|
+
else {
|
|
18938
|
+
(_b = this.GuideLine) === null || _b === void 0 ? void 0 : _b.disable();
|
|
18939
|
+
this.changePlayState(false, { userAction });
|
|
18940
|
+
this.hooks.emit('disable', { userAction });
|
|
18941
|
+
}
|
|
18942
|
+
this.state.enabled = enabled;
|
|
18943
|
+
}
|
|
18944
|
+
handleVisible(visible, userAction = true) {
|
|
18945
|
+
var _a, _b;
|
|
18946
|
+
if (visible) {
|
|
18947
|
+
(_a = this.GuideLine) === null || _a === void 0 ? void 0 : _a.show();
|
|
18948
|
+
this.actionIfStateIsEnabled(() => this.hooks.emit('show', { userAction }));
|
|
18949
|
+
}
|
|
18950
|
+
else {
|
|
18951
|
+
(_b = this.GuideLine) === null || _b === void 0 ? void 0 : _b.hide();
|
|
18952
|
+
this.actionIfStateIsEnabled(() => this.hooks.emit('hide', { userAction }));
|
|
18953
|
+
}
|
|
18954
|
+
this.state.visible = visible;
|
|
18955
|
+
}
|
|
18956
|
+
changePlayState(play, options) {
|
|
18957
|
+
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 }); });
|
|
18958
|
+
play ? this.handlePlay(options) : this.handlePause(options);
|
|
18959
|
+
this.state.playing = play;
|
|
18960
|
+
}
|
|
18961
|
+
/**
|
|
18962
|
+
* @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
|
|
18963
|
+
* @param {number} options.playFromIndex play from keyframes index
|
|
18964
|
+
* @param {string} options.playFromId play from keyframes id
|
|
18965
|
+
*/
|
|
18966
|
+
// eslint-disable-next-line complexity
|
|
18967
|
+
async handlePlay(options) {
|
|
18968
|
+
var _a;
|
|
18969
|
+
const { data, state, privateState, hooks } = this;
|
|
18970
|
+
// check whether keyframes can be played
|
|
18971
|
+
if (privateState.playing)
|
|
18972
|
+
return;
|
|
18973
|
+
if (!(data === null || data === void 0 ? void 0 : data.keyframes) || (data === null || data === void 0 ? void 0 : data.keyframes.length) === 0)
|
|
18974
|
+
return;
|
|
18975
|
+
// set current play id
|
|
18976
|
+
const currentPlayId = uuid();
|
|
18977
|
+
// if handlePlay function is called again before play end, currentPlayId isn't equal to privateState.playId
|
|
18978
|
+
privateState.playId = currentPlayId;
|
|
18979
|
+
// set state
|
|
18980
|
+
privateState.playing = true;
|
|
18981
|
+
privateState.broke = false;
|
|
18982
|
+
const keyframes = data.keyframes;
|
|
18983
|
+
const pauseData = this.getPauseData();
|
|
18984
|
+
if ((options === null || options === void 0 ? void 0 : options.notEmitEvent) !== true) {
|
|
18985
|
+
hooks.emit('play', { userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true });
|
|
18986
|
+
}
|
|
18987
|
+
let playedFirstKeyframe = false;
|
|
18988
|
+
const getPlayFromIndex = async () => {
|
|
18989
|
+
var _a, _b;
|
|
18990
|
+
// play from index
|
|
18991
|
+
if ((options === null || options === void 0 ? void 0 : options.playFromIndex) !== undefined)
|
|
18992
|
+
return options.playFromIndex;
|
|
18993
|
+
// play from id
|
|
18994
|
+
else if ((options === null || options === void 0 ? void 0 : options.playFromId) !== undefined)
|
|
18995
|
+
return (_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframes.findIndex((keyframe) => keyframe.id === options.playFromId);
|
|
18996
|
+
// play from pause position
|
|
18997
|
+
else if (pauseData === null || pauseData === void 0 ? void 0 : pauseData.keyframeId) {
|
|
18998
|
+
const pausedKeyframe = (_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframes.find((keyframe) => keyframe.id === pauseData.keyframeId);
|
|
18999
|
+
// restore paused state
|
|
19000
|
+
if (pauseData === null || pauseData === void 0 ? void 0 : pauseData.fiveState)
|
|
19001
|
+
await this.move(pauseData.fiveState, { moveEffect: privateState.moveToFirstPanoEffect });
|
|
19002
|
+
if (pausedKeyframe) {
|
|
19003
|
+
if (pausedKeyframe.data.effect === 'Move')
|
|
19004
|
+
return pausedKeyframe.index;
|
|
19005
|
+
else if (pausedKeyframe.data.effect === 'Rotate') {
|
|
19006
|
+
const duration = pauseData.duration !== undefined ? pauseData.duration * (1 - pauseData.playedProgress) : undefined;
|
|
19007
|
+
await this.playKeyframe(pausedKeyframe, { duration });
|
|
19008
|
+
playedFirstKeyframe = true;
|
|
19009
|
+
// playFromIndex += 1 cause played last part of paused keyframe
|
|
19010
|
+
return pausedKeyframe.index + 1;
|
|
19011
|
+
}
|
|
19012
|
+
}
|
|
19013
|
+
}
|
|
19014
|
+
};
|
|
19015
|
+
const playFromIndex = await getPlayFromIndex();
|
|
19016
|
+
this.clearPauseData();
|
|
19017
|
+
// play keyframes
|
|
19018
|
+
for (const keyframe of keyframes) {
|
|
19019
|
+
if (privateState.broke || !state.playing || !privateState.playing)
|
|
19020
|
+
return;
|
|
19021
|
+
if (currentPlayId !== privateState.playId)
|
|
19022
|
+
return;
|
|
19023
|
+
// jump to start keyframe
|
|
19024
|
+
if (playFromIndex !== undefined && keyframe.index < playFromIndex)
|
|
19025
|
+
continue;
|
|
19026
|
+
// play single keyframe
|
|
19027
|
+
try {
|
|
19028
|
+
console.log('playIndexChange', keyframe.index);
|
|
19029
|
+
hooks.emit('playIndexChange', keyframe.index, keyframe);
|
|
19030
|
+
console.log({ playFromIndex });
|
|
19031
|
+
await this.playKeyframe(keyframe, {
|
|
19032
|
+
moveEffect: playedFirstKeyframe === false ? privateState.moveToFirstPanoEffect : undefined,
|
|
19033
|
+
duration: 800,
|
|
19034
|
+
});
|
|
19035
|
+
if (keyframe.stay)
|
|
19036
|
+
await sleep(keyframe.stay);
|
|
19037
|
+
if (playedFirstKeyframe === false)
|
|
19038
|
+
playedFirstKeyframe = true;
|
|
19039
|
+
}
|
|
19040
|
+
catch (error) {
|
|
19041
|
+
return Promise.resolve('broke');
|
|
19042
|
+
// if think the play be interupted by five gesture is an error, return Promise.reject(error)
|
|
19043
|
+
// return Promise.reject(error)
|
|
19044
|
+
}
|
|
19045
|
+
}
|
|
19046
|
+
if (state.playing && currentPlayId === privateState.playId) {
|
|
19047
|
+
this.setState({ playing: false }, { userAction: false });
|
|
19048
|
+
console.log('--emit end--');
|
|
19049
|
+
hooks.emit('end');
|
|
19050
|
+
this.clearPauseData();
|
|
19051
|
+
}
|
|
19052
|
+
}
|
|
19053
|
+
/**
|
|
19054
|
+
* @description: Pause and record pause state
|
|
19055
|
+
*/
|
|
19056
|
+
handlePause(options) {
|
|
19057
|
+
var _a;
|
|
19058
|
+
const { state, privateState, hooks } = this;
|
|
19059
|
+
state.playing = false;
|
|
19060
|
+
if (privateState.playing === false)
|
|
19061
|
+
return;
|
|
19062
|
+
privateState.playing = false;
|
|
19063
|
+
this.setPauseData();
|
|
19064
|
+
if (!privateState.broke)
|
|
19065
|
+
this.forceInteruptUpdateCamera();
|
|
19066
|
+
console.log('--emit pause--');
|
|
19067
|
+
if ((options === null || options === void 0 ? void 0 : options.notEmitEvent) !== true) {
|
|
19068
|
+
hooks.emit('pause', { userAction: (_a = options === null || options === void 0 ? void 0 : options.userAction) !== null && _a !== void 0 ? _a : true });
|
|
19069
|
+
}
|
|
19070
|
+
}
|
|
19071
|
+
/**
|
|
19072
|
+
* @description Play single keyframe
|
|
19073
|
+
*/
|
|
19074
|
+
async playKeyframe(keyframe, params) {
|
|
19075
|
+
var _a;
|
|
19076
|
+
const { privateState } = this;
|
|
19077
|
+
if (((_a = this.privateState.currentPlayKeyframe) === null || _a === void 0 ? void 0 : _a.keyframe.id) !== keyframe.id)
|
|
19078
|
+
this.privateState.currentPlayKeyframe = { keyframe };
|
|
19079
|
+
privateState.currentPlayQueue.push(this.getPlayPromise(keyframe, params));
|
|
19080
|
+
return this.actionPromiseQueue();
|
|
19081
|
+
}
|
|
19082
|
+
/**
|
|
19083
|
+
* @description: listen interupted by five gesture
|
|
19084
|
+
*/
|
|
19085
|
+
addInterruptListener(callback) {
|
|
19086
|
+
this.five.once('gesture', callback);
|
|
19087
|
+
this.five.once('modeChange', callback);
|
|
19088
|
+
return () => {
|
|
19089
|
+
this.five.off('gesture', callback);
|
|
19090
|
+
this.five.once('modeChange', callback);
|
|
19091
|
+
};
|
|
19092
|
+
}
|
|
19093
|
+
/**
|
|
19094
|
+
* @description: getPlayPromise
|
|
19095
|
+
*/
|
|
19096
|
+
async getPlayPromise(keyframe, params) {
|
|
19097
|
+
var _a;
|
|
19098
|
+
const data = keyframe.data;
|
|
19099
|
+
(_a = params === null || params === void 0 ? void 0 : params.duration) !== null && _a !== void 0 ? _a : (keyframe.start !== undefined && keyframe.end !== undefined ? keyframe.end - keyframe.start : undefined);
|
|
19100
|
+
if (!data)
|
|
19101
|
+
return;
|
|
19102
|
+
return new Promise((resolve, reject) => {
|
|
19103
|
+
let fulfilled = false;
|
|
19104
|
+
this.addInterruptListener(() => {
|
|
19105
|
+
if (fulfilled)
|
|
19106
|
+
return;
|
|
19107
|
+
console.log('--emit broke--');
|
|
19108
|
+
this.hooks.emit('broke');
|
|
19109
|
+
this.privateState.broke = true;
|
|
19110
|
+
this.setState({ playing: false });
|
|
19111
|
+
fulfilled = true;
|
|
19112
|
+
return reject(new Error('play is interupted'));
|
|
19113
|
+
});
|
|
19114
|
+
try {
|
|
19115
|
+
if (fulfilled)
|
|
19116
|
+
return;
|
|
19117
|
+
const res = () => {
|
|
19118
|
+
resolve();
|
|
19119
|
+
fulfilled = true;
|
|
19120
|
+
};
|
|
19121
|
+
switch (data.effect) {
|
|
19122
|
+
case 'Move':
|
|
19123
|
+
this.move(data, params).then(res);
|
|
19124
|
+
break;
|
|
19125
|
+
case 'Rotate':
|
|
19126
|
+
this.rotate(data, params).then(res);
|
|
19127
|
+
break;
|
|
19128
|
+
default:
|
|
19129
|
+
this.rotate(data, params).then(res);
|
|
19130
|
+
}
|
|
19131
|
+
}
|
|
19132
|
+
catch (e) { }
|
|
19133
|
+
});
|
|
19134
|
+
}
|
|
19135
|
+
/**
|
|
19136
|
+
* @description Action promise queue in sequence
|
|
19137
|
+
*/
|
|
19138
|
+
async actionPromiseQueue() {
|
|
19139
|
+
const { privateState } = this;
|
|
19140
|
+
return new Promise((resolve, reject) => {
|
|
19141
|
+
if (privateState.currentPlayQueue.length === 0) {
|
|
19142
|
+
resolve();
|
|
19143
|
+
return;
|
|
19144
|
+
}
|
|
19145
|
+
const promise = privateState.currentPlayQueue.shift();
|
|
19146
|
+
if (!promise) {
|
|
19147
|
+
resolve();
|
|
19148
|
+
return;
|
|
19149
|
+
}
|
|
19150
|
+
promise.then(resolve, reject);
|
|
19151
|
+
}).then(() => {
|
|
19152
|
+
if (privateState.currentPlayQueue.length === 0)
|
|
19153
|
+
return Promise.resolve();
|
|
19154
|
+
return this.actionPromiseQueue();
|
|
19155
|
+
});
|
|
19156
|
+
}
|
|
19157
|
+
/**
|
|
19158
|
+
* @description Action move keyframe
|
|
19159
|
+
*/
|
|
19160
|
+
async move(data, params) {
|
|
19161
|
+
console.log('--move--', data.panoIndex);
|
|
19162
|
+
if (data.mode && data.mode !== this.five.currentMode) {
|
|
19163
|
+
await this.changeMode(data);
|
|
19164
|
+
}
|
|
19165
|
+
else if (data.panoIndex !== this.five.panoIndex) {
|
|
19166
|
+
await this.changePano(data, params);
|
|
19167
|
+
}
|
|
19168
|
+
else {
|
|
19169
|
+
return Promise.resolve();
|
|
19170
|
+
}
|
|
19171
|
+
// await updateCamera(data)
|
|
19172
|
+
}
|
|
19173
|
+
/**
|
|
19174
|
+
* @description Action rotate keyframe
|
|
19175
|
+
*/
|
|
19176
|
+
async rotate(data, params) {
|
|
19177
|
+
console.log('--rotate--', data);
|
|
19178
|
+
if (data.mode && data.mode !== this.five.currentMode) {
|
|
19179
|
+
await this.changeMode({ mode: data.mode, panoIndex: data.panoIndex });
|
|
19180
|
+
}
|
|
19181
|
+
else if (data.panoIndex && data.panoIndex !== this.five.panoIndex) {
|
|
19182
|
+
return await this.changePano(data, params);
|
|
19183
|
+
}
|
|
19184
|
+
await this.updateCamera(data, params === null || params === void 0 ? void 0 : params.duration);
|
|
19185
|
+
}
|
|
19186
|
+
/**
|
|
19187
|
+
* @description Update five camera
|
|
19188
|
+
*/
|
|
19189
|
+
async updateCamera(data, paramsDuration = 800) {
|
|
19190
|
+
const { five, privateState, state } = this;
|
|
19191
|
+
let originDuration = paramsDuration;
|
|
19192
|
+
const speed = (() => {
|
|
19193
|
+
var _a, _b;
|
|
19194
|
+
const speedConfig = (_a = state.config) === null || _a === void 0 ? void 0 : _a.speedConfig;
|
|
19195
|
+
const speedValue = (_b = data.rotateSpeed) !== null && _b !== void 0 ? _b : speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.rotateSpeed;
|
|
19196
|
+
if ((speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.rotateSpeedUnit) === undefined)
|
|
19197
|
+
return speedValue;
|
|
19198
|
+
if (speedValue !== undefined) {
|
|
19199
|
+
return speedConfig.rotateSpeedUnit === 'rad/ms' ? speedValue : speedValue / 1000;
|
|
19200
|
+
}
|
|
19201
|
+
})();
|
|
19202
|
+
if (speed) {
|
|
19203
|
+
const coordinates1 = this.five.getCurrentState();
|
|
19204
|
+
const coordinates2 = data;
|
|
19205
|
+
const angle = coordinatesAngle(coordinates1, coordinates2);
|
|
19206
|
+
originDuration = angle / speed;
|
|
19207
|
+
}
|
|
19208
|
+
if (privateState.currentPlayKeyframe)
|
|
19209
|
+
privateState.currentPlayKeyframe.originDuration = originDuration;
|
|
19210
|
+
const duration = this.getSpeededDuration(originDuration);
|
|
19211
|
+
return new Promise((resolve) => {
|
|
19212
|
+
safeCall(() => five.updateCamera(data, duration));
|
|
19213
|
+
setTimeout(() => resolve(), duration);
|
|
19214
|
+
});
|
|
19215
|
+
}
|
|
19216
|
+
/**
|
|
19217
|
+
* @description: Change five pano
|
|
19218
|
+
*/
|
|
19219
|
+
async changePano(data, params) {
|
|
19220
|
+
var _a;
|
|
19221
|
+
const { five, privateState, state } = this;
|
|
19222
|
+
if (typeof data.panoIndex !== 'number')
|
|
19223
|
+
return;
|
|
19224
|
+
if (data.panoIndex === five.panoIndex)
|
|
19225
|
+
return;
|
|
19226
|
+
let originDuration = (_a = params === null || params === void 0 ? void 0 : params.duration) !== null && _a !== void 0 ? _a : 800;
|
|
19227
|
+
const speed = (() => {
|
|
19228
|
+
var _a, _b;
|
|
19229
|
+
const speedConfig = (_a = state.config) === null || _a === void 0 ? void 0 : _a.speedConfig;
|
|
19230
|
+
const speedValue = (_b = data.moveSpeed) !== null && _b !== void 0 ? _b : speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.moveSpeed;
|
|
19231
|
+
if ((speedConfig === null || speedConfig === void 0 ? void 0 : speedConfig.moveSpeedUnit) === undefined)
|
|
19232
|
+
return speedValue;
|
|
19233
|
+
if (speedValue !== undefined) {
|
|
19234
|
+
return speedConfig.moveSpeedUnit === 'm/ms' ? speedValue : speedValue / 1000;
|
|
19235
|
+
}
|
|
19236
|
+
})();
|
|
19237
|
+
if (speed && typeof five.panoIndex === 'number' && typeof data.panoIndex === 'number') {
|
|
19238
|
+
const postion1 = five.work.observers[five.panoIndex].position;
|
|
19239
|
+
const postion2 = five.work.observers[data.panoIndex].position;
|
|
19240
|
+
const distance = postion1.distanceTo(postion2);
|
|
19241
|
+
originDuration = distance / speed;
|
|
19242
|
+
}
|
|
19243
|
+
if (privateState.currentPlayKeyframe)
|
|
19244
|
+
privateState.currentPlayKeyframe.originDuration = originDuration;
|
|
19245
|
+
const duration = this.getSpeededDuration(originDuration);
|
|
19246
|
+
return new Promise((resolve) => {
|
|
19247
|
+
var _a, _b, _c;
|
|
19248
|
+
five.moveToPano(data.panoIndex, {
|
|
19249
|
+
latitude: data.latitude,
|
|
19250
|
+
longitude: data.longitude,
|
|
19251
|
+
fov: data.fov,
|
|
19252
|
+
duration,
|
|
19253
|
+
effect: (_c = (_a = params === null || params === void 0 ? void 0 : params.moveEffect) !== null && _a !== void 0 ? _a : (_b = this.state.config) === null || _b === void 0 ? void 0 : _b.moveEffect) !== null && _c !== void 0 ? _c : data.moveEffect,
|
|
19254
|
+
moveCancelCallback: () => resolve(),
|
|
19255
|
+
moveEndCallback: () => resolve(),
|
|
19256
|
+
});
|
|
19257
|
+
});
|
|
19258
|
+
}
|
|
19259
|
+
/**
|
|
19260
|
+
* @description: Change play speed
|
|
19261
|
+
*/
|
|
19262
|
+
changeSpeed(speed, userAction = true) {
|
|
19263
|
+
const { state, privateState, hooks } = this;
|
|
19264
|
+
const { currentPlayKeyframe } = privateState;
|
|
19265
|
+
hooks.emit('speedChange', speed, { userAction });
|
|
19266
|
+
if (state.playing && currentPlayKeyframe) {
|
|
19267
|
+
try {
|
|
19268
|
+
const duration = currentPlayKeyframe.originDuration !== undefined ? currentPlayKeyframe.originDuration * (1 - this.getProgress()) : undefined;
|
|
19269
|
+
console.log('--speedChange--', speed, { duration });
|
|
19270
|
+
const promise = this.playKeyframe(currentPlayKeyframe.keyframe, { duration });
|
|
19271
|
+
privateState.currentPlayQueue.push(promise);
|
|
19272
|
+
}
|
|
19273
|
+
catch (e) { }
|
|
19274
|
+
}
|
|
19275
|
+
}
|
|
19276
|
+
/**
|
|
19277
|
+
* @description Get duration by speed
|
|
19278
|
+
*/
|
|
19279
|
+
getSpeededDuration(duration) {
|
|
19280
|
+
return duration / this.state.speed;
|
|
19281
|
+
}
|
|
19282
|
+
/**
|
|
19283
|
+
* @description Get ratate progress
|
|
19284
|
+
*/
|
|
19285
|
+
getProgress() {
|
|
19286
|
+
return this.five.controller.cameraMotion.progress;
|
|
19287
|
+
}
|
|
19288
|
+
/**
|
|
19289
|
+
* @description Change five mode
|
|
19290
|
+
*/
|
|
19291
|
+
async changeMode(data, duration) {
|
|
19292
|
+
if (data.mode && data.mode !== this.five.currentMode) {
|
|
19293
|
+
await this.five.changeMode(data.mode, data, duration);
|
|
19294
|
+
}
|
|
19295
|
+
}
|
|
19296
|
+
/**
|
|
19297
|
+
* @description Force interupt five updateCamera
|
|
19298
|
+
*/
|
|
19299
|
+
forceInteruptUpdateCamera() {
|
|
19300
|
+
this.five.updateCamera({}, 0);
|
|
19301
|
+
}
|
|
19302
|
+
getPauseData() {
|
|
19303
|
+
var _a, _b;
|
|
19304
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframesId)
|
|
19305
|
+
return pauseDataMap.get((_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframesId);
|
|
19306
|
+
}
|
|
19307
|
+
/**
|
|
19308
|
+
* @description Set pause data
|
|
19309
|
+
*/
|
|
19310
|
+
setPauseData() {
|
|
19311
|
+
var _a, _b, _c, _d;
|
|
19312
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframesId)
|
|
19313
|
+
return pauseDataMap.set((_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframesId, {
|
|
19314
|
+
keyframeId: (_c = this.privateState.currentPlayKeyframe) === null || _c === void 0 ? void 0 : _c.keyframe.id,
|
|
19315
|
+
fiveState: this.five.getCurrentState(),
|
|
19316
|
+
duration: (_d = this.privateState.currentPlayKeyframe) === null || _d === void 0 ? void 0 : _d.originDuration,
|
|
19317
|
+
playedProgress: this.getProgress(),
|
|
19318
|
+
});
|
|
19319
|
+
}
|
|
19320
|
+
/**
|
|
19321
|
+
* @description Clear pause data
|
|
19322
|
+
*/
|
|
19323
|
+
clearPauseData() {
|
|
19324
|
+
var _a, _b;
|
|
19325
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.keyframesId)
|
|
19326
|
+
return pauseDataMap.delete((_b = this.data) === null || _b === void 0 ? void 0 : _b.keyframesId);
|
|
19327
|
+
}
|
|
19328
|
+
/**
|
|
19329
|
+
* @description: Restore state that before loaded
|
|
19330
|
+
*/
|
|
19331
|
+
clear() {
|
|
19332
|
+
this.clearPauseData();
|
|
19333
|
+
this.privateState.currentPlayKeyframe = null;
|
|
19334
|
+
}
|
|
19335
|
+
// TODO
|
|
19336
|
+
handleDispose() {
|
|
19337
|
+
var _a, _b;
|
|
19338
|
+
this.setState({ playing: false });
|
|
19339
|
+
this.clearPauseData();
|
|
19340
|
+
this.clear();
|
|
19341
|
+
(_a = this.GuideLine) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
19342
|
+
this.GuideLine = undefined;
|
|
19343
|
+
(_b = this.privateState.disposers) === null || _b === void 0 ? void 0 : _b.forEach((d) => d === null || d === void 0 ? void 0 : d());
|
|
19344
|
+
}
|
|
19345
|
+
/**
|
|
19346
|
+
* @description Action function if plugin is enable
|
|
19347
|
+
*/
|
|
19348
|
+
actionIfStateIsEnabled(func, options) {
|
|
19349
|
+
if (this.state.enabled)
|
|
19350
|
+
return func();
|
|
19351
|
+
else {
|
|
19352
|
+
if (options === null || options === void 0 ? void 0 : options.warnLog)
|
|
19353
|
+
disableWarnLog();
|
|
19354
|
+
}
|
|
19355
|
+
}
|
|
19356
|
+
/**
|
|
19357
|
+
* @description: Wait for five work ready
|
|
19358
|
+
*/
|
|
19359
|
+
async waitFiveLoaded() {
|
|
19360
|
+
return new Promise((resolve) => {
|
|
19361
|
+
if (this.five.work) {
|
|
19362
|
+
resolve();
|
|
19363
|
+
return;
|
|
19364
|
+
}
|
|
19365
|
+
this.five.once('loaded', () => {
|
|
19366
|
+
resolve();
|
|
19367
|
+
});
|
|
19368
|
+
});
|
|
19369
|
+
}
|
|
19370
|
+
setFiveLinearUpdateCamera() {
|
|
19371
|
+
if (!this.privateState.fiveOriginGetProgress)
|
|
19372
|
+
return;
|
|
19373
|
+
this.five.controller.cameraMotion.getProgress = (time) => {
|
|
19374
|
+
const cameraMotion = this.five.controller.cameraMotion;
|
|
19375
|
+
const deltaTime = time - cameraMotion.startTime;
|
|
19376
|
+
if (deltaTime < 0)
|
|
19377
|
+
return 0;
|
|
19378
|
+
if (deltaTime >= cameraMotion.duration)
|
|
19379
|
+
return 1;
|
|
19380
|
+
return 1 - linerValue(1, cameraMotion.startVelocity, cameraMotion.duration, deltaTime);
|
|
19381
|
+
};
|
|
19382
|
+
}
|
|
19383
|
+
setFiveOriginUpdateCamera() {
|
|
19384
|
+
if (!this.privateState.fiveOriginGetProgress)
|
|
19385
|
+
return;
|
|
19386
|
+
this.five.controller.cameraMotion.getProgress = this.privateState.fiveOriginGetProgress;
|
|
19387
|
+
}
|
|
19388
|
+
}
|
|
19389
|
+
Object.defineProperty(CruisePluginController, "PluginVersion", {
|
|
19390
|
+
enumerable: true,
|
|
19391
|
+
configurable: true,
|
|
19392
|
+
writable: true,
|
|
19393
|
+
value: VERSION
|
|
19394
|
+
});
|
|
19395
|
+
|
|
19396
|
+
const CruisePlugin = (five) => new CruisePluginController(five);
|
|
19397
|
+
|
|
18105
19398
|
const DnalogelVersion = '2.0.0-alpha.49';
|
|
18106
19399
|
|
|
18107
19400
|
exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
|
|
18108
19401
|
exports.CameraMovementPlugin = CameraMovementPlugin;
|
|
19402
|
+
exports.CruisePlugin = CruisePlugin;
|
|
19403
|
+
exports.CruisePluginController = CruisePluginController;
|
|
18109
19404
|
exports.DnalogelVersion = DnalogelVersion;
|
|
18110
19405
|
exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
|
|
19406
|
+
exports.GuideLinePlugin = GuideLinePlugin;
|
|
18111
19407
|
exports.ItemLabelPlugin = Plugin;
|
|
18112
19408
|
exports.Magnifier = Magnifier;
|
|
18113
19409
|
exports.MapviewFloorplanPlugin = MapviewFloorplanPlugin;
|