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