@realsee/dnalogel 2.0.0-alpha.35 → 2.0.0-alpha.36
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/ItemLabelPlugin/index.js +21 -41
- package/dist/ModelItemLabelPlugin/index.js +16 -36
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
- package/dist/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
- package/dist/PanoMeasurePlugin/index.js +298 -331
- package/dist/PanoMeasurePlugin/typings/data.d.ts +5 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
- package/dist/base/BasePlugin.d.ts +100 -0
- package/dist/base/BasePluginWithData.d.ts +34 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
- package/dist/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
- package/dist/floorplan/ModelFloorplanPlugin/index.js +1059 -569
- package/dist/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +489 -129
- package/dist/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
- package/dist/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +1031 -443
- package/dist/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
- package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/constant.d.ts +10 -3
- package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/correctFiveState.d.ts +2 -1
- package/dist/index.es.js +2184 -1411
- package/dist/index.js +2188 -1415
- package/dist/index.umd.js +2142 -1369
- package/dist/shared-utils/five/changeMode.d.ts +4 -1
- package/dist/shared-utils/getPxmm.d.ts +8 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- 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 +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- 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 +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- 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 +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- 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/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- 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/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/modules.html +17 -27
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +21 -41
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +16 -36
- package/libs/PanoMeasurePlugin/Controller/index.js +4 -2
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +2 -2
- package/libs/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
- package/libs/PanoMeasurePlugin/Modules/UIController/HTML.js +66 -55
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +51 -73
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +7 -4
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +10 -12
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +2 -2
- package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.js → mobileMainBtnController.js} +4 -4
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +7 -24
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +1 -2
- package/libs/PanoMeasurePlugin/typings/data.d.ts +5 -0
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +55 -7
- package/libs/base/BasePlugin.d.ts +100 -0
- package/libs/base/BasePlugin.js +31 -0
- package/libs/base/BasePluginWithData.d.ts +34 -0
- package/libs/base/BasePluginWithData.js +4 -0
- package/libs/floorplan/Components/Compass.js +11 -11
- package/libs/floorplan/Components/CurrentFloor.js +24 -11
- package/libs/floorplan/Components/Main.js +21 -15
- package/libs/floorplan/Components/RoomHighlight/Room.js +44 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +29 -12
- package/libs/floorplan/Components/RoomLabels/RoomLabel.js +164 -15
- package/libs/floorplan/Components/RoomLabels/RoomLabels.js +68 -24
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.js +1 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.js +11 -9
- package/libs/floorplan/Components/RuleLabels/RuleItem.js +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +434 -274
- package/libs/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
- package/libs/floorplan/ModelFloorplanPlugin/index.js +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
- package/libs/floorplan/ModelFloorplanPlugin/{typings/events.type.js → typing.js} +0 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +5 -5
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +114 -53
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +162 -52
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +2 -2
- package/libs/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/typing.js +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +320 -174
- package/libs/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
- package/libs/floorplan/TopviewFloorplanPlugin/index.js +2 -2
- package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -1
- package/libs/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
- package/libs/floorplan/TopviewFloorplanPlugin/typing.js +1 -0
- package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/constant.d.ts +10 -3
- package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/constant.js +9 -2
- package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/correctFiveState.d.ts +2 -1
- package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/correctFiveState.js +16 -16
- package/libs/shared-utils/five/changeMode.d.ts +4 -1
- package/libs/shared-utils/five/changeMode.js +34 -13
- package/libs/shared-utils/getPxmm.d.ts +8 -0
- package/libs/shared-utils/getPxmm.js +25 -20
- package/package.json +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
- package/docs/classes/PanoFloorplanRadarPluginController.html +0 -3
- package/docs/enums/ModelFloorplanErrorType.html +0 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +0 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +0 -5
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +0 -1
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +0 -19
- package/libs/ModelSimulationPlugin/index.d.ts +0 -33
- package/libs/ModelSimulationPlugin/index.js +0 -166
- package/libs/ModelSimulationPlugin/shaders/fragment.d.ts +0 -2
- package/libs/ModelSimulationPlugin/shaders/fragment.js +0 -96
- package/libs/ModelSimulationPlugin/shaders/vertex.d.ts +0 -2
- package/libs/ModelSimulationPlugin/shaders/vertex.js +0 -23
- package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.d.ts +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.js +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.js +0 -120
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +0 -106
- package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.js +0 -463
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +0 -375
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +0 -171
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.js +0 -265
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +0 -301
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.js +0 -219
- package/libs/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
- package/libs/shared-utils/five/useFivePlugin.d.ts +0 -1
- package/libs/shared-utils/five/useFivePlugin.js +0 -8
- package/libs/shared-utils/useDebounce.d.ts +0 -8
- package/libs/shared-utils/useDebounce.js +0 -22
- package/libs/shared-utils/useThrottle.d.ts +0 -8
- package/libs/shared-utils/useThrottle.js +0 -25
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var five = require('@realsee/five');
|
|
6
5
|
var internal = require('svelte/internal');
|
|
7
6
|
var easing = require('svelte/easing');
|
|
8
7
|
var transition = require('svelte/transition');
|
|
8
|
+
var store = require('svelte/store');
|
|
9
|
+
var svelte = require('svelte');
|
|
9
10
|
var THREE = require('three');
|
|
11
|
+
var five = require('@realsee/five');
|
|
10
12
|
|
|
11
13
|
function _interopNamespace(e) {
|
|
12
14
|
if (e && e.__esModule) return e;
|
|
@@ -28,50 +30,6 @@ function _interopNamespace(e) {
|
|
|
28
30
|
|
|
29
31
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
30
32
|
|
|
31
|
-
/**
|
|
32
|
-
* 把第一个参数传入第二个参数(函数)中并执行
|
|
33
|
-
* 一般用于执行函数后返回变量。
|
|
34
|
-
* @param {any} something
|
|
35
|
-
* @param {function} callback
|
|
36
|
-
* @return {any}
|
|
37
|
-
*/
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
function tap(something, callback) {
|
|
40
|
-
callback(something);
|
|
41
|
-
return something;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 过滤掉不需要的对象字段函数:实现从一个对象中排除某些指定属性后生成的新对象。
|
|
46
|
-
* @param object
|
|
47
|
-
* @param props 排除的属性
|
|
48
|
-
* @return
|
|
49
|
-
*/
|
|
50
|
-
function omit(object, props) {
|
|
51
|
-
return tap({}, (result) => {
|
|
52
|
-
for (const name in object) {
|
|
53
|
-
if (props.indexOf(name) !== -1)
|
|
54
|
-
continue;
|
|
55
|
-
result[name] = object[name];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var FloorplanErrorType;
|
|
61
|
-
(function (FloorplanErrorType) {
|
|
62
|
-
FloorplanErrorType["UnknownError"] = "UnknowError";
|
|
63
|
-
FloorplanErrorType["DataNotLoaded"] = "DataNotLoaded";
|
|
64
|
-
FloorplanErrorType["BreakOffByHide"] = "BreakOffByHide";
|
|
65
|
-
FloorplanErrorType["ModelNotLoaded"] = "ModelNotLoaded";
|
|
66
|
-
FloorplanErrorType["ChangeModeError"] = "ChangeModeError";
|
|
67
|
-
FloorplanErrorType["UpdateCameraError"] = "UpdateCameraError";
|
|
68
|
-
FloorplanErrorType["DifferentShowParams"] = "DifferentShowParams";
|
|
69
|
-
})(FloorplanErrorType || (FloorplanErrorType = {}));
|
|
70
|
-
/** 户型图展示 & 模型消失的默认时间 */
|
|
71
|
-
const SHOW_ANIME_DURATION = 500;
|
|
72
|
-
/** Five camera 默认 fov */
|
|
73
|
-
const FIVE_CAMERA_DEFAULT_FOV = 80;
|
|
74
|
-
|
|
75
33
|
/**
|
|
76
34
|
* 传入一个 Promise
|
|
77
35
|
* 无异常,返回 [null, data]
|
|
@@ -90,6 +48,111 @@ async function to(promise) {
|
|
|
90
48
|
}
|
|
91
49
|
}
|
|
92
50
|
|
|
51
|
+
/**
|
|
52
|
+
* 检查一个值是否是狭义上的对象
|
|
53
|
+
* @param {any} value 要检查的值
|
|
54
|
+
*
|
|
55
|
+
* isTruelyObject({})
|
|
56
|
+
* // => true
|
|
57
|
+
*
|
|
58
|
+
* isObjectLike([1, 2, 3])
|
|
59
|
+
* // => false
|
|
60
|
+
*
|
|
61
|
+
* isObjectLike(Function)
|
|
62
|
+
* // => false
|
|
63
|
+
*
|
|
64
|
+
* isObjectLike(null)
|
|
65
|
+
* // => false
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
function isTruelyObject(value) {
|
|
69
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
73
|
+
function baseIsEqual(value, other) {
|
|
74
|
+
if (value === other)
|
|
75
|
+
return true;
|
|
76
|
+
if (typeof value !== typeof other)
|
|
77
|
+
return false;
|
|
78
|
+
if (Number.isNaN(value) && Number.isNaN(other))
|
|
79
|
+
return true;
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function objEqualShallow(value, other) {
|
|
83
|
+
const valueProps = Object.getOwnPropertyNames(value);
|
|
84
|
+
const otherProps = Object.getOwnPropertyNames(other);
|
|
85
|
+
if (valueProps.length !== otherProps.length)
|
|
86
|
+
return false;
|
|
87
|
+
for (let i = 0, len = valueProps.length; i < len; i++) {
|
|
88
|
+
const propName = valueProps[i];
|
|
89
|
+
if (!baseIsEqual(value[propName], other[propName]))
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
function arrayEqualShallow(value, other) {
|
|
95
|
+
if (value.length !== other.length)
|
|
96
|
+
return false;
|
|
97
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
98
|
+
if (!baseIsEqual(value[i], other[i]))
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
function isShallowEqual(value, other) {
|
|
104
|
+
if (baseIsEqual(value, other))
|
|
105
|
+
return true;
|
|
106
|
+
if (isTruelyObject(value) && isTruelyObject(other))
|
|
107
|
+
return objEqualShallow(value, other);
|
|
108
|
+
if (Array.isArray(value) && Array.isArray(other))
|
|
109
|
+
return arrayEqualShallow(value, other);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
function isDeepEqual(value, other) {
|
|
113
|
+
if (baseIsEqual(value, other))
|
|
114
|
+
return true;
|
|
115
|
+
if (isTruelyObject(value) && isTruelyObject(other))
|
|
116
|
+
return objEqualDeep(value, other);
|
|
117
|
+
if (Array.isArray(value) && Array.isArray(other))
|
|
118
|
+
return arrayEqualDeep(value, other);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
function arrayEqualDeep(value, other) {
|
|
122
|
+
if (value.length !== other.length)
|
|
123
|
+
return false;
|
|
124
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
125
|
+
if (!isDeepEqual(value[i], other[i]))
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
function objEqualDeep(value, other) {
|
|
131
|
+
const valueProps = Object.getOwnPropertyNames(value);
|
|
132
|
+
const otherProps = Object.getOwnPropertyNames(other);
|
|
133
|
+
if (valueProps.length !== otherProps.length)
|
|
134
|
+
return false;
|
|
135
|
+
for (let i = 0, len = valueProps.length; i < len; i++) {
|
|
136
|
+
const propName = valueProps[i];
|
|
137
|
+
if (!isDeepEqual(value[propName], other[propName]))
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 对象比较
|
|
144
|
+
* @param {*} value 第一个比较的值
|
|
145
|
+
* @param {*} other 第二个比较的值
|
|
146
|
+
* @param {Object} options 可选参数,可选项包括:<br />
|
|
147
|
+
* deep {Boolean} 是否深比较<br />
|
|
148
|
+
* @returns {boolean} 是否相等
|
|
149
|
+
*/
|
|
150
|
+
function equal(value, other, opt = { deep: false }) {
|
|
151
|
+
if (!opt.deep)
|
|
152
|
+
return isShallowEqual(value, other);
|
|
153
|
+
return isDeepEqual(value, other);
|
|
154
|
+
}
|
|
155
|
+
|
|
93
156
|
const CAMERA_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAMAAAANf8AYAAAC2VBMVEUAAACCnP+Dn/+Enf+HqP+Gp/+Fof+Gpf+IrP+Lsf+Dof+Cmv+Lsv+Mtf+Eo/+Bmf+JrP+Hqf+Env+Krv+Fo/+Pu/+Ms/+Qvv+Hqf+RwP+KsP+Fpf+Mtv+Gov+Bnf+Qv/+Nt/+Krv+Ho/+Rwf+Ouv+Emv+Amv+SxP+Sw/+NuP+Mtf/G0f6huP+Ot/+JrP+Jqv+Dnv+crf6Uqv////+QvP+PvP+Ms//J0/3p9/+Ux/+Ouf+Krf+Iqf+Fpv+/zf6WsP+MpP+RqP+Uyf+Jy//V3P6Yuf+Qqf+Rqv/5/f+Sxf+Jy/////+Lx/+Ouf+Nw/+Owv+PwP+Jr/+Jq/+VvP+Vuv/c4v+Fnf+btP+InP+Blf/3+P6Txf+Jzf+Jyf+NxP+Qwf/t8/6Svv+Tvf/O1f7Czv3T2f6cu/+qvP7a4fvo7v77/v/o9//p9//0+v////+Vy//w9//k8/+B1f/v9/+D0/+UyP/u9v+D0v/i8f+F0v/g7/+G0P+KzP+Hz/////+Lx//s8/+Puf/h7P+Mxv/w9f7q8v/q8f2RwP/r8f6JrP/t8v6RvP/l6f7////j6P6VvP/f5/7q8P7a4P/U2f6au/+ZuP+ewf+auP+iu//n6f2Fn//j6P/h4fn9/v/4/P/3/P/o9v/l9P+F1P+B1f/i8v+UyP+J0f+E0f/h7//r8v6Izf/g7v/q8v6Pv//f7P7f7f/g7f+Lxf+MyP+Mw//k7v6Ow/+Ov//v8/2Pu//t8f+Tvv/p8P6Uu//q7v/i6P2Xvf+WuP/L1vypu//Azv7K0/zy8v/l8v/A4P/o9f/x+f+I0f/j8v+J0P/s9v/h8P+I0P/t9v/r9P6Lyv+Lyf/s9P/g7P+Myv/s8/7j7v+Jrv/q8P2Uwf+Epf+TuP/a3vzh5f3w8P/a4P20v//Nzfzx8f/Pz/Cg0P/f7//u9f/q8v7o8v7s8/7s8v3w9f+Sv/+TuP+Gp//s8fr///8/HFXHAAAA8nRSTlMANUQ/Z2JJXXaKTjCPmVMre3E6gFiylLxsxoVYnk5JwaOFU8utOjrV0KieQS2icWwzMC4Dt7aTQvjfrHprXD0zMyvpvUxGNjH+2sK9raeYkoiAcF5TUi0rKCYY2cy3pIJ/eGpEQDcxLx0S/Pv19PPu7Ovr5+Tk4eDe3NXU09DIsq2opKCViYN9e3V1cmZlXllVTk1GQDs2NTMwJw0K/vn28u/u5+Pj3tjNycjGw8DAua2pqJ6SjYyMf3BvaWNgWk5NSTc3MxT79PHw6efl2trY19PHurWysqWZe2xkXVlUPjo6OSskCO7Qzs6+vKCedmhdN1av0hoAAAV1SURBVEjHjZT3P9RxHMe1nCjcObo4cjpX5w53l7pUbnBGkr2TPZJKmiqVEQlJhGjvvfcm2nvvvXf5C3q/P98bkuR1D7+9n16v1/vzvtPrnAade/ty6anHJfFHOjkfXbe07PGxkuL4oqIjCzoDjHtxurzsRHmFStokjBDG/59JrwurOF2hkkUoIyKEQmFqatG3/xDnXlSGPZcKI5VKiVgsli+vrakpfNAx8UoVlpRWH6mUeMsVcm8vhah6WfXB3A6IlSlVKoE4KjxcgtNGRl1Ayzw9H+Z20DypMVkZZWKiUIi6oHj2PAbPs6Eh/+6/kBUpVUliIEQKGGcwGPbdiBpCQ/O//AMZJ218XW9igoHsGTwY7kopdMmSvTvbz/VGmiyhCARwWJ/Ss5CQ9pl3zVJZJCEwEszb6BtaGxrCn3XIyZP3trW3rybBWTCB1jy0sNGHeWM7+BgzrX4kJu752E57mWA5mIjsMRVxgGkrJpPpRvtJSywt3X2rPUSMuUgqIIzx37vRaLQeqNKEhN03/womg/bYhDJBBzdqvjsqYeHCHdfa1k9BF0QoEyuwoOadWc4sFutoXNzWGW2W3Axd8E3AxAZ6WNGeEoDl7EwPho/T0cDAtswb2Bi6kFx2VkwaDYgRI5zo9EUGRIGHD82e+ufrJ8uo+l31oQogYMJiOdFh2BQ03NTscEDAn8wKgQCeUsRTI8QEMhkYDDc1NTMLMuNwLAP8/a9Pbl0mJQlXhvVtrO2YNLce3Uew6IvAAsYtLS17gvwLCrKR0d3la0DsgdG3NiZVMBZacMh8L9CB2NjsS61eRiCtB4YH/Q21CMQKAgLnh1hYWAyJ3b9/40Qd09woppJhFytAnIPpBmBCCBjvjdrn59eKSU+SRWkZphu40IMBgRpAAMBmO7DZbL/786+s0TIpKqXOhgqGCKcnhOrd28HBlmj+2LFZWia9KjkqnHoa3BmsjG7wKIgDuSzQw9F29Gh+3jDunTseWas1zKtKYbiIsrEjZdAF2iPiYOvIz+Nyuebm5h6+HuvGa2xU0qhwBbkzayzjDO8y3IwgbAdHPp87zNx8sIvLYN/tvhc1TF1lWqSEwaMWgG3ABpIB4sC2HY2Ei0sf0O2YmLWr1CdQGRYp8SK3ic/ZnRWMLqQ+2xGRwUD069dvV8zcuRom+rlA6Y2MbgGmhAGEz4VYSPQF5cyZM6GFYl6eTlN6ixi6aE6PqDLQZRi4EKI/KOfGFjUzqCKsXu6l2RpuAKJxiI1tHhcQJAYOHDhgwOZZs4ZSTHR5lQQYPDW1DS4aELQxdyEIAANGjtk8c6aaqTslk8gVwIAN0w3rAEL2bMtHm12AIOHqenXaNDWztEwo9hKJGHjR6OO0yDSI1IGdoQ0iY0a6Tt+06fKUDRQzqKw8Qlxr1AXrwNqwDvGBA+BrGUDc3d3Xr5+SQZj0E2ERqXIjPAJYNUbD18FoWEeDbHLPzLyQ4ePjQ5i3x1RCubfmpqkjMMNo6KOJ5uqe+f58C9GoaD29XyVSYS1h4DftKeWDDN4AbACZMZAsExEKghWUNKXWhlPfA2P1qjmUT556a9jmQotWi/VOFael1lR7ep4JfRZy8nhpwtG4wMMB/gdi9/nNH+vhezsmJ+fG5quX12fomHl6J+KFy88uA2RJyJPE4wkL4wIPBfgXxO5HxGN7zNw5W2bNnLZhio+OmaR3LD6tplrLfKeYAwX7/O6Dje/2dpniwuKiwoMHH+bn7723Z8/uHTu2fpg9+3p29sYrWVnr1l1cO2HCUFCGT+tshUcWLPj6IDf37ued27Z9unXz2owZU6dOnnxp4sQ1q1ePH79KN6vbQWc1SrfrTit6lO5NO6/F8yZNmofBfgNTwRQLsPLsHQAAAABJRU5ErkJggg==';
|
|
94
157
|
|
|
95
158
|
function rad2Deg$1(rad) {
|
|
@@ -204,10 +267,10 @@ const COMPASS_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArUAAAB7CAM
|
|
|
204
267
|
/* src/floorplan/Components/Compass.svelte generated by Svelte v3.47.0 */
|
|
205
268
|
|
|
206
269
|
function add_css$c(target) {
|
|
207
|
-
internal.append_styles(target, "svelte-
|
|
270
|
+
internal.append_styles(target, "svelte-z9kwkx", ".floorplan-plugin__compass.svelte-z9kwkx{position:absolute;left:50%;top:-2.39583rem;width:12.03125rem;height:2.13542rem;will-change:opacity;transform-origin:center 9.58333rem}.floorplan-plugin__compass-image.svelte-z9kwkx{width:100%;height:100%;position:absolute;left:0;top:0;opacity:0.1;background-repeat:no-repeat;background-size:100% 100%}.floorplan-plugin__compass-text.svelte-z9kwkx{position:absolute;left:50%;top:0.78125rem;transform:translateX(-50%);opacity:0.2;font-weight:bold;font-size:0.52083rem;color:#fff}");
|
|
208
271
|
}
|
|
209
272
|
|
|
210
|
-
// (14:0) {#if
|
|
273
|
+
// (14:0) {#if canCompassShow}
|
|
211
274
|
function create_if_block$6(ctx) {
|
|
212
275
|
let div1;
|
|
213
276
|
let div0;
|
|
@@ -222,11 +285,11 @@ function create_if_block$6(ctx) {
|
|
|
222
285
|
t0 = internal.space();
|
|
223
286
|
span = internal.element("span");
|
|
224
287
|
t1 = internal.text(/*northDesc*/ ctx[0]);
|
|
225
|
-
internal.attr(div0, "class", "floorplan-plugin__compass-image svelte-
|
|
288
|
+
internal.attr(div0, "class", "floorplan-plugin__compass-image svelte-z9kwkx");
|
|
226
289
|
internal.set_style(div0, "background-image", `url(${COMPASS_IMAGE})`);
|
|
227
|
-
internal.attr(span, "class", "floorplan-plugin__compass-text svelte-
|
|
228
|
-
internal.attr(div1, "class", "floorplan-plugin__compass svelte-
|
|
229
|
-
internal.set_style(div1, "transform", /*compassTransformStyle*/ ctx[
|
|
290
|
+
internal.attr(span, "class", "floorplan-plugin__compass-text svelte-z9kwkx");
|
|
291
|
+
internal.attr(div1, "class", "floorplan-plugin__compass svelte-z9kwkx");
|
|
292
|
+
internal.set_style(div1, "transform", /*compassTransformStyle*/ ctx[2], false);
|
|
230
293
|
},
|
|
231
294
|
m(target, anchor) {
|
|
232
295
|
internal.insert(target, div1, anchor);
|
|
@@ -246,7 +309,7 @@ function create_if_block$6(ctx) {
|
|
|
246
309
|
|
|
247
310
|
function create_fragment$f(ctx) {
|
|
248
311
|
let if_block_anchor;
|
|
249
|
-
let if_block = /*
|
|
312
|
+
let if_block = /*canCompassShow*/ ctx[1] && create_if_block$6(ctx);
|
|
250
313
|
|
|
251
314
|
return {
|
|
252
315
|
c() {
|
|
@@ -258,7 +321,7 @@ function create_fragment$f(ctx) {
|
|
|
258
321
|
internal.insert(target, if_block_anchor, anchor);
|
|
259
322
|
},
|
|
260
323
|
p(ctx, [dirty]) {
|
|
261
|
-
if (/*
|
|
324
|
+
if (/*canCompassShow*/ ctx[1]) if_block.p(ctx, dirty);
|
|
262
325
|
},
|
|
263
326
|
i: internal.noop,
|
|
264
327
|
o: internal.noop,
|
|
@@ -282,16 +345,16 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
|
282
345
|
? void 0
|
|
283
346
|
: _a.northRad;
|
|
284
347
|
|
|
285
|
-
const
|
|
348
|
+
const canCompassShow = typeof northRad === 'number';
|
|
349
|
+
const rotate = !northRad ? 0 : rad2Deg(northRad);
|
|
286
350
|
const compassTransformStyle = `translateX(-50%) translateZ(10px) rotate(${-rotate + 90}deg)`;
|
|
287
|
-
const canShowCompass = typeof northRad === 'number';
|
|
288
351
|
|
|
289
352
|
$$self.$$set = $$props => {
|
|
290
353
|
if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
|
|
291
354
|
if ('northDesc' in $$props) $$invalidate(0, northDesc = $$props.northDesc);
|
|
292
355
|
};
|
|
293
356
|
|
|
294
|
-
return [northDesc,
|
|
357
|
+
return [northDesc, canCompassShow, compassTransformStyle, floorplanData];
|
|
295
358
|
}
|
|
296
359
|
|
|
297
360
|
class Compass extends internal.SvelteComponent {
|
|
@@ -622,13 +685,13 @@ class BaseImage extends internal.SvelteComponent {
|
|
|
622
685
|
/* src/floorplan/Components/RoomLabels/RoomLabel.svelte generated by Svelte v3.47.0 */
|
|
623
686
|
|
|
624
687
|
function add_css$8(target) {
|
|
625
|
-
internal.append_styles(target, "svelte-
|
|
688
|
+
internal.append_styles(target, "svelte-12pzct5", ".floorplan-plugin__room-label-item.svelte-12pzct5{position:absolute;display:flex;flex-flow:column;align-items:center;line-height:1;color:#fff;transform:translate(-50%, -50%);white-space:nowrap;will-change:opacity;transition:opacity 300ms}.floorplan-plugin__room-size.svelte-12pzct5{opacity:0.45}");
|
|
626
689
|
}
|
|
627
690
|
|
|
628
|
-
// (
|
|
691
|
+
// (95:30)
|
|
629
692
|
function create_if_block_1$3(ctx) {
|
|
630
693
|
let html_tag;
|
|
631
|
-
let raw_value = /*userConfigElement*/ ctx[
|
|
694
|
+
let raw_value = /*userConfigElement*/ ctx[4].outerHTML + "";
|
|
632
695
|
let html_anchor;
|
|
633
696
|
|
|
634
697
|
return {
|
|
@@ -642,7 +705,7 @@ function create_if_block_1$3(ctx) {
|
|
|
642
705
|
internal.insert(target, html_anchor, anchor);
|
|
643
706
|
},
|
|
644
707
|
p(ctx, dirty) {
|
|
645
|
-
if (dirty & /*userConfigElement*/
|
|
708
|
+
if (dirty & /*userConfigElement*/ 16 && raw_value !== (raw_value = /*userConfigElement*/ ctx[4].outerHTML + "")) html_tag.p(raw_value);
|
|
646
709
|
},
|
|
647
710
|
d(detaching) {
|
|
648
711
|
if (detaching) internal.detach(html_anchor);
|
|
@@ -651,7 +714,7 @@ function create_if_block_1$3(ctx) {
|
|
|
651
714
|
};
|
|
652
715
|
}
|
|
653
716
|
|
|
654
|
-
// (
|
|
717
|
+
// (89:2) {#if getLabelElement === undefined}
|
|
655
718
|
function create_if_block$4(ctx) {
|
|
656
719
|
let span0;
|
|
657
720
|
let t0_value = /*room*/ ctx[0].name + "";
|
|
@@ -665,9 +728,9 @@ function create_if_block$4(ctx) {
|
|
|
665
728
|
t0 = internal.text(t0_value);
|
|
666
729
|
t1 = internal.space();
|
|
667
730
|
span1 = internal.element("span");
|
|
668
|
-
span1.textContent = `${/*roomSizeDes*/ ctx[
|
|
731
|
+
span1.textContent = `${/*roomSizeDes*/ ctx[5]}`;
|
|
669
732
|
internal.attr(span0, "class", "floorplan-plugin__room-name");
|
|
670
|
-
internal.attr(span1, "class", "floorplan-plugin__room-size svelte-
|
|
733
|
+
internal.attr(span1, "class", "floorplan-plugin__room-size svelte-12pzct5");
|
|
671
734
|
},
|
|
672
735
|
m(target, anchor) {
|
|
673
736
|
internal.insert(target, span0, anchor);
|
|
@@ -691,7 +754,7 @@ function create_fragment$b(ctx) {
|
|
|
691
754
|
|
|
692
755
|
function select_block_type(ctx, dirty) {
|
|
693
756
|
if (/*getLabelElement*/ ctx[1] === undefined) return create_if_block$4;
|
|
694
|
-
if (/*userConfigElement*/ ctx[
|
|
757
|
+
if (/*userConfigElement*/ ctx[4]) return create_if_block_1$3;
|
|
695
758
|
}
|
|
696
759
|
|
|
697
760
|
let current_block_type = select_block_type(ctx);
|
|
@@ -701,14 +764,16 @@ function create_fragment$b(ctx) {
|
|
|
701
764
|
c() {
|
|
702
765
|
div = internal.element("div");
|
|
703
766
|
if (if_block) if_block.c();
|
|
704
|
-
internal.attr(div, "class", "floorplan-plugin__room-label-item svelte-
|
|
705
|
-
internal.set_style(div, "left", /*left*/ ctx[
|
|
706
|
-
internal.set_style(div, "top", /*top*/ ctx[
|
|
707
|
-
internal.set_style(div, "font-size", /*fontSize*/ ctx[
|
|
767
|
+
internal.attr(div, "class", "floorplan-plugin__room-label-item svelte-12pzct5");
|
|
768
|
+
internal.set_style(div, "left", /*left*/ ctx[6], false);
|
|
769
|
+
internal.set_style(div, "top", /*top*/ ctx[7], false);
|
|
770
|
+
internal.set_style(div, "font-size", /*fontSize*/ ctx[8], false);
|
|
771
|
+
internal.set_style(div, "opacity", /*labelVisible*/ ctx[3] ? '1' : '0', false);
|
|
708
772
|
},
|
|
709
773
|
m(target, anchor) {
|
|
710
774
|
internal.insert(target, div, anchor);
|
|
711
775
|
if (if_block) if_block.m(div, null);
|
|
776
|
+
/*div_binding*/ ctx[15](div);
|
|
712
777
|
},
|
|
713
778
|
p(ctx, [dirty]) {
|
|
714
779
|
if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
|
|
@@ -722,6 +787,10 @@ function create_fragment$b(ctx) {
|
|
|
722
787
|
if_block.m(div, null);
|
|
723
788
|
}
|
|
724
789
|
}
|
|
790
|
+
|
|
791
|
+
if (dirty & /*labelVisible*/ 8) {
|
|
792
|
+
internal.set_style(div, "opacity", /*labelVisible*/ ctx[3] ? '1' : '0', false);
|
|
793
|
+
}
|
|
725
794
|
},
|
|
726
795
|
i: internal.noop,
|
|
727
796
|
o: internal.noop,
|
|
@@ -731,45 +800,185 @@ function create_fragment$b(ctx) {
|
|
|
731
800
|
if (if_block) {
|
|
732
801
|
if_block.d();
|
|
733
802
|
}
|
|
803
|
+
|
|
804
|
+
/*div_binding*/ ctx[15](null);
|
|
734
805
|
}
|
|
735
806
|
};
|
|
736
807
|
}
|
|
737
808
|
|
|
809
|
+
function isPointInPolygon(point, polygon) {
|
|
810
|
+
const x = point[0];
|
|
811
|
+
const y = point[1];
|
|
812
|
+
let inside = false;
|
|
813
|
+
|
|
814
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
815
|
+
const xi = polygon[i][0];
|
|
816
|
+
const yi = polygon[i][1];
|
|
817
|
+
const xj = polygon[j][0];
|
|
818
|
+
const yj = polygon[j][1];
|
|
819
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
820
|
+
if (intersect) inside = !inside;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
return inside;
|
|
824
|
+
}
|
|
825
|
+
|
|
738
826
|
function instance$b($$self, $$props, $$invalidate) {
|
|
827
|
+
let isLabelInRoom;
|
|
739
828
|
let userConfigElement;
|
|
829
|
+
let labelVisible;
|
|
830
|
+
let { pxmm } = $$props;
|
|
740
831
|
let { room } = $$props;
|
|
832
|
+
let { hoveredRoom } = $$props;
|
|
741
833
|
let { getLabelElement } = $$props;
|
|
834
|
+
let { adaptiveRoomLabelVisibleEnable } = $$props;
|
|
835
|
+
|
|
836
|
+
function isLabelInRoomCurry(room, labelElementSize) {
|
|
837
|
+
if (labelElementSize.width === 0 || labelElementSize.height === 0) return () => false;
|
|
838
|
+
const polygon = room.path.map(({ x, y }) => [x, y]);
|
|
839
|
+
const labelPosition = room.roomLabel.position;
|
|
840
|
+
const { x, y } = labelPosition;
|
|
841
|
+
const { width, height } = labelElementSize;
|
|
842
|
+
const halfWidth = width / 2;
|
|
843
|
+
const halfHeight = height / 2;
|
|
844
|
+
|
|
845
|
+
return function isLabelInRoom(pxmm) {
|
|
846
|
+
const clientX = x * pxmm;
|
|
847
|
+
const clientY = y * pxmm;
|
|
848
|
+
const clientPolygon = polygon.map(([x, y]) => [x * pxmm, y * pxmm]);
|
|
849
|
+
|
|
850
|
+
// const
|
|
851
|
+
/** 围成 labelRect 的四个点
|
|
852
|
+
* 1----0
|
|
853
|
+
* | |
|
|
854
|
+
* 2----3
|
|
855
|
+
*/
|
|
856
|
+
const labelRectClientPoints = [
|
|
857
|
+
[clientX + halfWidth, clientY - halfHeight],
|
|
858
|
+
[clientX - halfWidth, clientY - halfHeight],
|
|
859
|
+
[clientX - halfWidth, clientY + halfHeight],
|
|
860
|
+
[clientX + halfWidth, clientY + halfHeight]
|
|
861
|
+
];
|
|
862
|
+
|
|
863
|
+
return labelRectClientPoints.every(point => isPointInPolygon(point, clientPolygon));
|
|
864
|
+
};
|
|
865
|
+
}
|
|
742
866
|
|
|
867
|
+
// ========== 获取设备宽高像素 ==========
|
|
743
868
|
// TODO: 统一这里的判断条件,目前写了多处
|
|
744
869
|
const bodyWidth = document.body.clientWidth;
|
|
745
870
|
|
|
746
871
|
const bodyHeight = document.body.clientHeight;
|
|
747
872
|
const roomSizeDes = room.size ? (room.size / 1000000).toFixed(1) + '㎡' : '';
|
|
873
|
+
|
|
874
|
+
// ====================================
|
|
748
875
|
const roomLabel = room.roomLabel;
|
|
876
|
+
|
|
749
877
|
const left = roomLabel.positionInImage.x * 100 + '%';
|
|
750
878
|
const top = roomLabel.positionInImage.y * 100 + '%';
|
|
879
|
+
|
|
880
|
+
// 屏幕宽或高小于 500px 时,用 10px 字体,否则用 14px
|
|
751
881
|
const fontSize = (bodyWidth < 500 || bodyHeight < 500 ? 10 : 14) / 16 + 'rem';
|
|
752
882
|
|
|
883
|
+
let isHoverd = false;
|
|
884
|
+
let labelElement;
|
|
885
|
+
let labelElementSize;
|
|
886
|
+
|
|
887
|
+
hoveredRoom.subscribe(function onHoverdRoomUpdate(_room) {
|
|
888
|
+
$$invalidate(12, isHoverd = !!_room && _room.id === room.id);
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
svelte.onMount(() => {
|
|
892
|
+
// Label 能不能展示只跟房间大小有关
|
|
893
|
+
// 计算 LabelElement 宽高
|
|
894
|
+
const labelDomRect = labelElement === null || labelElement === void 0
|
|
895
|
+
? void 0
|
|
896
|
+
: labelElement.getClientRects()[0];
|
|
897
|
+
|
|
898
|
+
$$invalidate(13, labelElementSize = {
|
|
899
|
+
width: labelDomRect.width,
|
|
900
|
+
height: labelDomRect.height
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
function div_binding($$value) {
|
|
905
|
+
internal.binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
906
|
+
labelElement = $$value;
|
|
907
|
+
$$invalidate(2, labelElement);
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
|
|
753
911
|
$$self.$$set = $$props => {
|
|
912
|
+
if ('pxmm' in $$props) $$invalidate(9, pxmm = $$props.pxmm);
|
|
754
913
|
if ('room' in $$props) $$invalidate(0, room = $$props.room);
|
|
914
|
+
if ('hoveredRoom' in $$props) $$invalidate(10, hoveredRoom = $$props.hoveredRoom);
|
|
755
915
|
if ('getLabelElement' in $$props) $$invalidate(1, getLabelElement = $$props.getLabelElement);
|
|
916
|
+
if ('adaptiveRoomLabelVisibleEnable' in $$props) $$invalidate(11, adaptiveRoomLabelVisibleEnable = $$props.adaptiveRoomLabelVisibleEnable);
|
|
756
917
|
};
|
|
757
918
|
|
|
758
919
|
$$self.$$.update = () => {
|
|
920
|
+
if ($$self.$$.dirty & /*labelElementSize, room*/ 8193) {
|
|
921
|
+
$$invalidate(14, isLabelInRoom = labelElementSize
|
|
922
|
+
? isLabelInRoomCurry(room, labelElementSize)
|
|
923
|
+
: undefined);
|
|
924
|
+
}
|
|
925
|
+
|
|
759
926
|
if ($$self.$$.dirty & /*getLabelElement, room*/ 3) {
|
|
760
|
-
$$invalidate(
|
|
927
|
+
$$invalidate(4, userConfigElement = getLabelElement === null || getLabelElement === void 0
|
|
761
928
|
? void 0
|
|
762
929
|
: getLabelElement(room));
|
|
763
930
|
}
|
|
931
|
+
|
|
932
|
+
if ($$self.$$.dirty & /*adaptiveRoomLabelVisibleEnable, isHoverd, isLabelInRoom, pxmm*/ 23040) {
|
|
933
|
+
$$invalidate(3, labelVisible = adaptiveRoomLabelVisibleEnable
|
|
934
|
+
? isHoverd
|
|
935
|
+
? true
|
|
936
|
+
: !!(isLabelInRoom === null || isLabelInRoom === void 0
|
|
937
|
+
? void 0
|
|
938
|
+
: isLabelInRoom(pxmm))
|
|
939
|
+
: true);
|
|
940
|
+
}
|
|
764
941
|
};
|
|
765
942
|
|
|
766
|
-
return [
|
|
943
|
+
return [
|
|
944
|
+
room,
|
|
945
|
+
getLabelElement,
|
|
946
|
+
labelElement,
|
|
947
|
+
labelVisible,
|
|
948
|
+
userConfigElement,
|
|
949
|
+
roomSizeDes,
|
|
950
|
+
left,
|
|
951
|
+
top,
|
|
952
|
+
fontSize,
|
|
953
|
+
pxmm,
|
|
954
|
+
hoveredRoom,
|
|
955
|
+
adaptiveRoomLabelVisibleEnable,
|
|
956
|
+
isHoverd,
|
|
957
|
+
labelElementSize,
|
|
958
|
+
isLabelInRoom,
|
|
959
|
+
div_binding
|
|
960
|
+
];
|
|
767
961
|
}
|
|
768
962
|
|
|
769
963
|
class RoomLabel extends internal.SvelteComponent {
|
|
770
964
|
constructor(options) {
|
|
771
965
|
super();
|
|
772
|
-
|
|
966
|
+
|
|
967
|
+
internal.init(
|
|
968
|
+
this,
|
|
969
|
+
options,
|
|
970
|
+
instance$b,
|
|
971
|
+
create_fragment$b,
|
|
972
|
+
internal.safe_not_equal,
|
|
973
|
+
{
|
|
974
|
+
pxmm: 9,
|
|
975
|
+
room: 0,
|
|
976
|
+
hoveredRoom: 10,
|
|
977
|
+
getLabelElement: 1,
|
|
978
|
+
adaptiveRoomLabelVisibleEnable: 11
|
|
979
|
+
},
|
|
980
|
+
add_css$8
|
|
981
|
+
);
|
|
773
982
|
}
|
|
774
983
|
}
|
|
775
984
|
|
|
@@ -781,18 +990,19 @@ function add_css$7(target) {
|
|
|
781
990
|
|
|
782
991
|
function get_each_context$5(ctx, list, i) {
|
|
783
992
|
const child_ctx = ctx.slice();
|
|
784
|
-
child_ctx[
|
|
993
|
+
child_ctx[9] = list[i];
|
|
785
994
|
return child_ctx;
|
|
786
995
|
}
|
|
787
996
|
|
|
788
|
-
// (
|
|
997
|
+
// (17:0) {#if rooms}
|
|
789
998
|
function create_if_block$3(ctx) {
|
|
790
999
|
let div;
|
|
791
1000
|
let each_blocks = [];
|
|
792
1001
|
let each_1_lookup = new Map();
|
|
1002
|
+
let div_resize_listener;
|
|
793
1003
|
let current;
|
|
794
|
-
let each_value = /*rooms*/ ctx[
|
|
795
|
-
const get_key = ctx => /*room*/ ctx[
|
|
1004
|
+
let each_value = /*rooms*/ ctx[5];
|
|
1005
|
+
const get_key = ctx => /*room*/ ctx[9].id;
|
|
796
1006
|
|
|
797
1007
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
798
1008
|
let child_ctx = get_each_context$5(ctx, each_value, i);
|
|
@@ -809,6 +1019,7 @@ function create_if_block$3(ctx) {
|
|
|
809
1019
|
}
|
|
810
1020
|
|
|
811
1021
|
internal.attr(div, "class", "floorplan-plugin__room-labels svelte-13xux0b");
|
|
1022
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[8].call(div));
|
|
812
1023
|
},
|
|
813
1024
|
m(target, anchor) {
|
|
814
1025
|
internal.insert(target, div, anchor);
|
|
@@ -817,11 +1028,12 @@ function create_if_block$3(ctx) {
|
|
|
817
1028
|
each_blocks[i].m(div, null);
|
|
818
1029
|
}
|
|
819
1030
|
|
|
1031
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[8].bind(div));
|
|
820
1032
|
current = true;
|
|
821
1033
|
},
|
|
822
1034
|
p(ctx, dirty) {
|
|
823
|
-
if (dirty & /*rooms, getLabelElement*/
|
|
824
|
-
each_value = /*rooms*/ ctx[
|
|
1035
|
+
if (dirty & /*pxmm, rooms, getLabelElement, hoveredRoom, adaptiveRoomLabelVisibleEnable*/ 55) {
|
|
1036
|
+
each_value = /*rooms*/ ctx[5];
|
|
825
1037
|
internal.group_outros();
|
|
826
1038
|
each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, internal.outro_and_destroy_block, create_each_block$5, null, get_each_context$5);
|
|
827
1039
|
internal.check_outros();
|
|
@@ -849,11 +1061,13 @@ function create_if_block$3(ctx) {
|
|
|
849
1061
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
850
1062
|
each_blocks[i].d();
|
|
851
1063
|
}
|
|
1064
|
+
|
|
1065
|
+
div_resize_listener();
|
|
852
1066
|
}
|
|
853
1067
|
};
|
|
854
1068
|
}
|
|
855
1069
|
|
|
856
|
-
// (
|
|
1070
|
+
// (19:4) {#each rooms as room (room.id)}
|
|
857
1071
|
function create_each_block$5(key_1, ctx) {
|
|
858
1072
|
let first;
|
|
859
1073
|
let roomlabel;
|
|
@@ -861,8 +1075,11 @@ function create_each_block$5(key_1, ctx) {
|
|
|
861
1075
|
|
|
862
1076
|
const roomlabel_spread_levels = [
|
|
863
1077
|
{
|
|
864
|
-
|
|
865
|
-
|
|
1078
|
+
pxmm: /*pxmm*/ ctx[4],
|
|
1079
|
+
room: /*room*/ ctx[9],
|
|
1080
|
+
getLabelElement: /*getLabelElement*/ ctx[1],
|
|
1081
|
+
hoveredRoom: /*hoveredRoom*/ ctx[0],
|
|
1082
|
+
adaptiveRoomLabelVisibleEnable: /*adaptiveRoomLabelVisibleEnable*/ ctx[2]
|
|
866
1083
|
}
|
|
867
1084
|
];
|
|
868
1085
|
|
|
@@ -890,11 +1107,14 @@ function create_each_block$5(key_1, ctx) {
|
|
|
890
1107
|
p(new_ctx, dirty) {
|
|
891
1108
|
ctx = new_ctx;
|
|
892
1109
|
|
|
893
|
-
const roomlabel_changes = (dirty & /*rooms, getLabelElement*/
|
|
1110
|
+
const roomlabel_changes = (dirty & /*pxmm, rooms, getLabelElement, hoveredRoom, adaptiveRoomLabelVisibleEnable*/ 55)
|
|
894
1111
|
? internal.get_spread_update(roomlabel_spread_levels, [
|
|
895
1112
|
{
|
|
896
|
-
|
|
897
|
-
|
|
1113
|
+
pxmm: /*pxmm*/ ctx[4],
|
|
1114
|
+
room: /*room*/ ctx[9],
|
|
1115
|
+
getLabelElement: /*getLabelElement*/ ctx[1],
|
|
1116
|
+
hoveredRoom: /*hoveredRoom*/ ctx[0],
|
|
1117
|
+
adaptiveRoomLabelVisibleEnable: /*adaptiveRoomLabelVisibleEnable*/ ctx[2]
|
|
898
1118
|
}
|
|
899
1119
|
])
|
|
900
1120
|
: {};
|
|
@@ -920,7 +1140,7 @@ function create_each_block$5(key_1, ctx) {
|
|
|
920
1140
|
function create_fragment$a(ctx) {
|
|
921
1141
|
let if_block_anchor;
|
|
922
1142
|
let current;
|
|
923
|
-
let if_block = /*rooms*/ ctx[
|
|
1143
|
+
let if_block = /*rooms*/ ctx[5] && create_if_block$3(ctx);
|
|
924
1144
|
|
|
925
1145
|
return {
|
|
926
1146
|
c() {
|
|
@@ -933,11 +1153,11 @@ function create_fragment$a(ctx) {
|
|
|
933
1153
|
current = true;
|
|
934
1154
|
},
|
|
935
1155
|
p(ctx, [dirty]) {
|
|
936
|
-
if (/*rooms*/ ctx[
|
|
1156
|
+
if (/*rooms*/ ctx[5]) {
|
|
937
1157
|
if (if_block) {
|
|
938
1158
|
if_block.p(ctx, dirty);
|
|
939
1159
|
|
|
940
|
-
if (dirty & /*rooms*/
|
|
1160
|
+
if (dirty & /*rooms*/ 32) {
|
|
941
1161
|
internal.transition_in(if_block, 1);
|
|
942
1162
|
}
|
|
943
1163
|
} else {
|
|
@@ -976,21 +1196,50 @@ function instance$a($$self, $$props, $$invalidate) {
|
|
|
976
1196
|
let rooms;
|
|
977
1197
|
let { floorIndex } = $$props;
|
|
978
1198
|
let { floorplanData } = $$props;
|
|
1199
|
+
let { hoveredRoom } = $$props;
|
|
979
1200
|
let { getLabelElement } = $$props;
|
|
1201
|
+
let { adaptiveRoomLabelVisibleEnable } = $$props;
|
|
1202
|
+
let clientWidth = 0;
|
|
1203
|
+
let pxmm = 0;
|
|
1204
|
+
|
|
1205
|
+
function div_elementresize_handler() {
|
|
1206
|
+
clientWidth = this.clientWidth;
|
|
1207
|
+
$$invalidate(3, clientWidth);
|
|
1208
|
+
}
|
|
980
1209
|
|
|
981
1210
|
$$self.$$set = $$props => {
|
|
982
|
-
if ('floorIndex' in $$props) $$invalidate(
|
|
983
|
-
if ('floorplanData' in $$props) $$invalidate(
|
|
984
|
-
if ('
|
|
1211
|
+
if ('floorIndex' in $$props) $$invalidate(6, floorIndex = $$props.floorIndex);
|
|
1212
|
+
if ('floorplanData' in $$props) $$invalidate(7, floorplanData = $$props.floorplanData);
|
|
1213
|
+
if ('hoveredRoom' in $$props) $$invalidate(0, hoveredRoom = $$props.hoveredRoom);
|
|
1214
|
+
if ('getLabelElement' in $$props) $$invalidate(1, getLabelElement = $$props.getLabelElement);
|
|
1215
|
+
if ('adaptiveRoomLabelVisibleEnable' in $$props) $$invalidate(2, adaptiveRoomLabelVisibleEnable = $$props.adaptiveRoomLabelVisibleEnable);
|
|
985
1216
|
};
|
|
986
1217
|
|
|
987
1218
|
$$self.$$.update = () => {
|
|
988
|
-
if ($$self.$$.dirty & /*floorplanData, floorIndex*/
|
|
989
|
-
$$invalidate(
|
|
1219
|
+
if ($$self.$$.dirty & /*floorplanData, floorIndex*/ 192) {
|
|
1220
|
+
$$invalidate(5, rooms = floorplanData.floorDatas[floorIndex].rooms);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
if ($$self.$$.dirty & /*floorplanData, clientWidth*/ 136) {
|
|
1224
|
+
{
|
|
1225
|
+
const { max, min } = floorplanData.bounding;
|
|
1226
|
+
const boundingWidth = max.x - min.x;
|
|
1227
|
+
$$invalidate(4, pxmm = clientWidth / boundingWidth);
|
|
1228
|
+
}
|
|
990
1229
|
}
|
|
991
1230
|
};
|
|
992
1231
|
|
|
993
|
-
return [
|
|
1232
|
+
return [
|
|
1233
|
+
hoveredRoom,
|
|
1234
|
+
getLabelElement,
|
|
1235
|
+
adaptiveRoomLabelVisibleEnable,
|
|
1236
|
+
clientWidth,
|
|
1237
|
+
pxmm,
|
|
1238
|
+
rooms,
|
|
1239
|
+
floorIndex,
|
|
1240
|
+
floorplanData,
|
|
1241
|
+
div_elementresize_handler
|
|
1242
|
+
];
|
|
994
1243
|
}
|
|
995
1244
|
|
|
996
1245
|
class RoomLabels extends internal.SvelteComponent {
|
|
@@ -1004,9 +1253,11 @@ class RoomLabels extends internal.SvelteComponent {
|
|
|
1004
1253
|
create_fragment$a,
|
|
1005
1254
|
internal.safe_not_equal,
|
|
1006
1255
|
{
|
|
1007
|
-
floorIndex:
|
|
1008
|
-
floorplanData:
|
|
1009
|
-
|
|
1256
|
+
floorIndex: 6,
|
|
1257
|
+
floorplanData: 7,
|
|
1258
|
+
hoveredRoom: 0,
|
|
1259
|
+
getLabelElement: 1,
|
|
1260
|
+
adaptiveRoomLabelVisibleEnable: 2
|
|
1010
1261
|
},
|
|
1011
1262
|
add_css$7
|
|
1012
1263
|
);
|
|
@@ -1032,7 +1283,7 @@ function get_each_context_1(ctx, list, i) {
|
|
|
1032
1283
|
return child_ctx;
|
|
1033
1284
|
}
|
|
1034
1285
|
|
|
1035
|
-
// (
|
|
1286
|
+
// (47:4) {#each rulerLabels as rulerLabel}
|
|
1036
1287
|
function create_each_block_1(ctx) {
|
|
1037
1288
|
let div;
|
|
1038
1289
|
|
|
@@ -1053,7 +1304,7 @@ function create_each_block_1(ctx) {
|
|
|
1053
1304
|
};
|
|
1054
1305
|
}
|
|
1055
1306
|
|
|
1056
|
-
// (
|
|
1307
|
+
// (56:4) {#each rulerTexts as textItem, textItemIndex (textItemIndex)}
|
|
1057
1308
|
function create_each_block$4(key_1, ctx) {
|
|
1058
1309
|
let div1;
|
|
1059
1310
|
let div0;
|
|
@@ -1631,6 +1882,7 @@ function create_fragment$6(ctx) {
|
|
|
1631
1882
|
internal.attr(pattern, "width", /*width*/ ctx[1]);
|
|
1632
1883
|
internal.attr(pattern, "height", /*width*/ ctx[1]);
|
|
1633
1884
|
internal.attr(pattern, "patternUnits", "userSpaceOnUse");
|
|
1885
|
+
internal.attr(pattern, "patternTransform", "scale(50 50)");
|
|
1634
1886
|
internal.attr(path1, "d", /*d*/ ctx[0]);
|
|
1635
1887
|
internal.attr(path1, "fill", "url(#fpm-room-pattern-0)");
|
|
1636
1888
|
},
|
|
@@ -1713,8 +1965,8 @@ function create_fragment$5(ctx) {
|
|
|
1713
1965
|
path1 = internal.svg_element("path");
|
|
1714
1966
|
t2 = internal.space();
|
|
1715
1967
|
path2 = internal.svg_element("path");
|
|
1716
|
-
internal.attr(rect0, "x", "0
|
|
1717
|
-
internal.attr(rect0, "y", "0
|
|
1968
|
+
internal.attr(rect0, "x", "0");
|
|
1969
|
+
internal.attr(rect0, "y", "0");
|
|
1718
1970
|
internal.attr(rect0, "width", "6");
|
|
1719
1971
|
internal.attr(rect0, "height", "50");
|
|
1720
1972
|
internal.attr(rect0, "fill", "none");
|
|
@@ -1723,22 +1975,24 @@ function create_fragment$5(ctx) {
|
|
|
1723
1975
|
internal.attr(pattern0, "id", "room-material-pattern-1");
|
|
1724
1976
|
internal.attr(pattern0, "x", "0");
|
|
1725
1977
|
internal.attr(pattern0, "y", "0");
|
|
1726
|
-
internal.attr(pattern0, "width", "
|
|
1727
|
-
internal.attr(pattern0, "height", "
|
|
1978
|
+
internal.attr(pattern0, "width", "12");
|
|
1979
|
+
internal.attr(pattern0, "height", "50");
|
|
1728
1980
|
internal.attr(pattern0, "patternUnits", "userSpaceOnUse");
|
|
1729
|
-
internal.attr(
|
|
1730
|
-
internal.attr(rect1, "
|
|
1981
|
+
internal.attr(pattern0, "patternTransform", "scale(50 50)");
|
|
1982
|
+
internal.attr(rect1, "x", "0");
|
|
1983
|
+
internal.attr(rect1, "y", "0");
|
|
1731
1984
|
internal.attr(rect1, "width", "6");
|
|
1732
1985
|
internal.attr(rect1, "height", "50");
|
|
1733
1986
|
internal.attr(rect1, "fill", "none");
|
|
1734
1987
|
internal.attr(rect1, "stroke", "#4B4B57");
|
|
1735
1988
|
internal.attr(rect1, "stroke-width", "0.5");
|
|
1736
1989
|
internal.attr(pattern1, "id", "room-material-pattern-2");
|
|
1737
|
-
internal.attr(pattern1, "x", "
|
|
1990
|
+
internal.attr(pattern1, "x", "6");
|
|
1738
1991
|
internal.attr(pattern1, "y", "25");
|
|
1739
|
-
internal.attr(pattern1, "width", "
|
|
1740
|
-
internal.attr(pattern1, "height", "
|
|
1992
|
+
internal.attr(pattern1, "width", "12");
|
|
1993
|
+
internal.attr(pattern1, "height", "50");
|
|
1741
1994
|
internal.attr(pattern1, "patternUnits", "userSpaceOnUse");
|
|
1995
|
+
internal.attr(pattern1, "patternTransform", "scale(50 50)");
|
|
1742
1996
|
internal.attr(path0, "d", /*d*/ ctx[0]);
|
|
1743
1997
|
internal.attr(path0, "fill", "#43434D");
|
|
1744
1998
|
internal.attr(path1, "d", /*d*/ ctx[0]);
|
|
@@ -2124,22 +2378,35 @@ function add_css$3(target) {
|
|
|
2124
2378
|
|
|
2125
2379
|
function create_fragment$3(ctx) {
|
|
2126
2380
|
let path;
|
|
2381
|
+
let mounted;
|
|
2382
|
+
let dispose;
|
|
2127
2383
|
|
|
2128
2384
|
return {
|
|
2129
2385
|
c() {
|
|
2130
2386
|
path = internal.svg_element("path");
|
|
2131
|
-
internal.attr(path, "d", /*_pathD*/ ctx[
|
|
2387
|
+
internal.attr(path, "d", /*_pathD*/ ctx[2]);
|
|
2132
2388
|
internal.attr(path, "fill", `#fff`);
|
|
2133
2389
|
internal.attr(path, "class", "svelte-19uvvss");
|
|
2134
2390
|
},
|
|
2135
2391
|
m(target, anchor) {
|
|
2136
2392
|
internal.insert(target, path, anchor);
|
|
2393
|
+
|
|
2394
|
+
if (!mounted) {
|
|
2395
|
+
dispose = [
|
|
2396
|
+
internal.listen(path, "mouseenter", /*onMouseEnter*/ ctx[0]),
|
|
2397
|
+
internal.listen(path, "mouseleave", /*onMouseLeave*/ ctx[1])
|
|
2398
|
+
];
|
|
2399
|
+
|
|
2400
|
+
mounted = true;
|
|
2401
|
+
}
|
|
2137
2402
|
},
|
|
2138
2403
|
p: internal.noop,
|
|
2139
2404
|
i: internal.noop,
|
|
2140
2405
|
o: internal.noop,
|
|
2141
2406
|
d(detaching) {
|
|
2142
2407
|
if (detaching) internal.detach(path);
|
|
2408
|
+
mounted = false;
|
|
2409
|
+
internal.run_all(dispose);
|
|
2143
2410
|
}
|
|
2144
2411
|
};
|
|
2145
2412
|
}
|
|
@@ -2147,6 +2414,16 @@ function create_fragment$3(ctx) {
|
|
|
2147
2414
|
function instance$3($$self, $$props, $$invalidate) {
|
|
2148
2415
|
let { room } = $$props;
|
|
2149
2416
|
let { floorplanData } = $$props;
|
|
2417
|
+
let { hoveredRoom } = $$props;
|
|
2418
|
+
|
|
2419
|
+
function onMouseEnter() {
|
|
2420
|
+
hoveredRoom.set(room);
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
function onMouseLeave() {
|
|
2424
|
+
hoveredRoom.set(undefined);
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2150
2427
|
const { bounding } = floorplanData;
|
|
2151
2428
|
|
|
2152
2429
|
const _pathD = pathD(room.path, {
|
|
@@ -2155,17 +2432,31 @@ function instance$3($$self, $$props, $$invalidate) {
|
|
|
2155
2432
|
});
|
|
2156
2433
|
|
|
2157
2434
|
$$self.$$set = $$props => {
|
|
2158
|
-
if ('room' in $$props) $$invalidate(
|
|
2159
|
-
if ('floorplanData' in $$props) $$invalidate(
|
|
2435
|
+
if ('room' in $$props) $$invalidate(3, room = $$props.room);
|
|
2436
|
+
if ('floorplanData' in $$props) $$invalidate(4, floorplanData = $$props.floorplanData);
|
|
2437
|
+
if ('hoveredRoom' in $$props) $$invalidate(5, hoveredRoom = $$props.hoveredRoom);
|
|
2160
2438
|
};
|
|
2161
2439
|
|
|
2162
|
-
return [_pathD, room, floorplanData];
|
|
2440
|
+
return [onMouseEnter, onMouseLeave, _pathD, room, floorplanData, hoveredRoom];
|
|
2163
2441
|
}
|
|
2164
2442
|
|
|
2165
2443
|
class Room extends internal.SvelteComponent {
|
|
2166
2444
|
constructor(options) {
|
|
2167
2445
|
super();
|
|
2168
|
-
|
|
2446
|
+
|
|
2447
|
+
internal.init(
|
|
2448
|
+
this,
|
|
2449
|
+
options,
|
|
2450
|
+
instance$3,
|
|
2451
|
+
create_fragment$3,
|
|
2452
|
+
internal.safe_not_equal,
|
|
2453
|
+
{
|
|
2454
|
+
room: 3,
|
|
2455
|
+
floorplanData: 4,
|
|
2456
|
+
hoveredRoom: 5
|
|
2457
|
+
},
|
|
2458
|
+
add_css$3
|
|
2459
|
+
);
|
|
2169
2460
|
}
|
|
2170
2461
|
}
|
|
2171
2462
|
|
|
@@ -2177,11 +2468,11 @@ function add_css$2(target) {
|
|
|
2177
2468
|
|
|
2178
2469
|
function get_each_context$1(ctx, list, i) {
|
|
2179
2470
|
const child_ctx = ctx.slice();
|
|
2180
|
-
child_ctx[
|
|
2471
|
+
child_ctx[5] = list[i];
|
|
2181
2472
|
return child_ctx;
|
|
2182
2473
|
}
|
|
2183
2474
|
|
|
2184
|
-
// (
|
|
2475
|
+
// (11:4) {#each floorplanData.floorDatas[floorIndex].rooms as room (room.id)}
|
|
2185
2476
|
function create_each_block$1(key_1, ctx) {
|
|
2186
2477
|
let first;
|
|
2187
2478
|
let room;
|
|
@@ -2189,8 +2480,9 @@ function create_each_block$1(key_1, ctx) {
|
|
|
2189
2480
|
|
|
2190
2481
|
const room_spread_levels = [
|
|
2191
2482
|
{
|
|
2192
|
-
room: /*room*/ ctx[
|
|
2193
|
-
floorplanData: /*floorplanData*/ ctx[1]
|
|
2483
|
+
room: /*room*/ ctx[5],
|
|
2484
|
+
floorplanData: /*floorplanData*/ ctx[1],
|
|
2485
|
+
hoveredRoom: /*hoveredRoom*/ ctx[2]
|
|
2194
2486
|
}
|
|
2195
2487
|
];
|
|
2196
2488
|
|
|
@@ -2218,11 +2510,12 @@ function create_each_block$1(key_1, ctx) {
|
|
|
2218
2510
|
p(new_ctx, dirty) {
|
|
2219
2511
|
ctx = new_ctx;
|
|
2220
2512
|
|
|
2221
|
-
const room_changes = (dirty & /*floorplanData, floorIndex*/
|
|
2513
|
+
const room_changes = (dirty & /*floorplanData, floorIndex, hoveredRoom*/ 7)
|
|
2222
2514
|
? internal.get_spread_update(room_spread_levels, [
|
|
2223
2515
|
{
|
|
2224
|
-
room: /*room*/ ctx[
|
|
2225
|
-
floorplanData: /*floorplanData*/ ctx[1]
|
|
2516
|
+
room: /*room*/ ctx[5],
|
|
2517
|
+
floorplanData: /*floorplanData*/ ctx[1],
|
|
2518
|
+
hoveredRoom: /*hoveredRoom*/ ctx[2]
|
|
2226
2519
|
}
|
|
2227
2520
|
])
|
|
2228
2521
|
: {};
|
|
@@ -2252,7 +2545,7 @@ function create_fragment$2(ctx) {
|
|
|
2252
2545
|
let each_1_lookup = new Map();
|
|
2253
2546
|
let current;
|
|
2254
2547
|
let each_value = /*floorplanData*/ ctx[1].floorDatas[/*floorIndex*/ ctx[0]].rooms;
|
|
2255
|
-
const get_key = ctx => /*room*/ ctx[
|
|
2548
|
+
const get_key = ctx => /*room*/ ctx[5].id;
|
|
2256
2549
|
|
|
2257
2550
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
2258
2551
|
let child_ctx = get_each_context$1(ctx, each_value, i);
|
|
@@ -2271,7 +2564,7 @@ function create_fragment$2(ctx) {
|
|
|
2271
2564
|
|
|
2272
2565
|
internal.attr(svg, "width", "100%");
|
|
2273
2566
|
internal.attr(svg, "height", "100%");
|
|
2274
|
-
internal.attr(svg, "viewBox", `0 0 ${/*boundingWidth*/ ctx[
|
|
2567
|
+
internal.attr(svg, "viewBox", `0 0 ${/*boundingWidth*/ ctx[3]} ${/*boundingHeight*/ ctx[4]}`);
|
|
2275
2568
|
internal.attr(svg, "class", "svelte-1kqo6e4");
|
|
2276
2569
|
internal.attr(div, "class", "floorplan-plugin__room-highlight svelte-1kqo6e4");
|
|
2277
2570
|
},
|
|
@@ -2286,7 +2579,7 @@ function create_fragment$2(ctx) {
|
|
|
2286
2579
|
current = true;
|
|
2287
2580
|
},
|
|
2288
2581
|
p(ctx, [dirty]) {
|
|
2289
|
-
if (dirty & /*floorplanData, floorIndex*/
|
|
2582
|
+
if (dirty & /*floorplanData, floorIndex, hoveredRoom*/ 7) {
|
|
2290
2583
|
each_value = /*floorplanData*/ ctx[1].floorDatas[/*floorIndex*/ ctx[0]].rooms;
|
|
2291
2584
|
internal.group_outros();
|
|
2292
2585
|
each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, svg, internal.outro_and_destroy_block, create_each_block$1, null, get_each_context$1);
|
|
@@ -2322,21 +2615,36 @@ function create_fragment$2(ctx) {
|
|
|
2322
2615
|
function instance$2($$self, $$props, $$invalidate) {
|
|
2323
2616
|
let { floorIndex } = $$props;
|
|
2324
2617
|
let { floorplanData } = $$props;
|
|
2618
|
+
let { hoveredRoom } = $$props;
|
|
2325
2619
|
const boundingWidth = floorplanData.bounding.max.x - floorplanData.bounding.min.x;
|
|
2326
2620
|
const boundingHeight = floorplanData.bounding.max.y - floorplanData.bounding.min.y;
|
|
2327
2621
|
|
|
2328
2622
|
$$self.$$set = $$props => {
|
|
2329
2623
|
if ('floorIndex' in $$props) $$invalidate(0, floorIndex = $$props.floorIndex);
|
|
2330
2624
|
if ('floorplanData' in $$props) $$invalidate(1, floorplanData = $$props.floorplanData);
|
|
2625
|
+
if ('hoveredRoom' in $$props) $$invalidate(2, hoveredRoom = $$props.hoveredRoom);
|
|
2331
2626
|
};
|
|
2332
2627
|
|
|
2333
|
-
return [floorIndex, floorplanData, boundingWidth, boundingHeight];
|
|
2628
|
+
return [floorIndex, floorplanData, hoveredRoom, boundingWidth, boundingHeight];
|
|
2334
2629
|
}
|
|
2335
2630
|
|
|
2336
2631
|
class RoomHighlight extends internal.SvelteComponent {
|
|
2337
2632
|
constructor(options) {
|
|
2338
2633
|
super();
|
|
2339
|
-
|
|
2634
|
+
|
|
2635
|
+
internal.init(
|
|
2636
|
+
this,
|
|
2637
|
+
options,
|
|
2638
|
+
instance$2,
|
|
2639
|
+
create_fragment$2,
|
|
2640
|
+
internal.safe_not_equal,
|
|
2641
|
+
{
|
|
2642
|
+
floorIndex: 0,
|
|
2643
|
+
floorplanData: 1,
|
|
2644
|
+
hoveredRoom: 2
|
|
2645
|
+
},
|
|
2646
|
+
add_css$2
|
|
2647
|
+
);
|
|
2340
2648
|
}
|
|
2341
2649
|
}
|
|
2342
2650
|
|
|
@@ -2346,7 +2654,7 @@ function add_css$1(target) {
|
|
|
2346
2654
|
internal.append_styles(target, "svelte-bl8zrz", ".floorplan-plugin__floor.svelte-bl8zrz{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;pointer-events:none}.floorplan-plugin__floor--is-current.svelte-bl8zrz{opacity:1;pointer-events:auto}");
|
|
2347
2655
|
}
|
|
2348
2656
|
|
|
2349
|
-
// (
|
|
2657
|
+
// (20:2) {#if hoverEnable}
|
|
2350
2658
|
function create_if_block_2(ctx) {
|
|
2351
2659
|
let roomhighlight;
|
|
2352
2660
|
let current;
|
|
@@ -2354,7 +2662,8 @@ function create_if_block_2(ctx) {
|
|
|
2354
2662
|
const roomhighlight_spread_levels = [
|
|
2355
2663
|
{
|
|
2356
2664
|
floorIndex: /*floorIndex*/ ctx[1],
|
|
2357
|
-
floorplanData: /*floorplanData*/ ctx[5]
|
|
2665
|
+
floorplanData: /*floorplanData*/ ctx[5],
|
|
2666
|
+
hoveredRoom: /*hoveredRoom*/ ctx[8]
|
|
2358
2667
|
}
|
|
2359
2668
|
];
|
|
2360
2669
|
|
|
@@ -2375,11 +2684,12 @@ function create_if_block_2(ctx) {
|
|
|
2375
2684
|
current = true;
|
|
2376
2685
|
},
|
|
2377
2686
|
p(ctx, dirty) {
|
|
2378
|
-
const roomhighlight_changes = (dirty & /*floorIndex, floorplanData*/
|
|
2687
|
+
const roomhighlight_changes = (dirty & /*floorIndex, floorplanData, hoveredRoom*/ 290)
|
|
2379
2688
|
? internal.get_spread_update(roomhighlight_spread_levels, [
|
|
2380
2689
|
{
|
|
2381
2690
|
floorIndex: /*floorIndex*/ ctx[1],
|
|
2382
|
-
floorplanData: /*floorplanData*/ ctx[5]
|
|
2691
|
+
floorplanData: /*floorplanData*/ ctx[5],
|
|
2692
|
+
hoveredRoom: /*hoveredRoom*/ ctx[8]
|
|
2383
2693
|
}
|
|
2384
2694
|
])
|
|
2385
2695
|
: {};
|
|
@@ -2401,7 +2711,7 @@ function create_if_block_2(ctx) {
|
|
|
2401
2711
|
};
|
|
2402
2712
|
}
|
|
2403
2713
|
|
|
2404
|
-
// (
|
|
2714
|
+
// (24:2) {#if roomLabelsEnable}
|
|
2405
2715
|
function create_if_block_1$1(ctx) {
|
|
2406
2716
|
let roomlabels;
|
|
2407
2717
|
let current;
|
|
@@ -2410,7 +2720,9 @@ function create_if_block_1$1(ctx) {
|
|
|
2410
2720
|
{
|
|
2411
2721
|
floorplanData: /*floorplanData*/ ctx[5],
|
|
2412
2722
|
floorIndex: /*floorIndex*/ ctx[1],
|
|
2413
|
-
getLabelElement: /*getLabelElement*/ ctx[6]
|
|
2723
|
+
getLabelElement: /*getLabelElement*/ ctx[6],
|
|
2724
|
+
hoveredRoom: /*hoveredRoom*/ ctx[8],
|
|
2725
|
+
adaptiveRoomLabelVisibleEnable: /*adaptiveRoomLabelVisibleEnable*/ ctx[7]
|
|
2414
2726
|
}
|
|
2415
2727
|
];
|
|
2416
2728
|
|
|
@@ -2431,12 +2743,14 @@ function create_if_block_1$1(ctx) {
|
|
|
2431
2743
|
current = true;
|
|
2432
2744
|
},
|
|
2433
2745
|
p(ctx, dirty) {
|
|
2434
|
-
const roomlabels_changes = (dirty & /*floorplanData, floorIndex, getLabelElement*/
|
|
2746
|
+
const roomlabels_changes = (dirty & /*floorplanData, floorIndex, getLabelElement, hoveredRoom, adaptiveRoomLabelVisibleEnable*/ 482)
|
|
2435
2747
|
? internal.get_spread_update(roomlabels_spread_levels, [
|
|
2436
2748
|
{
|
|
2437
2749
|
floorplanData: /*floorplanData*/ ctx[5],
|
|
2438
2750
|
floorIndex: /*floorIndex*/ ctx[1],
|
|
2439
|
-
getLabelElement: /*getLabelElement*/ ctx[6]
|
|
2751
|
+
getLabelElement: /*getLabelElement*/ ctx[6],
|
|
2752
|
+
hoveredRoom: /*hoveredRoom*/ ctx[8],
|
|
2753
|
+
adaptiveRoomLabelVisibleEnable: /*adaptiveRoomLabelVisibleEnable*/ ctx[7]
|
|
2440
2754
|
}
|
|
2441
2755
|
])
|
|
2442
2756
|
: {};
|
|
@@ -2458,7 +2772,7 @@ function create_if_block_1$1(ctx) {
|
|
|
2458
2772
|
};
|
|
2459
2773
|
}
|
|
2460
2774
|
|
|
2461
|
-
// (
|
|
2775
|
+
// (27:2) {#if ruleLabelsEnable}
|
|
2462
2776
|
function create_if_block$1(ctx) {
|
|
2463
2777
|
let rulelabels;
|
|
2464
2778
|
let current;
|
|
@@ -2721,6 +3035,8 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
2721
3035
|
let { ruleLabelsEnable } = $$props;
|
|
2722
3036
|
let { floorplanData } = $$props;
|
|
2723
3037
|
let { getLabelElement } = $$props;
|
|
3038
|
+
let { adaptiveRoomLabelVisibleEnable } = $$props;
|
|
3039
|
+
const hoveredRoom = store.writable(undefined);
|
|
2724
3040
|
|
|
2725
3041
|
$$self.$$set = $$props => {
|
|
2726
3042
|
if ('isCurrent' in $$props) $$invalidate(0, isCurrent = $$props.isCurrent);
|
|
@@ -2730,6 +3046,7 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
2730
3046
|
if ('ruleLabelsEnable' in $$props) $$invalidate(4, ruleLabelsEnable = $$props.ruleLabelsEnable);
|
|
2731
3047
|
if ('floorplanData' in $$props) $$invalidate(5, floorplanData = $$props.floorplanData);
|
|
2732
3048
|
if ('getLabelElement' in $$props) $$invalidate(6, getLabelElement = $$props.getLabelElement);
|
|
3049
|
+
if ('adaptiveRoomLabelVisibleEnable' in $$props) $$invalidate(7, adaptiveRoomLabelVisibleEnable = $$props.adaptiveRoomLabelVisibleEnable);
|
|
2733
3050
|
};
|
|
2734
3051
|
|
|
2735
3052
|
return [
|
|
@@ -2739,7 +3056,9 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
2739
3056
|
roomLabelsEnable,
|
|
2740
3057
|
ruleLabelsEnable,
|
|
2741
3058
|
floorplanData,
|
|
2742
|
-
getLabelElement
|
|
3059
|
+
getLabelElement,
|
|
3060
|
+
adaptiveRoomLabelVisibleEnable,
|
|
3061
|
+
hoveredRoom
|
|
2743
3062
|
];
|
|
2744
3063
|
}
|
|
2745
3064
|
|
|
@@ -2760,7 +3079,8 @@ class CurrentFloor extends internal.SvelteComponent {
|
|
|
2760
3079
|
roomLabelsEnable: 3,
|
|
2761
3080
|
ruleLabelsEnable: 4,
|
|
2762
3081
|
floorplanData: 5,
|
|
2763
|
-
getLabelElement: 6
|
|
3082
|
+
getLabelElement: 6,
|
|
3083
|
+
adaptiveRoomLabelVisibleEnable: 7
|
|
2764
3084
|
},
|
|
2765
3085
|
add_css$1
|
|
2766
3086
|
);
|
|
@@ -2775,11 +3095,11 @@ function add_css(target) {
|
|
|
2775
3095
|
|
|
2776
3096
|
function get_each_context(ctx, list, i) {
|
|
2777
3097
|
const child_ctx = ctx.slice();
|
|
2778
|
-
child_ctx[
|
|
3098
|
+
child_ctx[14] = list[i];
|
|
2779
3099
|
return child_ctx;
|
|
2780
3100
|
}
|
|
2781
3101
|
|
|
2782
|
-
// (
|
|
3102
|
+
// (22:0) {#if visible}
|
|
2783
3103
|
function create_if_block(ctx) {
|
|
2784
3104
|
let div;
|
|
2785
3105
|
let t0;
|
|
@@ -2846,7 +3166,7 @@ function create_if_block(ctx) {
|
|
|
2846
3166
|
p(new_ctx, dirty) {
|
|
2847
3167
|
ctx = new_ctx;
|
|
2848
3168
|
|
|
2849
|
-
if (dirty & /*hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, floorIndex*/
|
|
3169
|
+
if (dirty & /*hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, adaptiveRoomLabelVisibleEnable, floorIndex*/ 13232) {
|
|
2850
3170
|
each_value = /*floorplanData*/ ctx[9].floorDatas;
|
|
2851
3171
|
let i;
|
|
2852
3172
|
|
|
@@ -2952,7 +3272,7 @@ function create_if_block(ctx) {
|
|
|
2952
3272
|
};
|
|
2953
3273
|
}
|
|
2954
3274
|
|
|
2955
|
-
// (
|
|
3275
|
+
// (24:4) {#each floorplanData.floorDatas as floorData}
|
|
2956
3276
|
function create_each_block(ctx) {
|
|
2957
3277
|
let currentfloor;
|
|
2958
3278
|
let current;
|
|
@@ -2963,13 +3283,14 @@ function create_each_block(ctx) {
|
|
|
2963
3283
|
floorplanData: /*floorplanData*/ ctx[9],
|
|
2964
3284
|
getLabelElement: /*getLabelElement*/ ctx[12],
|
|
2965
3285
|
roomLabelsEnable: /*roomLabelsEnable*/ ctx[7],
|
|
2966
|
-
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[8]
|
|
3286
|
+
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[8],
|
|
3287
|
+
adaptiveRoomLabelVisibleEnable: /*adaptiveRoomLabelVisibleEnable*/ ctx[13]
|
|
2967
3288
|
},
|
|
2968
3289
|
{
|
|
2969
|
-
floorIndex: /*floorData*/ ctx[
|
|
3290
|
+
floorIndex: /*floorData*/ ctx[14].floorIndex
|
|
2970
3291
|
},
|
|
2971
3292
|
{
|
|
2972
|
-
isCurrent: /*floorData*/ ctx[
|
|
3293
|
+
isCurrent: /*floorData*/ ctx[14].floorIndex === /*floorIndex*/ ctx[4]
|
|
2973
3294
|
}
|
|
2974
3295
|
];
|
|
2975
3296
|
|
|
@@ -2990,20 +3311,21 @@ function create_each_block(ctx) {
|
|
|
2990
3311
|
current = true;
|
|
2991
3312
|
},
|
|
2992
3313
|
p(ctx, dirty) {
|
|
2993
|
-
const currentfloor_changes = (dirty & /*hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, floorIndex*/
|
|
3314
|
+
const currentfloor_changes = (dirty & /*hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, adaptiveRoomLabelVisibleEnable, floorIndex*/ 13232)
|
|
2994
3315
|
? internal.get_spread_update(currentfloor_spread_levels, [
|
|
2995
|
-
dirty & /*hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable*/
|
|
3316
|
+
dirty & /*hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, adaptiveRoomLabelVisibleEnable*/ 13216 && {
|
|
2996
3317
|
hoverEnable: /*hoverEnable*/ ctx[5],
|
|
2997
3318
|
floorplanData: /*floorplanData*/ ctx[9],
|
|
2998
3319
|
getLabelElement: /*getLabelElement*/ ctx[12],
|
|
2999
3320
|
roomLabelsEnable: /*roomLabelsEnable*/ ctx[7],
|
|
3000
|
-
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[8]
|
|
3321
|
+
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[8],
|
|
3322
|
+
adaptiveRoomLabelVisibleEnable: /*adaptiveRoomLabelVisibleEnable*/ ctx[13]
|
|
3001
3323
|
},
|
|
3002
3324
|
dirty & /*floorplanData*/ 512 && {
|
|
3003
|
-
floorIndex: /*floorData*/ ctx[
|
|
3325
|
+
floorIndex: /*floorData*/ ctx[14].floorIndex
|
|
3004
3326
|
},
|
|
3005
3327
|
dirty & /*floorplanData, floorIndex*/ 528 && {
|
|
3006
|
-
isCurrent: /*floorData*/ ctx[
|
|
3328
|
+
isCurrent: /*floorData*/ ctx[14].floorIndex === /*floorIndex*/ ctx[4]
|
|
3007
3329
|
}
|
|
3008
3330
|
])
|
|
3009
3331
|
: {};
|
|
@@ -3025,7 +3347,7 @@ function create_each_block(ctx) {
|
|
|
3025
3347
|
};
|
|
3026
3348
|
}
|
|
3027
3349
|
|
|
3028
|
-
// (
|
|
3350
|
+
// (39:4) {#if compassEnable}
|
|
3029
3351
|
function create_if_block_1(ctx) {
|
|
3030
3352
|
let compass;
|
|
3031
3353
|
let current;
|
|
@@ -3135,6 +3457,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
3135
3457
|
let { lastPanoramaLongitude } = $$props;
|
|
3136
3458
|
let { cameraImageUrl } = $$props;
|
|
3137
3459
|
let { getLabelElement } = $$props;
|
|
3460
|
+
let { adaptiveRoomLabelVisibleEnable } = $$props;
|
|
3138
3461
|
|
|
3139
3462
|
$$self.$$set = $$props => {
|
|
3140
3463
|
if ('duration' in $$props) $$invalidate(0, duration = $$props.duration);
|
|
@@ -3150,6 +3473,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
3150
3473
|
if ('lastPanoramaLongitude' in $$props) $$invalidate(10, lastPanoramaLongitude = $$props.lastPanoramaLongitude);
|
|
3151
3474
|
if ('cameraImageUrl' in $$props) $$invalidate(11, cameraImageUrl = $$props.cameraImageUrl);
|
|
3152
3475
|
if ('getLabelElement' in $$props) $$invalidate(12, getLabelElement = $$props.getLabelElement);
|
|
3476
|
+
if ('adaptiveRoomLabelVisibleEnable' in $$props) $$invalidate(13, adaptiveRoomLabelVisibleEnable = $$props.adaptiveRoomLabelVisibleEnable);
|
|
3153
3477
|
};
|
|
3154
3478
|
|
|
3155
3479
|
return [
|
|
@@ -3165,7 +3489,8 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
3165
3489
|
floorplanData,
|
|
3166
3490
|
lastPanoramaLongitude,
|
|
3167
3491
|
cameraImageUrl,
|
|
3168
|
-
getLabelElement
|
|
3492
|
+
getLabelElement,
|
|
3493
|
+
adaptiveRoomLabelVisibleEnable
|
|
3169
3494
|
];
|
|
3170
3495
|
}
|
|
3171
3496
|
|
|
@@ -3192,7 +3517,8 @@ class Main extends internal.SvelteComponent {
|
|
|
3192
3517
|
floorplanData: 9,
|
|
3193
3518
|
lastPanoramaLongitude: 10,
|
|
3194
3519
|
cameraImageUrl: 11,
|
|
3195
|
-
getLabelElement: 12
|
|
3520
|
+
getLabelElement: 12,
|
|
3521
|
+
adaptiveRoomLabelVisibleEnable: 13
|
|
3196
3522
|
},
|
|
3197
3523
|
add_css
|
|
3198
3524
|
);
|
|
@@ -3276,108 +3602,32 @@ async function formatData(data) {
|
|
|
3276
3602
|
}
|
|
3277
3603
|
|
|
3278
3604
|
/**
|
|
3279
|
-
*
|
|
3280
|
-
*
|
|
3281
|
-
*
|
|
3282
|
-
*
|
|
3283
|
-
*
|
|
3284
|
-
*
|
|
3285
|
-
* isObjectLike([1, 2, 3])
|
|
3286
|
-
* // => false
|
|
3287
|
-
*
|
|
3288
|
-
* isObjectLike(Function)
|
|
3289
|
-
* // => false
|
|
3290
|
-
*
|
|
3291
|
-
* isObjectLike(null)
|
|
3292
|
-
* // => false
|
|
3293
|
-
*
|
|
3605
|
+
* 把第一个参数传入第二个参数(函数)中并执行
|
|
3606
|
+
* 一般用于执行函数后返回变量。
|
|
3607
|
+
* @param {any} something
|
|
3608
|
+
* @param {function} callback
|
|
3609
|
+
* @return {any}
|
|
3294
3610
|
*/
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
3300
|
-
function baseIsEqual(value, other) {
|
|
3301
|
-
if (value === other)
|
|
3302
|
-
return true;
|
|
3303
|
-
if (typeof value !== typeof other)
|
|
3304
|
-
return false;
|
|
3305
|
-
if (Number.isNaN(value) && Number.isNaN(other))
|
|
3306
|
-
return true;
|
|
3307
|
-
return false;
|
|
3308
|
-
}
|
|
3309
|
-
function objEqualShallow(value, other) {
|
|
3310
|
-
const valueProps = Object.getOwnPropertyNames(value);
|
|
3311
|
-
const otherProps = Object.getOwnPropertyNames(other);
|
|
3312
|
-
if (valueProps.length !== otherProps.length)
|
|
3313
|
-
return false;
|
|
3314
|
-
for (let i = 0, len = valueProps.length; i < len; i++) {
|
|
3315
|
-
const propName = valueProps[i];
|
|
3316
|
-
if (!baseIsEqual(value[propName], other[propName]))
|
|
3317
|
-
return false;
|
|
3318
|
-
}
|
|
3319
|
-
return true;
|
|
3320
|
-
}
|
|
3321
|
-
function arrayEqualShallow(value, other) {
|
|
3322
|
-
if (value.length !== other.length)
|
|
3323
|
-
return false;
|
|
3324
|
-
for (let i = 0, len = value.length; i < len; i++) {
|
|
3325
|
-
if (!baseIsEqual(value[i], other[i]))
|
|
3326
|
-
return false;
|
|
3327
|
-
}
|
|
3328
|
-
return true;
|
|
3329
|
-
}
|
|
3330
|
-
function isShallowEqual(value, other) {
|
|
3331
|
-
if (baseIsEqual(value, other))
|
|
3332
|
-
return true;
|
|
3333
|
-
if (isTruelyObject(value) && isTruelyObject(other))
|
|
3334
|
-
return objEqualShallow(value, other);
|
|
3335
|
-
if (Array.isArray(value) && Array.isArray(other))
|
|
3336
|
-
return arrayEqualShallow(value, other);
|
|
3337
|
-
return false;
|
|
3338
|
-
}
|
|
3339
|
-
function isDeepEqual(value, other) {
|
|
3340
|
-
if (baseIsEqual(value, other))
|
|
3341
|
-
return true;
|
|
3342
|
-
if (isTruelyObject(value) && isTruelyObject(other))
|
|
3343
|
-
return objEqualDeep(value, other);
|
|
3344
|
-
if (Array.isArray(value) && Array.isArray(other))
|
|
3345
|
-
return arrayEqualDeep(value, other);
|
|
3346
|
-
return false;
|
|
3347
|
-
}
|
|
3348
|
-
function arrayEqualDeep(value, other) {
|
|
3349
|
-
if (value.length !== other.length)
|
|
3350
|
-
return false;
|
|
3351
|
-
for (let i = 0, len = value.length; i < len; i++) {
|
|
3352
|
-
if (!isDeepEqual(value[i], other[i]))
|
|
3353
|
-
return false;
|
|
3354
|
-
}
|
|
3355
|
-
return true;
|
|
3356
|
-
}
|
|
3357
|
-
function objEqualDeep(value, other) {
|
|
3358
|
-
const valueProps = Object.getOwnPropertyNames(value);
|
|
3359
|
-
const otherProps = Object.getOwnPropertyNames(other);
|
|
3360
|
-
if (valueProps.length !== otherProps.length)
|
|
3361
|
-
return false;
|
|
3362
|
-
for (let i = 0, len = valueProps.length; i < len; i++) {
|
|
3363
|
-
const propName = valueProps[i];
|
|
3364
|
-
if (!isDeepEqual(value[propName], other[propName]))
|
|
3365
|
-
return false;
|
|
3366
|
-
}
|
|
3367
|
-
return true;
|
|
3611
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3612
|
+
function tap(something, callback) {
|
|
3613
|
+
callback(something);
|
|
3614
|
+
return something;
|
|
3368
3615
|
}
|
|
3616
|
+
|
|
3369
3617
|
/**
|
|
3370
|
-
*
|
|
3371
|
-
* @param
|
|
3372
|
-
* @param
|
|
3373
|
-
* @
|
|
3374
|
-
* deep {Boolean} 是否深比较<br />
|
|
3375
|
-
* @returns {boolean} 是否相等
|
|
3618
|
+
* 过滤掉不需要的对象字段函数:实现从一个对象中排除某些指定属性后生成的新对象。
|
|
3619
|
+
* @param object
|
|
3620
|
+
* @param props 排除的属性
|
|
3621
|
+
* @return
|
|
3376
3622
|
*/
|
|
3377
|
-
function
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3623
|
+
function omit(object, props) {
|
|
3624
|
+
return tap({}, (result) => {
|
|
3625
|
+
for (const name in object) {
|
|
3626
|
+
if (props.indexOf(name) !== -1)
|
|
3627
|
+
continue;
|
|
3628
|
+
result[name] = object[name];
|
|
3629
|
+
}
|
|
3630
|
+
});
|
|
3381
3631
|
}
|
|
3382
3632
|
|
|
3383
3633
|
var FLOOR_PLAN_ATTACHED_TO;
|
|
@@ -3387,31 +3637,36 @@ var FLOOR_PLAN_ATTACHED_TO;
|
|
|
3387
3637
|
FLOOR_PLAN_ATTACHED_TO[FLOOR_PLAN_ATTACHED_TO["BOUNDING_CENTER"] = 3] = "BOUNDING_CENTER";
|
|
3388
3638
|
})(FLOOR_PLAN_ATTACHED_TO || (FLOOR_PLAN_ATTACHED_TO = {}));
|
|
3389
3639
|
|
|
3640
|
+
/** 获取当前楼层地面的 Y 值 */
|
|
3641
|
+
function getFloorY(five, floorIndex) {
|
|
3642
|
+
const maxFloorIndex = Math.max(...five.work.observers.map((ob) => ob.floorIndex));
|
|
3643
|
+
return floorIndex > maxFloorIndex
|
|
3644
|
+
? five.model.bounding.max.y
|
|
3645
|
+
: Math.max(...five.work.observers
|
|
3646
|
+
.filter((ob) => ob.floorIndex === floorIndex)
|
|
3647
|
+
.map((ob) => ob.standingPosition.y));
|
|
3648
|
+
}
|
|
3649
|
+
/** 获取当前吸附类型的 Y 值
|
|
3650
|
+
* * FLOOR_PLAN_ATTACHED_TO.FLOOR:当前楼层地板的 Y
|
|
3651
|
+
* * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前模型中心的 Y
|
|
3652
|
+
* * FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER:当前楼层天花板的 Y
|
|
3653
|
+
*/
|
|
3654
|
+
function getAttachedY(five, floorIndex, attachedTo = FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER) {
|
|
3655
|
+
const currentFloorY = getFloorY(five, floorIndex);
|
|
3656
|
+
const nextFloorY = getFloorY(five, floorIndex + 1);
|
|
3657
|
+
if (attachedTo === FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
|
|
3658
|
+
return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
|
|
3659
|
+
else if (attachedTo === FLOOR_PLAN_ATTACHED_TO.CEILING)
|
|
3660
|
+
return nextFloorY;
|
|
3661
|
+
else
|
|
3662
|
+
return currentFloorY;
|
|
3663
|
+
}
|
|
3390
3664
|
/**
|
|
3391
3665
|
* 获取「在俯视图」状态下,模型 mm 与屏幕像素 px 的对应关系,即每 mm 对应多少 px
|
|
3392
3666
|
* @param five five
|
|
3393
3667
|
*/
|
|
3394
3668
|
function getPxmm(five, container, floorIndex, options) {
|
|
3395
|
-
const
|
|
3396
|
-
function getFloorY(floorIndex) {
|
|
3397
|
-
return floorIndex > maxFloorIndex
|
|
3398
|
-
? five.model.bounding.max.y
|
|
3399
|
-
: Math.max(...five.work.observers
|
|
3400
|
-
.filter((ob) => ob.floorIndex === floorIndex)
|
|
3401
|
-
.map((ob) => ob.standingPosition.y));
|
|
3402
|
-
}
|
|
3403
|
-
function getY() {
|
|
3404
|
-
const currentFloorY = getFloorY(floorIndex);
|
|
3405
|
-
const nextFloorY = getFloorY(floorIndex + 1);
|
|
3406
|
-
const attachedTo = (options === null || options === void 0 ? void 0 : options.attachedTo) || FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER;
|
|
3407
|
-
if (attachedTo === FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
|
|
3408
|
-
return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
|
|
3409
|
-
else if (attachedTo === FLOOR_PLAN_ATTACHED_TO.CEILING)
|
|
3410
|
-
return nextFloorY;
|
|
3411
|
-
else
|
|
3412
|
-
return currentFloorY;
|
|
3413
|
-
}
|
|
3414
|
-
const y = getY();
|
|
3669
|
+
const y = getAttachedY(five, floorIndex, options === null || options === void 0 ? void 0 : options.attachedTo);
|
|
3415
3670
|
const originPosition = new THREE__namespace.Vector3(0, y, 0);
|
|
3416
3671
|
const originPositionXUnit = new THREE__namespace.Vector3(1, y, 0);
|
|
3417
3672
|
const mouse = originPosition.clone().project(five.camera);
|
|
@@ -3420,21 +3675,61 @@ function getPxmm(five, container, floorIndex, options) {
|
|
|
3420
3675
|
return pxmm;
|
|
3421
3676
|
}
|
|
3422
3677
|
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
};
|
|
3434
|
-
|
|
3435
|
-
|
|
3678
|
+
/**
|
|
3679
|
+
* plugin 的基本控制器
|
|
3680
|
+
*/
|
|
3681
|
+
class Controller$2 {
|
|
3682
|
+
constructor(five$1) {
|
|
3683
|
+
Object.defineProperty(this, "five", {
|
|
3684
|
+
enumerable: true,
|
|
3685
|
+
configurable: true,
|
|
3686
|
+
writable: true,
|
|
3687
|
+
value: void 0
|
|
3688
|
+
});
|
|
3689
|
+
/**
|
|
3690
|
+
* 插件事件钩子
|
|
3691
|
+
*/
|
|
3692
|
+
Object.defineProperty(this, "hooks", {
|
|
3693
|
+
enumerable: true,
|
|
3694
|
+
configurable: true,
|
|
3695
|
+
writable: true,
|
|
3696
|
+
value: new five.Subscribe()
|
|
3697
|
+
});
|
|
3698
|
+
this.five = five$1;
|
|
3699
|
+
}
|
|
3700
|
+
/**
|
|
3701
|
+
* 获取当前的插件状态,如果当初插件内存在需要通过动画变更的 state 值,则通过此方法可以得到中间状态
|
|
3702
|
+
*/
|
|
3703
|
+
getCurrentState() {
|
|
3704
|
+
return this.state;
|
|
3705
|
+
}
|
|
3436
3706
|
}
|
|
3437
3707
|
|
|
3708
|
+
class Controller$1 extends Controller$2 {
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3711
|
+
var FloorplanErrorType;
|
|
3712
|
+
(function (FloorplanErrorType) {
|
|
3713
|
+
/** 意料之外的错误 */
|
|
3714
|
+
FloorplanErrorType["UnknownError"] = "UnknownError";
|
|
3715
|
+
/** 数据未加载 */
|
|
3716
|
+
FloorplanErrorType["DataNotLoaded"] = "DataNotLoaded";
|
|
3717
|
+
/** 展示过程被隐藏打断 */
|
|
3718
|
+
FloorplanErrorType["BreakOffByHide"] = "BreakOffByHide";
|
|
3719
|
+
/** 展示过程中插件被禁用 */
|
|
3720
|
+
FloorplanErrorType["BreakOffByDisable"] = "BreakOffByDisable";
|
|
3721
|
+
/** 模型未加载完成 */
|
|
3722
|
+
FloorplanErrorType["ModelNotLoaded"] = "ModelNotLoaded";
|
|
3723
|
+
/** Five changeMode 行为不符合预期 */
|
|
3724
|
+
FloorplanErrorType["ChangeModeError"] = "ChangeModeError";
|
|
3725
|
+
/** Five updateCamera 行为不符合预期 */
|
|
3726
|
+
FloorplanErrorType["UpdateCameraError"] = "UpdateCameraError";
|
|
3727
|
+
})(FloorplanErrorType || (FloorplanErrorType = {}));
|
|
3728
|
+
/** 户型图展示 & 模型消失的默认时间 */
|
|
3729
|
+
const SHOW_ANIME_DURATION = 500;
|
|
3730
|
+
/** Five camera 默认 fov */
|
|
3731
|
+
const FIVE_CAMERA_DEFAULT_FOV = 80;
|
|
3732
|
+
|
|
3438
3733
|
/**
|
|
3439
3734
|
* 比较两个数字近似相等
|
|
3440
3735
|
* @param num1 数字1
|
|
@@ -3445,43 +3740,80 @@ function nearlyEqual(num1, num2, accuracy = 4) {
|
|
|
3445
3740
|
return Math.floor(num1 * Math.pow(10, accuracy)) === Math.floor(num2 * Math.pow(10, accuracy));
|
|
3446
3741
|
}
|
|
3447
3742
|
|
|
3743
|
+
/** 等待 five changeMode 结束
|
|
3744
|
+
* @description Promise 的状态只代表 mode 与预期是否一致,不保证参数的一致性
|
|
3745
|
+
*/
|
|
3746
|
+
async function changeMode(five, changeModeParams) {
|
|
3747
|
+
await new Promise((resolve, reject) => {
|
|
3748
|
+
// 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
|
|
3749
|
+
five.changeMode(...changeModeParams).catch((error) => reject(error));
|
|
3750
|
+
five.once('initAnimationEnded', () => {
|
|
3751
|
+
const fiveCurrentState = five.getCurrentState();
|
|
3752
|
+
const correctMode = changeModeParams[0];
|
|
3753
|
+
if (fiveCurrentState.mode !== correctMode)
|
|
3754
|
+
reject(new Error('mode 与预期不符'));
|
|
3755
|
+
/** 检测当前的 current pose 和传入的 pose 是否一致 */
|
|
3756
|
+
const checkPose = () => {
|
|
3757
|
+
const correctPose = changeModeParams[1];
|
|
3758
|
+
if (!correctPose)
|
|
3759
|
+
return true;
|
|
3760
|
+
return Object.keys(correctPose).every((key) => {
|
|
3761
|
+
const fivePoseItem = fiveCurrentState[key];
|
|
3762
|
+
if (fivePoseItem === undefined)
|
|
3763
|
+
return true;
|
|
3764
|
+
const correctPoseItem = correctPose[key];
|
|
3765
|
+
if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
|
|
3766
|
+
return nearlyEqual(fivePoseItem, correctPoseItem, 2);
|
|
3767
|
+
}
|
|
3768
|
+
return fivePoseItem === correctPoseItem;
|
|
3769
|
+
});
|
|
3770
|
+
};
|
|
3771
|
+
const checkPoseResult = checkPose();
|
|
3772
|
+
if (!checkPoseResult)
|
|
3773
|
+
reject(new Error('five pose 与预期不符'));
|
|
3774
|
+
resolve();
|
|
3775
|
+
});
|
|
3776
|
+
});
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3448
3779
|
/** 判断当前状态是否可以展示户型图 */
|
|
3449
|
-
function checkShowState(five
|
|
3450
|
-
if (five
|
|
3780
|
+
function checkShowState(five, showState) {
|
|
3781
|
+
if (five.currentMode !== showState.mode)
|
|
3451
3782
|
return false;
|
|
3452
3783
|
const { latitude, longitude, fov } = showState;
|
|
3453
|
-
const { latitude: _latitude, longitude: _longitude } = five
|
|
3454
|
-
const _fov = five
|
|
3455
|
-
if (nearlyEqual(latitude, _latitude,
|
|
3456
|
-
return
|
|
3457
|
-
|
|
3784
|
+
const { latitude: _latitude, longitude: _longitude } = five.getCurrentState();
|
|
3785
|
+
const _fov = five.camera.fov;
|
|
3786
|
+
if (!nearlyEqual(latitude, _latitude, 2))
|
|
3787
|
+
return false;
|
|
3788
|
+
if (!nearlyEqual(longitude, _longitude, 2))
|
|
3789
|
+
return false;
|
|
3790
|
+
if (fov !== _fov)
|
|
3791
|
+
return false;
|
|
3792
|
+
return true;
|
|
3458
3793
|
}
|
|
3459
3794
|
/** 更改 Five 状态到展示户型图的状态
|
|
3460
3795
|
* 1. 判断状态不符合时,会纠正到正确的状态
|
|
3461
3796
|
* 2. 内置了相应的动画时间计算
|
|
3462
3797
|
* 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
|
|
3463
3798
|
*/
|
|
3464
|
-
async function correctFiveState(five
|
|
3799
|
+
async function correctFiveState(five, showState, userAction = true) {
|
|
3465
3800
|
// 当前已满足状态,不需要变更
|
|
3466
|
-
const result = checkShowState(five
|
|
3801
|
+
const result = checkShowState(five, showState);
|
|
3467
3802
|
if (result === true)
|
|
3468
3803
|
return;
|
|
3804
|
+
const currentFiveState = five.getCurrentState();
|
|
3469
3805
|
// 纠正 mode
|
|
3470
|
-
if (
|
|
3471
|
-
const [changeModeError] = await to(changeMode(five
|
|
3806
|
+
if (currentFiveState.mode !== showState.mode) {
|
|
3807
|
+
const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
|
|
3472
3808
|
if (changeModeError)
|
|
3473
|
-
throw changeModeError;
|
|
3474
|
-
// changeMode 是异步行为,可能会被打断,需要在结束后加一次判断
|
|
3475
|
-
const result = checkShowState(five$1, showState);
|
|
3476
|
-
if (result === false)
|
|
3477
3809
|
throw new Error(FloorplanErrorType.ChangeModeError);
|
|
3478
3810
|
return;
|
|
3479
3811
|
}
|
|
3480
3812
|
// 纠正相机状态
|
|
3481
3813
|
// 根据 latitude、longitude、fov 计算动画时间,最多 1s
|
|
3482
|
-
const { latitude, longitude, fov } =
|
|
3814
|
+
const { latitude, longitude, fov } = currentFiveState;
|
|
3483
3815
|
const time = Math.min(1000, Math.max(200, Math.abs(latitude - Math.PI / 2) * 1000, (longitude > Math.PI ? 2 * Math.PI - longitude : longitude) * 500, Math.abs(fov - showState.fov) * 10));
|
|
3484
|
-
const [updateCameraError] = await to(five
|
|
3816
|
+
const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
|
|
3485
3817
|
if (updateCameraError)
|
|
3486
3818
|
throw new Error(FloorplanErrorType.UpdateCameraError);
|
|
3487
3819
|
return;
|
|
@@ -3503,54 +3835,71 @@ function changeModelCanvasOpacity(five, opacity, duration = 300) {
|
|
|
3503
3835
|
});
|
|
3504
3836
|
}
|
|
3505
3837
|
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3838
|
+
/** 当前 five 的相机视角是否满足户型图自动隐藏条件
|
|
3839
|
+
*
|
|
3840
|
+
* @description 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
|
|
3841
|
+
*
|
|
3842
|
+
*/
|
|
3843
|
+
function shouldFloorplanHideWithPose(pose) {
|
|
3844
|
+
const { latitude, longitude } = pose;
|
|
3845
|
+
const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
|
|
3846
|
+
const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
|
|
3847
|
+
return latitudeHide || longitudeHide;
|
|
3848
|
+
}
|
|
3849
|
+
/** 当前 five 的相机视角是否满足户型图自动展示隐藏条件
|
|
3850
|
+
*
|
|
3851
|
+
* @description 水平旋转角正负 30 度 && 俯仰角度小于 10 度
|
|
3852
|
+
*
|
|
3853
|
+
*/
|
|
3854
|
+
function shouldFloorplanShowWithPose(pose) {
|
|
3855
|
+
const { latitude, longitude } = pose;
|
|
3856
|
+
const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
|
|
3857
|
+
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
3858
|
+
return latitudeVisible && longitudeVisible;
|
|
3859
|
+
}
|
|
3860
|
+
class Controller extends Controller$1 {
|
|
3861
|
+
constructor(five, params) {
|
|
3509
3862
|
var _a;
|
|
3863
|
+
super(five);
|
|
3864
|
+
// =============== public properties =================
|
|
3510
3865
|
Object.defineProperty(this, "name", {
|
|
3511
3866
|
enumerable: true,
|
|
3512
3867
|
configurable: true,
|
|
3513
3868
|
writable: true,
|
|
3514
|
-
value:
|
|
3869
|
+
value: 'modelFloorplanPlugin'
|
|
3515
3870
|
});
|
|
3516
|
-
|
|
3517
|
-
Object.defineProperty(this, "hooks", {
|
|
3871
|
+
Object.defineProperty(this, "state", {
|
|
3518
3872
|
enumerable: true,
|
|
3519
3873
|
configurable: true,
|
|
3520
3874
|
writable: true,
|
|
3521
3875
|
value: void 0
|
|
3522
3876
|
});
|
|
3523
|
-
|
|
3524
|
-
Object.defineProperty(this, "
|
|
3877
|
+
// =============== private properties =================
|
|
3878
|
+
Object.defineProperty(this, "data", {
|
|
3525
3879
|
enumerable: true,
|
|
3526
3880
|
configurable: true,
|
|
3527
3881
|
writable: true,
|
|
3528
|
-
value:
|
|
3529
|
-
});
|
|
3530
|
-
/** 户型图大小 */
|
|
3531
|
-
Object.defineProperty(this, "size", {
|
|
3532
|
-
enumerable: true,
|
|
3533
|
-
configurable: true,
|
|
3534
|
-
writable: true,
|
|
3535
|
-
value: { width: 0, height: 0 }
|
|
3882
|
+
value: void 0
|
|
3536
3883
|
});
|
|
3537
|
-
|
|
3884
|
+
/** 展示户型图时,需要正确的状态 */
|
|
3885
|
+
Object.defineProperty(this, "showState", {
|
|
3538
3886
|
enumerable: true,
|
|
3539
3887
|
configurable: true,
|
|
3540
3888
|
writable: true,
|
|
3541
|
-
value:
|
|
3889
|
+
value: void 0
|
|
3542
3890
|
});
|
|
3543
|
-
|
|
3891
|
+
/** show 动画的公共 Promise */
|
|
3892
|
+
Object.defineProperty(this, "showPromise", {
|
|
3544
3893
|
enumerable: true,
|
|
3545
3894
|
configurable: true,
|
|
3546
3895
|
writable: true,
|
|
3547
|
-
value: 0
|
|
3896
|
+
value: void 0
|
|
3548
3897
|
});
|
|
3549
|
-
Object.defineProperty(this, "
|
|
3898
|
+
Object.defineProperty(this, "app", {
|
|
3550
3899
|
enumerable: true,
|
|
3551
3900
|
configurable: true,
|
|
3552
3901
|
writable: true,
|
|
3553
|
-
value:
|
|
3902
|
+
value: undefined
|
|
3554
3903
|
});
|
|
3555
3904
|
Object.defineProperty(this, "panoIndex", {
|
|
3556
3905
|
enumerable: true,
|
|
@@ -3564,85 +3913,118 @@ class ModelFloorplanPluginController {
|
|
|
3564
3913
|
writable: true,
|
|
3565
3914
|
value: 0
|
|
3566
3915
|
});
|
|
3567
|
-
Object.defineProperty(this, "configs", {
|
|
3568
|
-
enumerable: true,
|
|
3569
|
-
configurable: true,
|
|
3570
|
-
writable: true,
|
|
3571
|
-
value: {}
|
|
3572
|
-
});
|
|
3573
|
-
Object.defineProperty(this, "lastPanoramaLongitude", {
|
|
3574
|
-
enumerable: true,
|
|
3575
|
-
configurable: true,
|
|
3576
|
-
writable: true,
|
|
3577
|
-
value: 0
|
|
3578
|
-
});
|
|
3579
3916
|
Object.defineProperty(this, "selector", {
|
|
3580
3917
|
enumerable: true,
|
|
3581
3918
|
configurable: true,
|
|
3582
3919
|
writable: true,
|
|
3583
3920
|
value: void 0
|
|
3584
3921
|
});
|
|
3585
|
-
|
|
3922
|
+
/** 公共 Promise 的 reject 方法 */
|
|
3923
|
+
Object.defineProperty(this, "showRejection", {
|
|
3586
3924
|
enumerable: true,
|
|
3587
3925
|
configurable: true,
|
|
3588
3926
|
writable: true,
|
|
3589
3927
|
value: void 0
|
|
3590
3928
|
});
|
|
3929
|
+
/** 户型图父容器 */
|
|
3591
3930
|
Object.defineProperty(this, "wrapper", {
|
|
3592
3931
|
enumerable: true,
|
|
3593
3932
|
configurable: true,
|
|
3594
3933
|
writable: true,
|
|
3595
3934
|
value: void 0
|
|
3596
3935
|
});
|
|
3936
|
+
/** 户型图主容器 */
|
|
3597
3937
|
Object.defineProperty(this, "container", {
|
|
3598
3938
|
enumerable: true,
|
|
3599
3939
|
configurable: true,
|
|
3600
3940
|
writable: true,
|
|
3601
3941
|
value: document.createElement('div')
|
|
3602
3942
|
});
|
|
3603
|
-
|
|
3943
|
+
/** 展示户型图图前,Five 的 Panorama Longitude */
|
|
3944
|
+
Object.defineProperty(this, "lastPanoramaLongitude", {
|
|
3604
3945
|
enumerable: true,
|
|
3605
3946
|
configurable: true,
|
|
3606
3947
|
writable: true,
|
|
3607
|
-
value:
|
|
3948
|
+
value: 0
|
|
3608
3949
|
});
|
|
3609
|
-
/**
|
|
3610
|
-
Object.defineProperty(this, "
|
|
3950
|
+
/** 户型图大小 */
|
|
3951
|
+
Object.defineProperty(this, "size", {
|
|
3611
3952
|
enumerable: true,
|
|
3612
3953
|
configurable: true,
|
|
3613
3954
|
writable: true,
|
|
3614
|
-
value:
|
|
3955
|
+
value: { width: 0, height: 0 }
|
|
3615
3956
|
});
|
|
3616
|
-
|
|
3957
|
+
/** 是否已经执行过事件监听 */
|
|
3958
|
+
Object.defineProperty(this, "hasAddedEventListener", {
|
|
3617
3959
|
enumerable: true,
|
|
3618
3960
|
configurable: true,
|
|
3619
3961
|
writable: true,
|
|
3620
|
-
value:
|
|
3962
|
+
value: false
|
|
3621
3963
|
});
|
|
3622
|
-
|
|
3964
|
+
/** 上一次隐藏是否是用户调用了 hide 导致的 */
|
|
3965
|
+
Object.defineProperty(this, "isHiddenByHideFunc", {
|
|
3623
3966
|
enumerable: true,
|
|
3624
3967
|
configurable: true,
|
|
3625
3968
|
writable: true,
|
|
3626
|
-
value:
|
|
3969
|
+
value: false
|
|
3627
3970
|
});
|
|
3971
|
+
/** 销毁插件 */
|
|
3628
3972
|
Object.defineProperty(this, "dispose", {
|
|
3629
3973
|
enumerable: true,
|
|
3630
3974
|
configurable: true,
|
|
3631
3975
|
writable: true,
|
|
3632
3976
|
value: () => {
|
|
3633
3977
|
var _a, _b;
|
|
3634
|
-
|
|
3635
|
-
this.hide();
|
|
3978
|
+
this.removeEventListener();
|
|
3636
3979
|
(_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
3980
|
+
this.app = undefined;
|
|
3637
3981
|
(_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3982
|
+
this.data = undefined;
|
|
3983
|
+
this.wrapper = undefined;
|
|
3984
|
+
this.selector = undefined;
|
|
3985
|
+
this.hooks.emit('dispose');
|
|
3986
|
+
}
|
|
3987
|
+
});
|
|
3988
|
+
/** 展示户型图
|
|
3989
|
+
* 1. show 函数大部分情况下需要耗时
|
|
3990
|
+
* 2. 如果当前已经在展示中,将不会触发任何事件
|
|
3991
|
+
* 3. 如果展示过程被中断,将抛出错误
|
|
3992
|
+
* 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
|
|
3993
|
+
* 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
|
|
3994
|
+
* @param opts.floorIndex 楼层
|
|
3995
|
+
* @param opts.modelOpacity 模型透明度
|
|
3996
|
+
* @param opts.immediately 是否立即展示
|
|
3997
|
+
* @param opts.isAutoShow 是否是自动展示
|
|
3998
|
+
* @param opts.userAction 是否是用户行为
|
|
3999
|
+
*/
|
|
4000
|
+
Object.defineProperty(this, "show", {
|
|
4001
|
+
enumerable: true,
|
|
4002
|
+
configurable: true,
|
|
4003
|
+
writable: true,
|
|
4004
|
+
value: async (options = {}) => {
|
|
4005
|
+
if (!this.state.enabled)
|
|
4006
|
+
return;
|
|
4007
|
+
// 已经展示完成了,不做任何操作
|
|
4008
|
+
if (!this.showPromise && this.state.visible)
|
|
4009
|
+
return;
|
|
4010
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
4011
|
+
this.updateState({ visible: true }, userAction);
|
|
4012
|
+
this._show(options);
|
|
4013
|
+
}
|
|
4014
|
+
});
|
|
4015
|
+
/** 隐藏户型图 */
|
|
4016
|
+
Object.defineProperty(this, "hide", {
|
|
4017
|
+
enumerable: true,
|
|
4018
|
+
configurable: true,
|
|
4019
|
+
writable: true,
|
|
4020
|
+
value: async (options = {}) => {
|
|
4021
|
+
if (!this.state.enabled)
|
|
4022
|
+
return;
|
|
4023
|
+
this.isHiddenByHideFunc = true;
|
|
4024
|
+
if (this.state.visible === false)
|
|
4025
|
+
return;
|
|
4026
|
+
this.updateState({ visible: false }, options.userAction || true);
|
|
4027
|
+
this._hide(options);
|
|
3646
4028
|
}
|
|
3647
4029
|
});
|
|
3648
4030
|
/** 更新户型图大小 */
|
|
@@ -3651,166 +4033,172 @@ class ModelFloorplanPluginController {
|
|
|
3651
4033
|
configurable: true,
|
|
3652
4034
|
writable: true,
|
|
3653
4035
|
value: () => {
|
|
3654
|
-
if (!this.
|
|
4036
|
+
if (!this.data)
|
|
3655
4037
|
return;
|
|
3656
4038
|
if (!checkShowState(this.five, this.showState))
|
|
3657
4039
|
return;
|
|
3658
4040
|
if (!this.container || !this.wrapper)
|
|
3659
4041
|
return;
|
|
3660
4042
|
// 计算户型图展示大小
|
|
3661
|
-
const { min, max } = this.
|
|
4043
|
+
const { min, max } = this.data.bounding;
|
|
3662
4044
|
const width = max.x - min.x;
|
|
3663
4045
|
const height = max.y - min.y;
|
|
3664
4046
|
// 每毫米对应的 px 值
|
|
3665
|
-
const options = this.
|
|
4047
|
+
const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
|
|
3666
4048
|
const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
|
|
3667
4049
|
const _width = Math.ceil(width * pxmm);
|
|
3668
4050
|
const _height = Math.ceil(height * pxmm);
|
|
3669
4051
|
if (this.size.width === _width && this.size.height === _height)
|
|
3670
4052
|
return;
|
|
3671
|
-
this.pxmm = pxmm;
|
|
3672
|
-
this.size = { width: _width, height: _height };
|
|
3673
4053
|
this.container.style.width = _width + 'px';
|
|
3674
4054
|
this.container.style.height = _height + 'px';
|
|
4055
|
+
this.size = { width: _width, height: _height };
|
|
3675
4056
|
}
|
|
3676
4057
|
});
|
|
3677
|
-
|
|
3678
|
-
* 1. show 函数大部分情况下需要耗时
|
|
3679
|
-
* 2. 如果当前已经在展示中,将不会触发任何事件
|
|
3680
|
-
* 3. 如果展示过程被中断,将抛出错误
|
|
3681
|
-
* 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
|
|
3682
|
-
* 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
|
|
3683
|
-
* @param opts.floorIndex 楼层
|
|
3684
|
-
* @param opts.modelOpacity 模型透明度
|
|
3685
|
-
* @param opts.immediately 是否立即展示
|
|
3686
|
-
* @param opts.isAutoShow 是否是自动展示
|
|
3687
|
-
*/
|
|
3688
|
-
Object.defineProperty(this, "show", {
|
|
4058
|
+
Object.defineProperty(this, "_disable", {
|
|
3689
4059
|
enumerable: true,
|
|
3690
4060
|
configurable: true,
|
|
3691
4061
|
writable: true,
|
|
3692
|
-
value:
|
|
3693
|
-
var _a, _b;
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
4062
|
+
value: (options) => {
|
|
4063
|
+
var _a, _b, _c;
|
|
4064
|
+
const { userAction } = options;
|
|
4065
|
+
this.hooks.emit('disable', { userAction });
|
|
4066
|
+
// ===== 处理展示过程中 disable =====
|
|
4067
|
+
(_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByDisable);
|
|
4068
|
+
this.showPromise = undefined;
|
|
4069
|
+
(_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
|
|
4070
|
+
this.app = undefined;
|
|
4071
|
+
(_c = this.container) === null || _c === void 0 ? void 0 : _c.remove();
|
|
4072
|
+
this.removeEventListener();
|
|
4073
|
+
}
|
|
4074
|
+
});
|
|
4075
|
+
Object.defineProperty(this, "_enable", {
|
|
4076
|
+
enumerable: true,
|
|
4077
|
+
configurable: true,
|
|
4078
|
+
writable: true,
|
|
4079
|
+
value: (options) => {
|
|
4080
|
+
const { userAction } = options;
|
|
4081
|
+
this.addEventListener();
|
|
4082
|
+
if (!this.wrapper)
|
|
4083
|
+
return;
|
|
4084
|
+
this.wrapper.append(this.container);
|
|
4085
|
+
this.hooks.emit('enable', { userAction });
|
|
4086
|
+
if (this.state.visible)
|
|
4087
|
+
this._show({ userAction });
|
|
4088
|
+
}
|
|
4089
|
+
});
|
|
4090
|
+
Object.defineProperty(this, "_show", {
|
|
4091
|
+
enumerable: true,
|
|
4092
|
+
configurable: true,
|
|
4093
|
+
writable: true,
|
|
4094
|
+
value: async (options) => {
|
|
4095
|
+
var _a;
|
|
4096
|
+
if (!this.state.enabled)
|
|
4097
|
+
return;
|
|
3697
4098
|
if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
|
|
3698
4099
|
throw new Error(FloorplanErrorType.ModelNotLoaded);
|
|
3699
|
-
if (!this.
|
|
4100
|
+
if (!this.data)
|
|
3700
4101
|
throw new Error(FloorplanErrorType.DataNotLoaded);
|
|
3701
|
-
this.
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
4102
|
+
this.isHiddenByHideFunc = false;
|
|
4103
|
+
// ===== 参数合并 =====
|
|
4104
|
+
const baseShowOpts = {
|
|
4105
|
+
floorIndex: this.floorIndex,
|
|
4106
|
+
modelOpacity: this.state.config.modelOpacity,
|
|
4107
|
+
immediately: false,
|
|
4108
|
+
isAutoShow: false,
|
|
4109
|
+
userAction: true,
|
|
4110
|
+
};
|
|
4111
|
+
const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
|
|
3710
4112
|
const getShowPromise = async () => {
|
|
3711
|
-
|
|
4113
|
+
this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
|
|
3712
4114
|
let hasRejected = false;
|
|
3713
4115
|
let externalErrorMsg;
|
|
3714
4116
|
this.showRejection = (errorMsg) => {
|
|
3715
4117
|
hasRejected = true;
|
|
3716
4118
|
externalErrorMsg = errorMsg;
|
|
3717
4119
|
};
|
|
3718
|
-
const [correctError] = await to(correctFiveState(this.five, this.showState,
|
|
4120
|
+
const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
|
|
3719
4121
|
if (correctError)
|
|
3720
4122
|
throw correctError;
|
|
3721
|
-
//
|
|
4123
|
+
// 异步结束要判断当前是不是被中断了
|
|
3722
4124
|
if (hasRejected)
|
|
3723
4125
|
throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
|
|
3724
|
-
if (!this.visible)
|
|
3725
|
-
throw new Error(FloorplanErrorType.UnknownError);
|
|
3726
|
-
// 更新户型图状态
|
|
3727
|
-
this.visible = true;
|
|
3728
4126
|
// 更新户型图大小
|
|
3729
4127
|
this.updateSize();
|
|
3730
4128
|
// 高亮当前楼层,有两个目的
|
|
3731
4129
|
// 1. 点击模型时,可以跳转到当前楼层的点位上
|
|
3732
4130
|
// 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
|
|
3733
|
-
|
|
3734
|
-
this.floorIndex = opts.floorIndex;
|
|
4131
|
+
this.floorIndex = mergedOptions.floorIndex;
|
|
3735
4132
|
this.five.model.show(this.floorIndex);
|
|
3736
4133
|
// 模型消失, 渲染户型图
|
|
3737
|
-
const modelOpacity =
|
|
3738
|
-
const renderDuration =
|
|
4134
|
+
const modelOpacity = mergedOptions.modelOpacity;
|
|
4135
|
+
const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
|
|
3739
4136
|
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
3740
4137
|
this.render(renderDuration);
|
|
3741
|
-
// 展示之后的事件监听
|
|
3742
|
-
this.five.on('wantsGesture', this.handleWantsGesture);
|
|
3743
|
-
this.five.on('wantsTapGesture', this.handleWantsTapGesture);
|
|
3744
|
-
return true;
|
|
3745
4138
|
};
|
|
3746
|
-
|
|
4139
|
+
this.showPromise = getShowPromise()
|
|
3747
4140
|
.then(() => {
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
4141
|
+
this.hooks.emit('showAnimationEnded', {
|
|
4142
|
+
auto: mergedOptions.isAutoShow,
|
|
4143
|
+
userAction: mergedOptions.userAction,
|
|
4144
|
+
});
|
|
3751
4145
|
})
|
|
3752
4146
|
.catch((error) => {
|
|
4147
|
+
this.updateState({ visible: false }, mergedOptions.userAction);
|
|
3753
4148
|
// 自动展示的报错内部处理
|
|
3754
|
-
if (
|
|
3755
|
-
return
|
|
3756
|
-
if (!(error instanceof Error))
|
|
3757
|
-
return false;
|
|
4149
|
+
if (mergedOptions.isAutoShow)
|
|
4150
|
+
return;
|
|
3758
4151
|
// 非自动展示的报错继续向外抛出
|
|
3759
|
-
|
|
4152
|
+
if (error instanceof Error)
|
|
4153
|
+
throw error;
|
|
3760
4154
|
})
|
|
3761
4155
|
.finally(() => {
|
|
3762
4156
|
this.showPromise = undefined;
|
|
3763
4157
|
this.showRejection = undefined;
|
|
3764
4158
|
});
|
|
3765
|
-
this.showPromise
|
|
3766
|
-
return showPromise;
|
|
4159
|
+
return this.showPromise;
|
|
3767
4160
|
}
|
|
3768
4161
|
});
|
|
3769
|
-
|
|
3770
|
-
Object.defineProperty(this, "hide", {
|
|
4162
|
+
Object.defineProperty(this, "_hide", {
|
|
3771
4163
|
enumerable: true,
|
|
3772
4164
|
configurable: true,
|
|
3773
4165
|
writable: true,
|
|
3774
4166
|
value: (options) => {
|
|
3775
|
-
var _a
|
|
3776
|
-
|
|
3777
|
-
return true;
|
|
3778
|
-
if (this.visible === false)
|
|
3779
|
-
return true;
|
|
3780
|
-
const isAutoHide = !!(options === null || options === void 0 ? void 0 : options.isAutoHide);
|
|
3781
|
-
this.five.off('wantsGesture', this.handleWantsGesture);
|
|
3782
|
-
this.five.off('wantsTapGesture', this.handleWantsTapGesture);
|
|
3783
|
-
this.visible = false;
|
|
4167
|
+
var _a;
|
|
4168
|
+
// ===== 处理展示过程中 hide =====
|
|
3784
4169
|
(_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
|
|
4170
|
+
this.showPromise = undefined;
|
|
4171
|
+
// ===== 合并参数 =====
|
|
4172
|
+
const baseOptions = {
|
|
4173
|
+
userAction: true,
|
|
4174
|
+
isAutoHide: false,
|
|
4175
|
+
};
|
|
4176
|
+
const mergedOptions = Object.assign(Object.assign({}, baseOptions), options);
|
|
3785
4177
|
changeModelCanvasOpacity(this.five, 1, 0);
|
|
4178
|
+
this.hooks.emit('hide', { auto: mergedOptions.isAutoHide, userAction: mergedOptions.userAction });
|
|
3786
4179
|
this.render();
|
|
3787
|
-
this.hooks.emit('hide', { auto: isAutoHide, userAction: (_b = options === null || options === void 0 ? void 0 : options.userAction) !== null && _b !== void 0 ? _b : true });
|
|
3788
|
-
return true;
|
|
3789
4180
|
}
|
|
3790
4181
|
});
|
|
3791
|
-
|
|
3792
|
-
Object.defineProperty(this, "onModelShownFloorChange", {
|
|
4182
|
+
Object.defineProperty(this, "handleClick", {
|
|
3793
4183
|
enumerable: true,
|
|
3794
4184
|
configurable: true,
|
|
3795
4185
|
writable: true,
|
|
3796
|
-
value: (
|
|
3797
|
-
if (this.
|
|
3798
|
-
return;
|
|
3799
|
-
if (shownFloor === null) {
|
|
3800
|
-
const panoIndex = this.five.getCurrentState().panoIndex;
|
|
3801
|
-
this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
|
|
4186
|
+
value: () => {
|
|
4187
|
+
if (!this.state.visible)
|
|
3802
4188
|
return;
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
this.render();
|
|
4189
|
+
const preventDefault = this.hooks.emit('click');
|
|
4190
|
+
if (preventDefault)
|
|
4191
|
+
return false;
|
|
3807
4192
|
}
|
|
3808
4193
|
});
|
|
3809
|
-
|
|
4194
|
+
/** modelLoaded 之后自动执行 append container 操作 */
|
|
4195
|
+
Object.defineProperty(this, "onFiveModelLoaded", {
|
|
3810
4196
|
enumerable: true,
|
|
3811
4197
|
configurable: true,
|
|
3812
4198
|
writable: true,
|
|
3813
4199
|
value: () => {
|
|
4200
|
+
if (this.state.enabled === false)
|
|
4201
|
+
return;
|
|
3814
4202
|
if (this.wrapper)
|
|
3815
4203
|
return;
|
|
3816
4204
|
if (!this.selector)
|
|
@@ -3822,54 +4210,45 @@ class ModelFloorplanPluginController {
|
|
|
3822
4210
|
wrapper.append(this.container);
|
|
3823
4211
|
}
|
|
3824
4212
|
});
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
configurable: true,
|
|
3828
|
-
writable: true,
|
|
3829
|
-
value: () => {
|
|
3830
|
-
if (!this.visible)
|
|
3831
|
-
return;
|
|
3832
|
-
const prevented = this.hooks.emit('click');
|
|
3833
|
-
if (prevented)
|
|
3834
|
-
return false;
|
|
3835
|
-
}
|
|
3836
|
-
});
|
|
3837
|
-
Object.defineProperty(this, "handleWantsTapGesture", {
|
|
3838
|
-
enumerable: true,
|
|
3839
|
-
configurable: true,
|
|
3840
|
-
writable: true,
|
|
3841
|
-
value: () => this.handleClick()
|
|
3842
|
-
});
|
|
3843
|
-
/** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
|
|
3844
|
-
Object.defineProperty(this, "handleWantsChangeMode", {
|
|
4213
|
+
/** 更改模型时,自动隐藏户型图 */
|
|
4214
|
+
Object.defineProperty(this, "onFiveModeChange", {
|
|
3845
4215
|
enumerable: true,
|
|
3846
4216
|
configurable: true,
|
|
3847
4217
|
writable: true,
|
|
3848
4218
|
value: (mode) => {
|
|
3849
|
-
|
|
3850
|
-
|
|
4219
|
+
// 目前 Five modeChange 事件没有暴露 userAction,先拿 false 苟着
|
|
4220
|
+
if (mode !== this.showState.mode) {
|
|
4221
|
+
this.updateState({ visible: false }, false);
|
|
4222
|
+
this._hide({ userAction: false });
|
|
3851
4223
|
}
|
|
3852
|
-
if (mode !== 'Floorplan')
|
|
3853
|
-
this.hide();
|
|
3854
4224
|
}
|
|
3855
4225
|
});
|
|
3856
|
-
/**
|
|
3857
|
-
Object.defineProperty(this, "
|
|
4226
|
+
/** 惯性结束后,判断能否自动展示户型图 */
|
|
4227
|
+
Object.defineProperty(this, "onFiveInteriaPan", {
|
|
3858
4228
|
enumerable: true,
|
|
3859
4229
|
configurable: true,
|
|
3860
4230
|
writable: true,
|
|
3861
|
-
value: (
|
|
3862
|
-
if (
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
4231
|
+
value: (_, isFinal) => {
|
|
4232
|
+
if (!isFinal)
|
|
4233
|
+
return;
|
|
4234
|
+
if (this.state.config.autoShowEnable === false)
|
|
4235
|
+
return;
|
|
4236
|
+
// 如果用户调用 hide 方法手动隐藏户型图,则不允许自动展示
|
|
4237
|
+
if (this.isHiddenByHideFunc)
|
|
4238
|
+
return;
|
|
4239
|
+
const fiveCurrentState = this.five.getCurrentState();
|
|
4240
|
+
if (fiveCurrentState.mode !== 'Floorplan')
|
|
4241
|
+
return;
|
|
4242
|
+
if (this.state.visible)
|
|
4243
|
+
return;
|
|
4244
|
+
if (shouldFloorplanShowWithPose(fiveCurrentState)) {
|
|
4245
|
+
this.updateState({ visible: true }, true);
|
|
4246
|
+
this._show({ isAutoShow: true });
|
|
3868
4247
|
}
|
|
3869
4248
|
}
|
|
3870
4249
|
});
|
|
3871
4250
|
/** panoIndex 改变时,更新 floorIndex */
|
|
3872
|
-
Object.defineProperty(this, "
|
|
4251
|
+
Object.defineProperty(this, "onFivePanoArrived", {
|
|
3873
4252
|
enumerable: true,
|
|
3874
4253
|
configurable: true,
|
|
3875
4254
|
writable: true,
|
|
@@ -3881,155 +4260,266 @@ class ModelFloorplanPluginController {
|
|
|
3881
4260
|
this.floorIndex = this.five.work.observers[index].floorIndex;
|
|
3882
4261
|
}
|
|
3883
4262
|
});
|
|
3884
|
-
/**
|
|
3885
|
-
Object.defineProperty(this, "
|
|
4263
|
+
/** cameraUpdate 时判断户型图是否应该自动隐藏 */
|
|
4264
|
+
Object.defineProperty(this, "onFiveCameraUpdate", {
|
|
3886
4265
|
enumerable: true,
|
|
3887
4266
|
configurable: true,
|
|
3888
4267
|
writable: true,
|
|
3889
|
-
value: () => {
|
|
3890
|
-
if (this.visible)
|
|
3891
|
-
return
|
|
4268
|
+
value: (_, userAction) => {
|
|
4269
|
+
if (!this.state.visible)
|
|
4270
|
+
return;
|
|
4271
|
+
// 展示过程中不处理自动隐藏逻辑
|
|
4272
|
+
if (this.showPromise)
|
|
4273
|
+
return;
|
|
4274
|
+
const fiveCurrentState = this.five.getCurrentState();
|
|
4275
|
+
if (shouldFloorplanHideWithPose(fiveCurrentState)) {
|
|
4276
|
+
this.updateState({ visible: false }, userAction);
|
|
4277
|
+
this._hide({ userAction });
|
|
4278
|
+
}
|
|
3892
4279
|
}
|
|
3893
4280
|
});
|
|
3894
4281
|
/** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
|
|
3895
|
-
Object.defineProperty(this, "
|
|
4282
|
+
Object.defineProperty(this, "onFiveWantsGesture", {
|
|
3896
4283
|
enumerable: true,
|
|
3897
4284
|
configurable: true,
|
|
3898
4285
|
writable: true,
|
|
3899
4286
|
value: (type, pointers) => {
|
|
3900
|
-
if (!this.visible)
|
|
4287
|
+
if (!this.state.visible)
|
|
3901
4288
|
return;
|
|
4289
|
+
// 阻止多指操作
|
|
3902
4290
|
if (pointers.length > 1)
|
|
3903
4291
|
return false;
|
|
4292
|
+
// 阻止鼠标滚轮行为
|
|
3904
4293
|
if (type === 'mouseWheel')
|
|
3905
4294
|
return false;
|
|
3906
4295
|
}
|
|
3907
4296
|
});
|
|
3908
|
-
/**
|
|
3909
|
-
|
|
3910
|
-
* 2. 如何户型图已经展示,滑动时关闭户型图
|
|
3911
|
-
*/
|
|
3912
|
-
Object.defineProperty(this, "handlePanGesture", {
|
|
4297
|
+
/** 户型图展示中,转动三维模型,结束时应该自动修复模型状态 */
|
|
4298
|
+
Object.defineProperty(this, "onFiveWantsPanGesture", {
|
|
3913
4299
|
enumerable: true,
|
|
3914
4300
|
configurable: true,
|
|
3915
4301
|
writable: true,
|
|
3916
|
-
value:
|
|
4302
|
+
value: (_, isFinal) => {
|
|
3917
4303
|
if (this.five.getCurrentState().mode !== 'Floorplan')
|
|
3918
4304
|
return;
|
|
3919
|
-
if (this.
|
|
4305
|
+
if (this.state.config.autoShowEnable === false)
|
|
3920
4306
|
return;
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
4307
|
+
if (isFinal && this.state.visible) {
|
|
4308
|
+
this.five.updateCamera(this.showState, 0);
|
|
4309
|
+
// 禁用掉 isFinal 的 panGesture 行为
|
|
4310
|
+
// 因为 panGesture 中包含对相机的处理,会跟回调事件中的处理逻辑冲突
|
|
4311
|
+
// 此行为也会禁用 pan 结束后的惯性处理
|
|
4312
|
+
return false;
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
});
|
|
4316
|
+
/** 阻止点击分间走点 */
|
|
4317
|
+
Object.defineProperty(this, "onFiveWantsTapGesture", {
|
|
4318
|
+
enumerable: true,
|
|
4319
|
+
configurable: true,
|
|
4320
|
+
writable: true,
|
|
4321
|
+
value: () => this.handleClick()
|
|
4322
|
+
});
|
|
4323
|
+
/** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
|
|
4324
|
+
Object.defineProperty(this, "onFiveWantsChangeMode", {
|
|
4325
|
+
enumerable: true,
|
|
4326
|
+
configurable: true,
|
|
4327
|
+
writable: true,
|
|
4328
|
+
value: (mode, prevMode) => {
|
|
4329
|
+
if (prevMode === 'Panorama' && mode === 'Floorplan') {
|
|
4330
|
+
this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
|
|
4331
|
+
}
|
|
4332
|
+
// if (mode !== 'Floorplan') this.hide()
|
|
4333
|
+
}
|
|
4334
|
+
});
|
|
4335
|
+
/** 模型楼层高亮改变时,自动进行楼层切换 */
|
|
4336
|
+
Object.defineProperty(this, "onModelShownFloorChange", {
|
|
4337
|
+
enumerable: true,
|
|
4338
|
+
configurable: true,
|
|
4339
|
+
writable: true,
|
|
4340
|
+
value: (shownFloor) => {
|
|
4341
|
+
if (this.floorIndex === shownFloor)
|
|
3932
4342
|
return;
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
3937
|
-
if (isFinal && !this.visible && latitudeVisible && longitudeVisible) {
|
|
3938
|
-
// 当手指离开时需要等惯性结束之后在进行判断
|
|
3939
|
-
const handleInteriaPan = async (any, isFinal) => {
|
|
3940
|
-
if (!isFinal)
|
|
3941
|
-
return;
|
|
3942
|
-
this.five.off('interiaPan', handleInteriaPan);
|
|
3943
|
-
await this.show({ isAutoShow: true });
|
|
3944
|
-
};
|
|
3945
|
-
this.five.on('interiaPan', handleInteriaPan);
|
|
4343
|
+
if (shownFloor === null) {
|
|
4344
|
+
const panoIndex = this.five.getCurrentState().panoIndex;
|
|
4345
|
+
this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
|
|
3946
4346
|
return;
|
|
3947
4347
|
}
|
|
4348
|
+
this.floorIndex = shownFloor;
|
|
4349
|
+
this.updateSize();
|
|
4350
|
+
this.render();
|
|
3948
4351
|
}
|
|
3949
4352
|
});
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4353
|
+
if (params === null || params === void 0 ? void 0 : params.selector) {
|
|
4354
|
+
this.selector = params.selector;
|
|
4355
|
+
console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
|
|
4356
|
+
}
|
|
4357
|
+
// =============== init Show State ===============
|
|
4358
|
+
this.showState = {
|
|
4359
|
+
mode: 'Floorplan',
|
|
4360
|
+
longitude: 0,
|
|
4361
|
+
latitude: Math.PI / 2,
|
|
4362
|
+
fov: FIVE_CAMERA_DEFAULT_FOV / ((_a = params === null || params === void 0 ? void 0 : params.scale) !== null && _a !== void 0 ? _a : 1),
|
|
4363
|
+
};
|
|
4364
|
+
// =============== init State ===============
|
|
4365
|
+
const baseConfig = {
|
|
4366
|
+
northDesc: '北',
|
|
4367
|
+
modelOpacity: 1,
|
|
4368
|
+
hoverEnable: true,
|
|
4369
|
+
compassEnable: true,
|
|
4370
|
+
autoShowEnable: true,
|
|
4371
|
+
ruleLabelsEnable: true,
|
|
4372
|
+
roomLabelsEnable: true,
|
|
4373
|
+
cameraImageUrl: CAMERA_IMAGE,
|
|
4374
|
+
attachedTo: FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
|
|
4375
|
+
getLabelElement: undefined,
|
|
4376
|
+
adaptiveRoomLabelVisibleEnable: true,
|
|
4377
|
+
};
|
|
4378
|
+
const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
|
|
4379
|
+
const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
|
|
4380
|
+
this.state = {
|
|
4381
|
+
enabled: true,
|
|
4382
|
+
visible: false,
|
|
4383
|
+
config,
|
|
4384
|
+
};
|
|
4385
|
+
// =============== init Container ===============
|
|
4386
|
+
this.initContainer();
|
|
4387
|
+
// =============== init Listener ===============
|
|
4388
|
+
// 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
|
|
3966
4389
|
// 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
|
|
3967
|
-
|
|
3968
|
-
five
|
|
3969
|
-
|
|
3970
|
-
five$1.on('panoArrived', this.handlePanoArrived);
|
|
3971
|
-
five$1.on('wantsChangeMode', this.handleWantsChangeMode);
|
|
3972
|
-
five$1.on('wantsInteriaPan', this.handleWantsInteriaPan);
|
|
3973
|
-
five$1.on('modelShownFloorChange', this.onModelShownFloorChange);
|
|
4390
|
+
five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
|
|
4391
|
+
five.once('dispose', this.dispose);
|
|
4392
|
+
this.addEventListener();
|
|
3974
4393
|
}
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
4394
|
+
async load(serverData, state, userAction = true) {
|
|
4395
|
+
function isPluginServerData(serverData) {
|
|
4396
|
+
return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
|
|
4397
|
+
}
|
|
4398
|
+
const _data = serverData;
|
|
4399
|
+
if (_data && !_data.version)
|
|
4400
|
+
console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
|
|
4401
|
+
const copyData = JSON.parse(JSON.stringify(serverData));
|
|
4402
|
+
const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
|
|
4403
|
+
const prevData = this.data;
|
|
4404
|
+
this.data = await formatData(_serverData);
|
|
4405
|
+
this.hooks.emit('dataLoaded', this.data);
|
|
4406
|
+
this.hooks.emit('dataChange', this.data, prevData);
|
|
4407
|
+
if (state)
|
|
4408
|
+
this.updateState(state, userAction);
|
|
3979
4409
|
this.render();
|
|
3980
4410
|
}
|
|
3981
4411
|
/** 把插件的渲染DOM插入到对应的容器中去 */
|
|
3982
4412
|
appendTo(wrapper) {
|
|
3983
4413
|
this.wrapper = wrapper;
|
|
4414
|
+
// 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
|
|
4415
|
+
if (!this.state.enabled)
|
|
4416
|
+
return;
|
|
3984
4417
|
wrapper.appendChild(this.container);
|
|
4418
|
+
this.render();
|
|
3985
4419
|
return this;
|
|
3986
4420
|
}
|
|
3987
|
-
/**
|
|
3988
|
-
|
|
3989
|
-
this.
|
|
4421
|
+
/** 启用插件 */
|
|
4422
|
+
enable(options = {}) {
|
|
4423
|
+
if (this.state.enabled)
|
|
4424
|
+
return;
|
|
4425
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
4426
|
+
this.updateState({ enabled: true }, options.userAction || userAction);
|
|
4427
|
+
this._enable({ userAction });
|
|
3990
4428
|
}
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
if (!this.
|
|
4429
|
+
/** 禁用插件 */
|
|
4430
|
+
disable(options = {}) {
|
|
4431
|
+
if (!this.state.enabled)
|
|
3994
4432
|
return;
|
|
3995
|
-
|
|
4433
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
4434
|
+
this.updateState({ enabled: false }, options.userAction || userAction);
|
|
4435
|
+
this._disable({ userAction });
|
|
4436
|
+
}
|
|
4437
|
+
/** 更改插件 State */
|
|
4438
|
+
setState(state, options = {}) {
|
|
4439
|
+
const prevState = this.state;
|
|
4440
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
4441
|
+
this.updateState(state, userAction);
|
|
4442
|
+
if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
|
|
4443
|
+
state.enabled ? this._enable({ userAction }) : this._disable({ userAction });
|
|
4444
|
+
}
|
|
4445
|
+
if (state.visible !== undefined && prevState.visible !== state.visible) {
|
|
4446
|
+
const options = { userAction };
|
|
4447
|
+
state.visible ? this._show(options) : this._hide(options);
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4450
|
+
async formatData(serverData) {
|
|
4451
|
+
return await formatData(serverData.data);
|
|
4452
|
+
}
|
|
4453
|
+
updateState(state, userAction) {
|
|
4454
|
+
const prevState = this.state;
|
|
4455
|
+
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
4456
|
+
if (equal(this.state, prevState, { deep: true }))
|
|
4457
|
+
return;
|
|
4458
|
+
this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
|
|
4459
|
+
}
|
|
4460
|
+
/** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
|
|
4461
|
+
*
|
|
4462
|
+
* - TODO: 等 selector 功能下掉之后删除这个逻辑
|
|
4463
|
+
*/
|
|
4464
|
+
initContainer() {
|
|
4465
|
+
this.container.classList.add('floorplan-plugin');
|
|
4466
|
+
Object.assign(this.container.style, {
|
|
4467
|
+
position: 'absolute',
|
|
4468
|
+
left: '50%',
|
|
4469
|
+
top: '50%',
|
|
4470
|
+
transform: 'translate(-50%, -50%)',
|
|
4471
|
+
zIndex: 10,
|
|
4472
|
+
pointerEvents: 'none',
|
|
4473
|
+
});
|
|
4474
|
+
this.five.addExtraElement(this.container);
|
|
4475
|
+
}
|
|
4476
|
+
addEventListener() {
|
|
4477
|
+
if (!this.state.enabled)
|
|
4478
|
+
return;
|
|
4479
|
+
if (this.hasAddedEventListener)
|
|
4480
|
+
return;
|
|
4481
|
+
const five = this.five;
|
|
4482
|
+
five.on('modeChange', this.onFiveModeChange);
|
|
4483
|
+
five.on('interiaPan', this.onFiveInteriaPan);
|
|
4484
|
+
five.on('panoArrived', this.onFivePanoArrived);
|
|
4485
|
+
five.on('cameraUpdate', this.onFiveCameraUpdate);
|
|
4486
|
+
five.on('wantsGesture', this.onFiveWantsGesture);
|
|
4487
|
+
five.on('wantsPanGesture', this.onFiveWantsPanGesture);
|
|
4488
|
+
five.on('wantsTapGesture', this.onFiveWantsTapGesture);
|
|
4489
|
+
five.on('wantsChangeMode', this.onFiveWantsChangeMode);
|
|
4490
|
+
five.on('modelShownFloorChange', this.onModelShownFloorChange);
|
|
4491
|
+
}
|
|
4492
|
+
removeEventListener() {
|
|
4493
|
+
const five = this.five;
|
|
4494
|
+
this.hasAddedEventListener = false;
|
|
4495
|
+
// 注意这里并没有消除 dispose 的监听
|
|
4496
|
+
five.off('modelLoaded', this.onFiveModelLoaded);
|
|
4497
|
+
five.off('modeChange', this.onFiveModeChange);
|
|
4498
|
+
five.off('interiaPan', this.onFiveInteriaPan);
|
|
4499
|
+
five.off('panoArrived', this.onFivePanoArrived);
|
|
4500
|
+
five.off('cameraUpdate', this.onFiveCameraUpdate);
|
|
4501
|
+
five.off('wantsGesture', this.onFiveWantsGesture);
|
|
4502
|
+
five.off('wantsPanGesture', this.onFiveWantsPanGesture);
|
|
4503
|
+
five.off('wantsTapGesture', this.onFiveWantsTapGesture);
|
|
4504
|
+
five.off('wantsChangeMode', this.onFiveWantsChangeMode);
|
|
4505
|
+
five.off('modelShownFloorChange', this.onModelShownFloorChange);
|
|
3996
4506
|
}
|
|
3997
4507
|
render(duration) {
|
|
3998
|
-
if (!this.
|
|
4508
|
+
if (!this.state.enabled)
|
|
4509
|
+
return;
|
|
4510
|
+
if (!this.container || !this.data)
|
|
3999
4511
|
return;
|
|
4000
4512
|
if (this.size.width === 0)
|
|
4001
4513
|
return;
|
|
4002
|
-
const {
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
northDesc: northDesc !== null && northDesc !== void 0 ? northDesc : '北',
|
|
4007
|
-
visible: this.visible,
|
|
4008
|
-
duration: duration !== null && duration !== void 0 ? duration : 0,
|
|
4009
|
-
panoIndex: this.panoIndex,
|
|
4010
|
-
floorIndex: this.floorIndex,
|
|
4011
|
-
floorplanData: this.floorplanData,
|
|
4012
|
-
hoverEnable: hoverEnable !== null && hoverEnable !== void 0 ? hoverEnable : false,
|
|
4013
|
-
compassEnable: compassEnable !== null && compassEnable !== void 0 ? compassEnable : true,
|
|
4014
|
-
ruleLabelsEnable: ruleLabelsEnable !== null && ruleLabelsEnable !== void 0 ? ruleLabelsEnable : true,
|
|
4015
|
-
roomLabelsEnable: roomLabelsEnable !== null && roomLabelsEnable !== void 0 ? roomLabelsEnable : true,
|
|
4016
|
-
lastPanoramaLongitude: this.lastPanoramaLongitude,
|
|
4017
|
-
};
|
|
4018
|
-
if (!this.app) {
|
|
4019
|
-
this.app = new Main({
|
|
4020
|
-
target: this.container,
|
|
4021
|
-
intro: true,
|
|
4022
|
-
props,
|
|
4023
|
-
});
|
|
4024
|
-
}
|
|
4025
|
-
else {
|
|
4026
|
-
this.app.$set(props);
|
|
4027
|
-
}
|
|
4514
|
+
const props = Object.assign(Object.assign({}, this.state.config), { visible: this.state.visible, duration: duration !== null && duration !== void 0 ? duration : 0, panoIndex: this.panoIndex, floorIndex: this.floorIndex, floorplanData: this.data, lastPanoramaLongitude: this.lastPanoramaLongitude });
|
|
4515
|
+
if (this.app)
|
|
4516
|
+
return this.app.$set(props);
|
|
4517
|
+
this.app = new Main({ target: this.container, intro: true, props });
|
|
4028
4518
|
}
|
|
4029
4519
|
}
|
|
4030
4520
|
|
|
4031
4521
|
const ModelFloorplanPlugin = (five, params) => {
|
|
4032
|
-
return new
|
|
4522
|
+
return new Controller(five, params);
|
|
4033
4523
|
};
|
|
4034
4524
|
|
|
4035
4525
|
exports.ModelFloorplanPlugin = ModelFloorplanPlugin;
|