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