@realsee/dnalogel 2.0.0-alpha.10 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CSS3DRenderPlugin/index.js +17 -14
- package/dist/CameraMovementPlugin/index.js +40 -15
- package/dist/ModelChassisCompassPlugin/index.js +32 -6
- package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
- package/dist/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
- package/dist/ModelItemLabelPlugin/index.js +679 -0
- package/dist/ModelItemLabelPlugin/typings.d.ts +55 -0
- package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ModelRoomLabelPlugin/index.js +71 -28
- package/dist/PanoCompassPlugin/index.js +311 -164
- package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
- package/dist/PanoMeasurePlugin/index.js +1337 -583
- package/dist/PanoRulerPlugin/index.js +32 -5
- package/dist/PanoSpatialTagPlugin/index.js +73 -38
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
- package/dist/floorplan/ModelFloorplanPlugin/index.js +678 -439
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +403 -230
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3596 -1612
- package/dist/index.js +3602 -1616
- package/dist/index.umd.js +3605 -1620
- package/docs/assets/main.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +6 -6
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/index.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/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
- package/docs/modules.html +12 -12
- package/libs/CSS3DRenderPlugin/index.js +16 -13
- package/libs/CameraMovementPlugin/index.js +24 -15
- package/libs/ModelChassisCompassPlugin/index.js +14 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +422 -0
- package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
- package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ModelItemLabelPlugin/events.type.js +1 -0
- package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
- package/libs/ModelItemLabelPlugin/index.js +172 -0
- package/libs/ModelItemLabelPlugin/typings.d.ts +55 -0
- package/libs/ModelItemLabelPlugin/typings.js +6 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +7 -5
- package/libs/PanoCompassPlugin/index.js +225 -128
- package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
- package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
- package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
- package/libs/PanoMeasurePlugin/Model/index.js +30 -5
- package/libs/PanoMeasurePlugin/Model/line.js +60 -10
- package/libs/PanoMeasurePlugin/Model/point.js +24 -4
- package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
- package/libs/PanoMeasurePlugin/utils/line.js +8 -7
- package/libs/PanoRulerPlugin/index.js +16 -5
- package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
- package/libs/PanoSpatialTagPlugin/index.js +11 -9
- package/libs/floorplan/Components/BaseImage.js +10 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +24 -11
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +77 -69
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +457 -273
- package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +232 -108
- package/libs/floorplan/utils/formatData.js +43 -28
- package/libs/floorplan/utils/formatPosition.js +1 -1
- package/libs/index.d.ts +1 -0
- package/libs/index.js +2 -0
- package/libs/shared-utils/Subscribe.js +8 -1
- package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
- package/libs/shared-utils/createCanvasTextTexture.js +6 -5
- package/libs/shared-utils/five/changeMode.js +23 -12
- package/libs/shared-utils/getPxmm.js +1 -1
- package/libs/shared-utils/math/evenNumber.js +1 -1
- package/libs/shared-utils/three/loadFbxObj.js +20 -9
- package/libs/shared-utils/three/loadTexture.js +17 -6
- package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
- package/libs/shared-utils/tinyEJSrender.js +36 -6
- package/libs/shared-utils/to.js +21 -10
- package/libs/shared-utils/useDebounce.js +1 -1
- package/libs/shared-utils/useThrottle.js +2 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -34
|
@@ -28,6 +28,31 @@ function _interopNamespace(e) {
|
|
|
28
28
|
|
|
29
29
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
30
30
|
|
|
31
|
+
/*! *****************************************************************************
|
|
32
|
+
Copyright (c) Microsoft Corporation.
|
|
33
|
+
|
|
34
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
35
|
+
purpose with or without fee is hereby granted.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
38
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
39
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
40
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
41
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
42
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
43
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
44
|
+
***************************************************************************** */
|
|
45
|
+
|
|
46
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
47
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
31
56
|
const CAMERA_IMAGE = 'data:image/png;base64,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';
|
|
32
57
|
|
|
33
58
|
function rad2Deg$1(rad) {
|
|
@@ -145,12 +170,13 @@ function add_css$b(target) {
|
|
|
145
170
|
internal.append_styles(target, "svelte-5l80pv", ".floorplan-plugin__compass.svelte-5l80pv{position:absolute;left:50%;top:-46px;width:231px;height:41px;will-change:opacity;transform-origin:center 184px}.floorplan-plugin__compass-image.svelte-5l80pv{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-5l80pv{position:absolute;left:50%;top:15px;transform:translateX(-50%);opacity:0.2;font-weight:bold;font-size:10px;color:#fff}");
|
|
146
171
|
}
|
|
147
172
|
|
|
148
|
-
// (
|
|
173
|
+
// (13:0) {#if northRad}
|
|
149
174
|
function create_if_block$6(ctx) {
|
|
150
175
|
let div1;
|
|
151
176
|
let div0;
|
|
152
177
|
let t0;
|
|
153
178
|
let span;
|
|
179
|
+
let t1;
|
|
154
180
|
|
|
155
181
|
return {
|
|
156
182
|
c() {
|
|
@@ -158,20 +184,23 @@ function create_if_block$6(ctx) {
|
|
|
158
184
|
div0 = internal.element("div");
|
|
159
185
|
t0 = internal.space();
|
|
160
186
|
span = internal.element("span");
|
|
161
|
-
|
|
187
|
+
t1 = internal.text(/*northDesc*/ ctx[0]);
|
|
162
188
|
internal.attr(div0, "class", "floorplan-plugin__compass-image svelte-5l80pv");
|
|
163
189
|
internal.set_style(div0, "background-image", `url(${COMPASS_IMAGE})`);
|
|
164
190
|
internal.attr(span, "class", "floorplan-plugin__compass-text svelte-5l80pv");
|
|
165
191
|
internal.attr(div1, "class", "floorplan-plugin__compass svelte-5l80pv");
|
|
166
|
-
internal.set_style(div1, "transform", /*compassTransformStyle*/ ctx[
|
|
192
|
+
internal.set_style(div1, "transform", /*compassTransformStyle*/ ctx[2], false);
|
|
167
193
|
},
|
|
168
194
|
m(target, anchor) {
|
|
169
195
|
internal.insert(target, div1, anchor);
|
|
170
196
|
internal.append(div1, div0);
|
|
171
197
|
internal.append(div1, t0);
|
|
172
198
|
internal.append(div1, span);
|
|
199
|
+
internal.append(span, t1);
|
|
200
|
+
},
|
|
201
|
+
p(ctx, dirty) {
|
|
202
|
+
if (dirty & /*northDesc*/ 1) internal.set_data(t1, /*northDesc*/ ctx[0]);
|
|
173
203
|
},
|
|
174
|
-
p: internal.noop,
|
|
175
204
|
d(detaching) {
|
|
176
205
|
if (detaching) internal.detach(div1);
|
|
177
206
|
}
|
|
@@ -180,7 +209,7 @@ function create_if_block$6(ctx) {
|
|
|
180
209
|
|
|
181
210
|
function create_fragment$f(ctx) {
|
|
182
211
|
let if_block_anchor;
|
|
183
|
-
let if_block = /*northRad*/ ctx[
|
|
212
|
+
let if_block = /*northRad*/ ctx[1] && create_if_block$6(ctx);
|
|
184
213
|
|
|
185
214
|
return {
|
|
186
215
|
c() {
|
|
@@ -192,7 +221,7 @@ function create_fragment$f(ctx) {
|
|
|
192
221
|
internal.insert(target, if_block_anchor, anchor);
|
|
193
222
|
},
|
|
194
223
|
p(ctx, [dirty]) {
|
|
195
|
-
if (/*northRad*/ ctx[
|
|
224
|
+
if (/*northRad*/ ctx[1]) if_block.p(ctx, dirty);
|
|
196
225
|
},
|
|
197
226
|
i: internal.noop,
|
|
198
227
|
o: internal.noop,
|
|
@@ -208,22 +237,29 @@ function rad2Deg(rad) {
|
|
|
208
237
|
}
|
|
209
238
|
|
|
210
239
|
function instance$f($$self, $$props, $$invalidate) {
|
|
240
|
+
var _a;
|
|
211
241
|
let { floorplanData } = $$props;
|
|
212
|
-
|
|
242
|
+
let { northDesc } = $$props;
|
|
243
|
+
|
|
244
|
+
const northRad = (_a = floorplanData.entrance) === null || _a === void 0
|
|
245
|
+
? void 0
|
|
246
|
+
: _a.northRad;
|
|
247
|
+
|
|
213
248
|
const rotate = !northRad ? 0 : rad2Deg(northRad);
|
|
214
249
|
const compassTransformStyle = `translateX(-50%) translateZ(10px) rotate(${-rotate + 90}deg)`;
|
|
215
250
|
|
|
216
251
|
$$self.$$set = $$props => {
|
|
217
|
-
if ('floorplanData' in $$props) $$invalidate(
|
|
252
|
+
if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
|
|
253
|
+
if ('northDesc' in $$props) $$invalidate(0, northDesc = $$props.northDesc);
|
|
218
254
|
};
|
|
219
255
|
|
|
220
|
-
return [northRad, compassTransformStyle, floorplanData];
|
|
256
|
+
return [northDesc, northRad, compassTransformStyle, floorplanData];
|
|
221
257
|
}
|
|
222
258
|
|
|
223
259
|
class Compass extends internal.SvelteComponent {
|
|
224
260
|
constructor(options) {
|
|
225
261
|
super();
|
|
226
|
-
internal.init(this, options, instance$f, create_fragment$f, internal.safe_not_equal, { floorplanData:
|
|
262
|
+
internal.init(this, options, instance$f, create_fragment$f, internal.safe_not_equal, { floorplanData: 3, northDesc: 0 }, add_css$b);
|
|
227
263
|
}
|
|
228
264
|
}
|
|
229
265
|
|
|
@@ -365,7 +401,9 @@ function instance$e($$self, $$props, $$invalidate) {
|
|
|
365
401
|
|
|
366
402
|
$$self.$$.update = () => {
|
|
367
403
|
if ($$self.$$.dirty & /*getLabelElement, room*/ 3) {
|
|
368
|
-
$$invalidate(2, userConfigElement = getLabelElement
|
|
404
|
+
$$invalidate(2, userConfigElement = getLabelElement === null || getLabelElement === void 0
|
|
405
|
+
? void 0
|
|
406
|
+
: getLabelElement(room));
|
|
369
407
|
}
|
|
370
408
|
};
|
|
371
409
|
|
|
@@ -1230,7 +1268,7 @@ function add_css$5(target) {
|
|
|
1230
1268
|
internal.append_styles(target, "svelte-126ja8e", ".floorplan-plugin__base-image.svelte-126ja8e{position:absolute;z-index:10;width:100%;height:100%;pointer-events:none}");
|
|
1231
1269
|
}
|
|
1232
1270
|
|
|
1233
|
-
// (
|
|
1271
|
+
// (13:22)
|
|
1234
1272
|
function create_if_block_1$3(ctx) {
|
|
1235
1273
|
let normalimage;
|
|
1236
1274
|
let current;
|
|
@@ -1264,7 +1302,7 @@ function create_if_block_1$3(ctx) {
|
|
|
1264
1302
|
};
|
|
1265
1303
|
}
|
|
1266
1304
|
|
|
1267
|
-
// (
|
|
1305
|
+
// (11:2) {#if svgContent}
|
|
1268
1306
|
function create_if_block$3(ctx) {
|
|
1269
1307
|
let svgimage;
|
|
1270
1308
|
let current;
|
|
@@ -1392,6 +1430,7 @@ function create_fragment$8(ctx) {
|
|
|
1392
1430
|
function instance$8($$self, $$props, $$invalidate) {
|
|
1393
1431
|
let imageData;
|
|
1394
1432
|
let svgContent;
|
|
1433
|
+
var _a, _b;
|
|
1395
1434
|
let { floorIndex } = $$props;
|
|
1396
1435
|
let { floorplanData } = $$props;
|
|
1397
1436
|
|
|
@@ -1405,12 +1444,16 @@ function instance$8($$self, $$props, $$invalidate) {
|
|
|
1405
1444
|
$$invalidate(1, imageData = floorplanData.outlines[floorIndex]);
|
|
1406
1445
|
}
|
|
1407
1446
|
|
|
1408
|
-
if ($$self.$$.dirty & /*floorplanData, floorIndex*/
|
|
1409
|
-
$$invalidate(0, svgContent = floorplanData.outlines
|
|
1447
|
+
if ($$self.$$.dirty & /*floorplanData, _a, floorIndex, _b*/ 60) {
|
|
1448
|
+
$$invalidate(0, svgContent = $$invalidate(5, _b = $$invalidate(4, _a = floorplanData.outlines) === null || _a === void 0
|
|
1449
|
+
? void 0
|
|
1450
|
+
: _a[floorIndex]) === null || _b === void 0
|
|
1451
|
+
? void 0
|
|
1452
|
+
: _b.svgContent);
|
|
1410
1453
|
}
|
|
1411
1454
|
};
|
|
1412
1455
|
|
|
1413
|
-
return [svgContent, imageData, floorIndex, floorplanData];
|
|
1456
|
+
return [svgContent, imageData, floorIndex, floorplanData, _a, _b];
|
|
1414
1457
|
}
|
|
1415
1458
|
|
|
1416
1459
|
class BaseImage extends internal.SvelteComponent {
|
|
@@ -1431,7 +1474,7 @@ function pathD(points, options = {}) {
|
|
|
1431
1474
|
d += 'M' + point;
|
|
1432
1475
|
return d;
|
|
1433
1476
|
}
|
|
1434
|
-
if (needA
|
|
1477
|
+
if (needA === null || needA === void 0 ? void 0 : needA[index]) {
|
|
1435
1478
|
d += 'A' + needA[index] + ',' + point;
|
|
1436
1479
|
return d;
|
|
1437
1480
|
}
|
|
@@ -1722,7 +1765,7 @@ function get_each_context$1(ctx, list, i) {
|
|
|
1722
1765
|
return child_ctx;
|
|
1723
1766
|
}
|
|
1724
1767
|
|
|
1725
|
-
// (
|
|
1768
|
+
// (18:6) {:else}
|
|
1726
1769
|
function create_else_block(ctx) {
|
|
1727
1770
|
let roommaterial_1;
|
|
1728
1771
|
let current;
|
|
@@ -1756,7 +1799,7 @@ function create_else_block(ctx) {
|
|
|
1756
1799
|
};
|
|
1757
1800
|
}
|
|
1758
1801
|
|
|
1759
|
-
// (
|
|
1802
|
+
// (16:37)
|
|
1760
1803
|
function create_if_block_1$2(ctx) {
|
|
1761
1804
|
let roommaterial_2;
|
|
1762
1805
|
let current;
|
|
@@ -1790,7 +1833,7 @@ function create_if_block_1$2(ctx) {
|
|
|
1790
1833
|
};
|
|
1791
1834
|
}
|
|
1792
1835
|
|
|
1793
|
-
// (
|
|
1836
|
+
// (14:6) {#if room.floorType === 1}
|
|
1794
1837
|
function create_if_block$2(ctx) {
|
|
1795
1838
|
let roommaterial_0;
|
|
1796
1839
|
let current;
|
|
@@ -1824,7 +1867,7 @@ function create_if_block$2(ctx) {
|
|
|
1824
1867
|
};
|
|
1825
1868
|
}
|
|
1826
1869
|
|
|
1827
|
-
// (
|
|
1870
|
+
// (12:2) {#each rooms as room}
|
|
1828
1871
|
function create_each_block$1(ctx) {
|
|
1829
1872
|
let svg;
|
|
1830
1873
|
let current_block_type_index;
|
|
@@ -1996,8 +2039,7 @@ function instance$4($$self, $$props, $$invalidate) {
|
|
|
1996
2039
|
|
|
1997
2040
|
$$self.$$.update = () => {
|
|
1998
2041
|
if ($$self.$$.dirty & /*floorplanData, floorIndex, pxmm*/ 14) {
|
|
1999
|
-
$$invalidate(0, rooms = floorplanData.floorDatas[floorIndex].rooms.map(room => ({
|
|
2000
|
-
...room,
|
|
2042
|
+
$$invalidate(0, rooms = floorplanData.floorDatas[floorIndex].rooms.map(room => Object.assign(Object.assign({}, room), {
|
|
2001
2043
|
path: room.path.map(p => formatFloorplanPoint(p, pxmm, floorplanData.bounding))
|
|
2002
2044
|
})));
|
|
2003
2045
|
}
|
|
@@ -2245,7 +2287,9 @@ function instance$2($$self, $$props, $$invalidate) {
|
|
|
2245
2287
|
const { observers: floorplan_observers } = floorplanData;
|
|
2246
2288
|
|
|
2247
2289
|
const handleClick = function (e) {
|
|
2248
|
-
if (onRoomHeightClick
|
|
2290
|
+
if ((onRoomHeightClick === null || onRoomHeightClick === void 0
|
|
2291
|
+
? void 0
|
|
2292
|
+
: onRoomHeightClick(e)) === false) return;
|
|
2249
2293
|
|
|
2250
2294
|
// 因为 mouse.offsetX 的兼容性问题,手动计算 mouse offsetX offsetY
|
|
2251
2295
|
const boundingClientRect = highlightContainerDom.getBoundingClientRect();
|
|
@@ -2766,7 +2810,7 @@ function add_css(target) {
|
|
|
2766
2810
|
internal.append_styles(target, "svelte-177x2q7", ".floorplan-main.svelte-177x2q7{width:100%;height:100%}");
|
|
2767
2811
|
}
|
|
2768
2812
|
|
|
2769
|
-
// (
|
|
2813
|
+
// (24:0) {#if visible}
|
|
2770
2814
|
function create_if_block(ctx) {
|
|
2771
2815
|
let div;
|
|
2772
2816
|
let currentfloor;
|
|
@@ -2778,15 +2822,15 @@ function create_if_block(ctx) {
|
|
|
2778
2822
|
|
|
2779
2823
|
const currentfloor_spread_levels = [
|
|
2780
2824
|
{
|
|
2781
|
-
five: /*five*/ ctx[
|
|
2782
|
-
pxmm: /*pxmm*/ ctx[
|
|
2783
|
-
floorIndex: /*floorIndex*/ ctx[
|
|
2784
|
-
hoverEnable: /*hoverEnable*/ ctx[
|
|
2785
|
-
floorplanData: /*floorplanData*/ ctx[
|
|
2786
|
-
getLabelElement: /*getLabelElement*/ ctx[
|
|
2787
|
-
roomLabelsEnable: /*roomLabelsEnable*/ ctx[
|
|
2788
|
-
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[
|
|
2789
|
-
onRoomHeightClick: /*onRoomHeightClick*/ ctx[
|
|
2825
|
+
five: /*five*/ ctx[2],
|
|
2826
|
+
pxmm: /*pxmm*/ ctx[1],
|
|
2827
|
+
floorIndex: /*floorIndex*/ ctx[6],
|
|
2828
|
+
hoverEnable: /*hoverEnable*/ ctx[7],
|
|
2829
|
+
floorplanData: /*floorplanData*/ ctx[11],
|
|
2830
|
+
getLabelElement: /*getLabelElement*/ ctx[15],
|
|
2831
|
+
roomLabelsEnable: /*roomLabelsEnable*/ ctx[9],
|
|
2832
|
+
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[10],
|
|
2833
|
+
onRoomHeightClick: /*onRoomHeightClick*/ ctx[14]
|
|
2790
2834
|
}
|
|
2791
2835
|
];
|
|
2792
2836
|
|
|
@@ -2800,10 +2844,10 @@ function create_if_block(ctx) {
|
|
|
2800
2844
|
|
|
2801
2845
|
const camera_spread_levels = [
|
|
2802
2846
|
{
|
|
2803
|
-
panoIndex: /*panoIndex*/ ctx[
|
|
2804
|
-
floorplanData: /*floorplanData*/ ctx[
|
|
2805
|
-
lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[
|
|
2806
|
-
cameraImageUrl: /*cameraImageUrl*/ ctx[
|
|
2847
|
+
panoIndex: /*panoIndex*/ ctx[5],
|
|
2848
|
+
floorplanData: /*floorplanData*/ ctx[11],
|
|
2849
|
+
lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[12],
|
|
2850
|
+
cameraImageUrl: /*cameraImageUrl*/ ctx[13]
|
|
2807
2851
|
}
|
|
2808
2852
|
];
|
|
2809
2853
|
|
|
@@ -2814,7 +2858,7 @@ function create_if_block(ctx) {
|
|
|
2814
2858
|
}
|
|
2815
2859
|
|
|
2816
2860
|
camera = new Camera({ props: camera_props });
|
|
2817
|
-
let if_block = /*compassEnable*/ ctx[
|
|
2861
|
+
let if_block = /*compassEnable*/ ctx[8] && create_if_block_1(ctx);
|
|
2818
2862
|
|
|
2819
2863
|
return {
|
|
2820
2864
|
c() {
|
|
@@ -2838,42 +2882,42 @@ function create_if_block(ctx) {
|
|
|
2838
2882
|
p(new_ctx, dirty) {
|
|
2839
2883
|
ctx = new_ctx;
|
|
2840
2884
|
|
|
2841
|
-
const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, onRoomHeightClick*/
|
|
2885
|
+
const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, onRoomHeightClick*/ 52934)
|
|
2842
2886
|
? internal.get_spread_update(currentfloor_spread_levels, [
|
|
2843
2887
|
{
|
|
2844
|
-
five: /*five*/ ctx[
|
|
2845
|
-
pxmm: /*pxmm*/ ctx[
|
|
2846
|
-
floorIndex: /*floorIndex*/ ctx[
|
|
2847
|
-
hoverEnable: /*hoverEnable*/ ctx[
|
|
2848
|
-
floorplanData: /*floorplanData*/ ctx[
|
|
2849
|
-
getLabelElement: /*getLabelElement*/ ctx[
|
|
2850
|
-
roomLabelsEnable: /*roomLabelsEnable*/ ctx[
|
|
2851
|
-
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[
|
|
2852
|
-
onRoomHeightClick: /*onRoomHeightClick*/ ctx[
|
|
2888
|
+
five: /*five*/ ctx[2],
|
|
2889
|
+
pxmm: /*pxmm*/ ctx[1],
|
|
2890
|
+
floorIndex: /*floorIndex*/ ctx[6],
|
|
2891
|
+
hoverEnable: /*hoverEnable*/ ctx[7],
|
|
2892
|
+
floorplanData: /*floorplanData*/ ctx[11],
|
|
2893
|
+
getLabelElement: /*getLabelElement*/ ctx[15],
|
|
2894
|
+
roomLabelsEnable: /*roomLabelsEnable*/ ctx[9],
|
|
2895
|
+
ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[10],
|
|
2896
|
+
onRoomHeightClick: /*onRoomHeightClick*/ ctx[14]
|
|
2853
2897
|
}
|
|
2854
2898
|
])
|
|
2855
2899
|
: {};
|
|
2856
2900
|
|
|
2857
2901
|
currentfloor.$set(currentfloor_changes);
|
|
2858
2902
|
|
|
2859
|
-
const camera_changes = (dirty & /*panoIndex, floorplanData, lastPanoramaLongitude, cameraImageUrl*/
|
|
2903
|
+
const camera_changes = (dirty & /*panoIndex, floorplanData, lastPanoramaLongitude, cameraImageUrl*/ 14368)
|
|
2860
2904
|
? internal.get_spread_update(camera_spread_levels, [
|
|
2861
2905
|
{
|
|
2862
|
-
panoIndex: /*panoIndex*/ ctx[
|
|
2863
|
-
floorplanData: /*floorplanData*/ ctx[
|
|
2864
|
-
lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[
|
|
2865
|
-
cameraImageUrl: /*cameraImageUrl*/ ctx[
|
|
2906
|
+
panoIndex: /*panoIndex*/ ctx[5],
|
|
2907
|
+
floorplanData: /*floorplanData*/ ctx[11],
|
|
2908
|
+
lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[12],
|
|
2909
|
+
cameraImageUrl: /*cameraImageUrl*/ ctx[13]
|
|
2866
2910
|
}
|
|
2867
2911
|
])
|
|
2868
2912
|
: {};
|
|
2869
2913
|
|
|
2870
2914
|
camera.$set(camera_changes);
|
|
2871
2915
|
|
|
2872
|
-
if (/*compassEnable*/ ctx[
|
|
2916
|
+
if (/*compassEnable*/ ctx[8]) {
|
|
2873
2917
|
if (if_block) {
|
|
2874
2918
|
if_block.p(ctx, dirty);
|
|
2875
2919
|
|
|
2876
|
-
if (dirty & /*compassEnable*/
|
|
2920
|
+
if (dirty & /*compassEnable*/ 256) {
|
|
2877
2921
|
internal.transition_in(if_block, 1);
|
|
2878
2922
|
}
|
|
2879
2923
|
} else {
|
|
@@ -2901,7 +2945,7 @@ function create_if_block(ctx) {
|
|
|
2901
2945
|
if (!div_intro) {
|
|
2902
2946
|
internal.add_render_callback(() => {
|
|
2903
2947
|
div_intro = internal.create_in_transition(div, transition.fade, {
|
|
2904
|
-
duration: /*duration*/ ctx[
|
|
2948
|
+
duration: /*duration*/ ctx[3],
|
|
2905
2949
|
easing: easing.linear
|
|
2906
2950
|
});
|
|
2907
2951
|
|
|
@@ -2926,13 +2970,16 @@ function create_if_block(ctx) {
|
|
|
2926
2970
|
};
|
|
2927
2971
|
}
|
|
2928
2972
|
|
|
2929
|
-
// (
|
|
2973
|
+
// (40:4) {#if compassEnable}
|
|
2930
2974
|
function create_if_block_1(ctx) {
|
|
2931
2975
|
let compass;
|
|
2932
2976
|
let current;
|
|
2933
2977
|
|
|
2934
2978
|
compass = new Compass({
|
|
2935
|
-
props: {
|
|
2979
|
+
props: {
|
|
2980
|
+
floorplanData: /*floorplanData*/ ctx[11],
|
|
2981
|
+
northDesc: /*northDesc*/ ctx[0]
|
|
2982
|
+
}
|
|
2936
2983
|
});
|
|
2937
2984
|
|
|
2938
2985
|
return {
|
|
@@ -2945,7 +2992,8 @@ function create_if_block_1(ctx) {
|
|
|
2945
2992
|
},
|
|
2946
2993
|
p(ctx, dirty) {
|
|
2947
2994
|
const compass_changes = {};
|
|
2948
|
-
if (dirty & /*floorplanData*/
|
|
2995
|
+
if (dirty & /*floorplanData*/ 2048) compass_changes.floorplanData = /*floorplanData*/ ctx[11];
|
|
2996
|
+
if (dirty & /*northDesc*/ 1) compass_changes.northDesc = /*northDesc*/ ctx[0];
|
|
2949
2997
|
compass.$set(compass_changes);
|
|
2950
2998
|
},
|
|
2951
2999
|
i(local) {
|
|
@@ -2966,7 +3014,7 @@ function create_if_block_1(ctx) {
|
|
|
2966
3014
|
function create_fragment(ctx) {
|
|
2967
3015
|
let if_block_anchor;
|
|
2968
3016
|
let current;
|
|
2969
|
-
let if_block = /*visible*/ ctx[
|
|
3017
|
+
let if_block = /*visible*/ ctx[4] && create_if_block(ctx);
|
|
2970
3018
|
|
|
2971
3019
|
return {
|
|
2972
3020
|
c() {
|
|
@@ -2979,11 +3027,11 @@ function create_fragment(ctx) {
|
|
|
2979
3027
|
current = true;
|
|
2980
3028
|
},
|
|
2981
3029
|
p(ctx, [dirty]) {
|
|
2982
|
-
if (/*visible*/ ctx[
|
|
3030
|
+
if (/*visible*/ ctx[4]) {
|
|
2983
3031
|
if (if_block) {
|
|
2984
3032
|
if_block.p(ctx, dirty);
|
|
2985
3033
|
|
|
2986
|
-
if (dirty & /*visible*/
|
|
3034
|
+
if (dirty & /*visible*/ 16) {
|
|
2987
3035
|
internal.transition_in(if_block, 1);
|
|
2988
3036
|
}
|
|
2989
3037
|
} else {
|
|
@@ -3019,6 +3067,7 @@ function create_fragment(ctx) {
|
|
|
3019
3067
|
}
|
|
3020
3068
|
|
|
3021
3069
|
function instance($$self, $$props, $$invalidate) {
|
|
3070
|
+
let { northDesc } = $$props;
|
|
3022
3071
|
let { pxmm } = $$props;
|
|
3023
3072
|
let { five } = $$props;
|
|
3024
3073
|
let { duration = 0 } = $$props;
|
|
@@ -3036,24 +3085,26 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
3036
3085
|
let { getLabelElement } = $$props;
|
|
3037
3086
|
|
|
3038
3087
|
$$self.$$set = $$props => {
|
|
3039
|
-
if ('
|
|
3040
|
-
if ('
|
|
3041
|
-
if ('
|
|
3042
|
-
if ('
|
|
3043
|
-
if ('
|
|
3044
|
-
if ('
|
|
3045
|
-
if ('
|
|
3046
|
-
if ('
|
|
3047
|
-
if ('
|
|
3048
|
-
if ('
|
|
3049
|
-
if ('
|
|
3050
|
-
if ('
|
|
3051
|
-
if ('
|
|
3052
|
-
if ('
|
|
3053
|
-
if ('
|
|
3088
|
+
if ('northDesc' in $$props) $$invalidate(0, northDesc = $$props.northDesc);
|
|
3089
|
+
if ('pxmm' in $$props) $$invalidate(1, pxmm = $$props.pxmm);
|
|
3090
|
+
if ('five' in $$props) $$invalidate(2, five = $$props.five);
|
|
3091
|
+
if ('duration' in $$props) $$invalidate(3, duration = $$props.duration);
|
|
3092
|
+
if ('visible' in $$props) $$invalidate(4, visible = $$props.visible);
|
|
3093
|
+
if ('panoIndex' in $$props) $$invalidate(5, panoIndex = $$props.panoIndex);
|
|
3094
|
+
if ('floorIndex' in $$props) $$invalidate(6, floorIndex = $$props.floorIndex);
|
|
3095
|
+
if ('hoverEnable' in $$props) $$invalidate(7, hoverEnable = $$props.hoverEnable);
|
|
3096
|
+
if ('compassEnable' in $$props) $$invalidate(8, compassEnable = $$props.compassEnable);
|
|
3097
|
+
if ('roomLabelsEnable' in $$props) $$invalidate(9, roomLabelsEnable = $$props.roomLabelsEnable);
|
|
3098
|
+
if ('ruleLabelsEnable' in $$props) $$invalidate(10, ruleLabelsEnable = $$props.ruleLabelsEnable);
|
|
3099
|
+
if ('floorplanData' in $$props) $$invalidate(11, floorplanData = $$props.floorplanData);
|
|
3100
|
+
if ('lastPanoramaLongitude' in $$props) $$invalidate(12, lastPanoramaLongitude = $$props.lastPanoramaLongitude);
|
|
3101
|
+
if ('cameraImageUrl' in $$props) $$invalidate(13, cameraImageUrl = $$props.cameraImageUrl);
|
|
3102
|
+
if ('onRoomHeightClick' in $$props) $$invalidate(14, onRoomHeightClick = $$props.onRoomHeightClick);
|
|
3103
|
+
if ('getLabelElement' in $$props) $$invalidate(15, getLabelElement = $$props.getLabelElement);
|
|
3054
3104
|
};
|
|
3055
3105
|
|
|
3056
3106
|
return [
|
|
3107
|
+
northDesc,
|
|
3057
3108
|
pxmm,
|
|
3058
3109
|
five,
|
|
3059
3110
|
duration,
|
|
@@ -3083,21 +3134,22 @@ class Main extends internal.SvelteComponent {
|
|
|
3083
3134
|
create_fragment,
|
|
3084
3135
|
internal.safe_not_equal,
|
|
3085
3136
|
{
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3137
|
+
northDesc: 0,
|
|
3138
|
+
pxmm: 1,
|
|
3139
|
+
five: 2,
|
|
3140
|
+
duration: 3,
|
|
3141
|
+
visible: 4,
|
|
3142
|
+
panoIndex: 5,
|
|
3143
|
+
floorIndex: 6,
|
|
3144
|
+
hoverEnable: 7,
|
|
3145
|
+
compassEnable: 8,
|
|
3146
|
+
roomLabelsEnable: 9,
|
|
3147
|
+
ruleLabelsEnable: 10,
|
|
3148
|
+
floorplanData: 11,
|
|
3149
|
+
lastPanoramaLongitude: 12,
|
|
3150
|
+
cameraImageUrl: 13,
|
|
3151
|
+
onRoomHeightClick: 14,
|
|
3152
|
+
getLabelElement: 15
|
|
3101
3153
|
},
|
|
3102
3154
|
add_css
|
|
3103
3155
|
);
|
|
@@ -3110,34 +3162,40 @@ class Main extends internal.SvelteComponent {
|
|
|
3110
3162
|
* 有异常,则返回 [Error, undefined]
|
|
3111
3163
|
* 用于替代 try&catch 处理 await 异常的方案
|
|
3112
3164
|
*/
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3165
|
+
function to(promise) {
|
|
3166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3167
|
+
try {
|
|
3168
|
+
const data = yield promise;
|
|
3169
|
+
return [null, data];
|
|
3170
|
+
}
|
|
3171
|
+
catch (error) {
|
|
3172
|
+
if (error instanceof Error)
|
|
3173
|
+
return [error, null];
|
|
3174
|
+
return [new Error(''), null];
|
|
3175
|
+
}
|
|
3176
|
+
});
|
|
3123
3177
|
}
|
|
3124
3178
|
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
const
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3179
|
+
function formatOutlines(outlines) {
|
|
3180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3181
|
+
const headers = new Headers({ 'Content-Type': 'text/plain' });
|
|
3182
|
+
const getOutlineItem = function (item) {
|
|
3183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3184
|
+
const outlineItem = {
|
|
3185
|
+
index: item.index,
|
|
3186
|
+
url: item.url,
|
|
3187
|
+
svgUrl: item.svg_url,
|
|
3188
|
+
};
|
|
3189
|
+
if (item.svg_url) {
|
|
3190
|
+
const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
|
|
3191
|
+
outlineItem.svgContent = svgContent;
|
|
3192
|
+
}
|
|
3193
|
+
return outlineItem;
|
|
3194
|
+
});
|
|
3132
3195
|
};
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
}
|
|
3137
|
-
return outlineItem;
|
|
3138
|
-
};
|
|
3139
|
-
const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
|
|
3140
|
-
return svgOutlineItems;
|
|
3196
|
+
const svgOutlineItems = yield Promise.all(outlines.map(getOutlineItem));
|
|
3197
|
+
return svgOutlineItems;
|
|
3198
|
+
});
|
|
3141
3199
|
}
|
|
3142
3200
|
function formatRoom(data) {
|
|
3143
3201
|
const floorplanRoomItem = {
|
|
@@ -3183,19 +3241,21 @@ function formatFloorplanEntrance(data) {
|
|
|
3183
3241
|
};
|
|
3184
3242
|
return floorplanEntrance;
|
|
3185
3243
|
}
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3244
|
+
function formatData(data) {
|
|
3245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3246
|
+
const outlines = yield formatOutlines(data.outlines);
|
|
3247
|
+
const bounding = data.computed_data.bounding;
|
|
3248
|
+
const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
|
|
3249
|
+
const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
|
|
3250
|
+
const floorplanData = {
|
|
3251
|
+
outlines,
|
|
3252
|
+
entrance,
|
|
3253
|
+
bounding,
|
|
3254
|
+
floorDatas,
|
|
3255
|
+
observers: data.computed_data.observers.map(formateFloorplanObserver),
|
|
3256
|
+
};
|
|
3257
|
+
return floorplanData;
|
|
3258
|
+
});
|
|
3199
3259
|
}
|
|
3200
3260
|
|
|
3201
3261
|
/**
|
|
@@ -3326,7 +3386,7 @@ function getPxmm(five, container, floorIndex, options) {
|
|
|
3326
3386
|
function getY() {
|
|
3327
3387
|
const currentFloorY = getFloorY(floorIndex);
|
|
3328
3388
|
const nextFloorY = getFloorY(floorIndex + 1);
|
|
3329
|
-
const attachedTo = options
|
|
3389
|
+
const attachedTo = (options === null || options === void 0 ? void 0 : options.attachedTo) || FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER;
|
|
3330
3390
|
if (attachedTo === FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
|
|
3331
3391
|
return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
|
|
3332
3392
|
else if (attachedTo === FLOOR_PLAN_ATTACHED_TO.CEILING)
|
|
@@ -3343,18 +3403,20 @@ function getPxmm(five, container, floorIndex, options) {
|
|
|
3343
3403
|
return pxmm;
|
|
3344
3404
|
}
|
|
3345
3405
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3406
|
+
function changeMode(five, ...changeModeParams) {
|
|
3407
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3408
|
+
const [changeModeError] = yield to(five.changeMode(...changeModeParams));
|
|
3409
|
+
if (changeModeError)
|
|
3410
|
+
throw changeModeError;
|
|
3411
|
+
yield new Promise((reslove, reject) => {
|
|
3412
|
+
five.once('initAnimationEnded', reslove);
|
|
3413
|
+
const handleModeChange = (mode) => {
|
|
3414
|
+
if (mode !== changeModeParams[0])
|
|
3415
|
+
reject('changeMode 被中断');
|
|
3416
|
+
five.off('modeChange', handleModeChange);
|
|
3417
|
+
};
|
|
3418
|
+
five.on('modeChange', handleModeChange);
|
|
3419
|
+
});
|
|
3358
3420
|
});
|
|
3359
3421
|
}
|
|
3360
3422
|
|
|
@@ -3399,30 +3461,32 @@ function checkShowState(five$1, showState) {
|
|
|
3399
3461
|
* 2. 内置了相应的动画时间计算
|
|
3400
3462
|
* 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
|
|
3401
3463
|
*/
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
if (result === true)
|
|
3406
|
-
return;
|
|
3407
|
-
// 纠正 mode
|
|
3408
|
-
if (five$1.currentMode !== five.Five.Mode.Floorplan) {
|
|
3409
|
-
const [changeModeError] = await to(changeMode(five$1, five.Five.Mode.Floorplan, showState, undefined, userAction));
|
|
3410
|
-
if (changeModeError)
|
|
3411
|
-
throw changeModeError;
|
|
3412
|
-
// changeMode 是异步行为,可能会被打断,需要在结束后加一次判断
|
|
3464
|
+
function correctFiveState(five$1, showState, userAction = true) {
|
|
3465
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3466
|
+
// 当前已满足状态,不需要变更
|
|
3413
3467
|
const result = checkShowState(five$1, showState);
|
|
3414
|
-
if (result ===
|
|
3415
|
-
|
|
3468
|
+
if (result === true)
|
|
3469
|
+
return;
|
|
3470
|
+
// 纠正 mode
|
|
3471
|
+
if (five$1.currentMode !== five.Five.Mode.Floorplan) {
|
|
3472
|
+
const [changeModeError] = yield to(changeMode(five$1, five.Five.Mode.Floorplan, showState, undefined, userAction));
|
|
3473
|
+
if (changeModeError)
|
|
3474
|
+
throw changeModeError;
|
|
3475
|
+
// changeMode 是异步行为,可能会被打断,需要在结束后加一次判断
|
|
3476
|
+
const result = checkShowState(five$1, showState);
|
|
3477
|
+
if (result === false)
|
|
3478
|
+
throw new Error(FloorplanErrorType.ChangeModeError);
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
// 纠正相机状态
|
|
3482
|
+
// 根据 latitude、longitude、fov 计算动画时间,最多 1s
|
|
3483
|
+
const { latitude, longitude, fov } = five$1.getCurrentState();
|
|
3484
|
+
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));
|
|
3485
|
+
const [updateCameraError] = yield to(five$1.updateCamera(showState, time, userAction));
|
|
3486
|
+
if (updateCameraError)
|
|
3487
|
+
throw new Error(FloorplanErrorType.UpdateCameraError);
|
|
3416
3488
|
return;
|
|
3417
|
-
}
|
|
3418
|
-
// 纠正相机状态
|
|
3419
|
-
// 根据 latitude、longitude、fov 计算动画时间,最多 1s
|
|
3420
|
-
const { latitude, longitude, fov } = five$1.getCurrentState();
|
|
3421
|
-
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));
|
|
3422
|
-
const [updateCameraError] = await to(five$1.updateCamera(showState, time, userAction));
|
|
3423
|
-
if (updateCameraError)
|
|
3424
|
-
throw new Error(FloorplanErrorType.UpdateCameraError);
|
|
3425
|
-
return;
|
|
3489
|
+
});
|
|
3426
3490
|
}
|
|
3427
3491
|
|
|
3428
3492
|
function changeModelCanvasOpacity(five, opacity, duration = 300) {
|
|
@@ -3472,35 +3536,446 @@ function omit(object, props) {
|
|
|
3472
3536
|
|
|
3473
3537
|
const MODEL_FLOORPLAN_PLUGIN_NAME = 'modelFloorplanPlugin';
|
|
3474
3538
|
class ModelFloorplanPluginController {
|
|
3475
|
-
name = MODEL_FLOORPLAN_PLUGIN_NAME;
|
|
3476
|
-
/** 用于绑定事件钩子 */
|
|
3477
|
-
hooks;
|
|
3478
|
-
/** 展示状态 */
|
|
3479
|
-
visible = false;
|
|
3480
|
-
/** 户型图大小 */
|
|
3481
|
-
size = { width: 0, height: 0 };
|
|
3482
|
-
app = undefined;
|
|
3483
|
-
pxmm = 0;
|
|
3484
|
-
five;
|
|
3485
|
-
panoIndex = 0;
|
|
3486
|
-
floorIndex = 0;
|
|
3487
|
-
configs = {};
|
|
3488
|
-
lastPanoramaLongitude = 0;
|
|
3489
|
-
selector;
|
|
3490
|
-
floorplanData;
|
|
3491
|
-
wrapper;
|
|
3492
|
-
container = document.createElement('div');
|
|
3493
|
-
showState;
|
|
3494
|
-
/** 记录上次 show 的参数,如果不一致,需要 reject 掉正在进行的 showPromise */
|
|
3495
|
-
ModelFloorplanPluginsShowOpts;
|
|
3496
|
-
showPromise;
|
|
3497
|
-
showRejection;
|
|
3498
3539
|
constructor(five$1, params) {
|
|
3540
|
+
var _a;
|
|
3541
|
+
Object.defineProperty(this, "name", {
|
|
3542
|
+
enumerable: true,
|
|
3543
|
+
configurable: true,
|
|
3544
|
+
writable: true,
|
|
3545
|
+
value: MODEL_FLOORPLAN_PLUGIN_NAME
|
|
3546
|
+
});
|
|
3547
|
+
/** 用于绑定事件钩子 */
|
|
3548
|
+
Object.defineProperty(this, "hooks", {
|
|
3549
|
+
enumerable: true,
|
|
3550
|
+
configurable: true,
|
|
3551
|
+
writable: true,
|
|
3552
|
+
value: void 0
|
|
3553
|
+
});
|
|
3554
|
+
/** 展示状态 */
|
|
3555
|
+
Object.defineProperty(this, "visible", {
|
|
3556
|
+
enumerable: true,
|
|
3557
|
+
configurable: true,
|
|
3558
|
+
writable: true,
|
|
3559
|
+
value: false
|
|
3560
|
+
});
|
|
3561
|
+
/** 户型图大小 */
|
|
3562
|
+
Object.defineProperty(this, "size", {
|
|
3563
|
+
enumerable: true,
|
|
3564
|
+
configurable: true,
|
|
3565
|
+
writable: true,
|
|
3566
|
+
value: { width: 0, height: 0 }
|
|
3567
|
+
});
|
|
3568
|
+
Object.defineProperty(this, "app", {
|
|
3569
|
+
enumerable: true,
|
|
3570
|
+
configurable: true,
|
|
3571
|
+
writable: true,
|
|
3572
|
+
value: undefined
|
|
3573
|
+
});
|
|
3574
|
+
Object.defineProperty(this, "pxmm", {
|
|
3575
|
+
enumerable: true,
|
|
3576
|
+
configurable: true,
|
|
3577
|
+
writable: true,
|
|
3578
|
+
value: 0
|
|
3579
|
+
});
|
|
3580
|
+
Object.defineProperty(this, "five", {
|
|
3581
|
+
enumerable: true,
|
|
3582
|
+
configurable: true,
|
|
3583
|
+
writable: true,
|
|
3584
|
+
value: void 0
|
|
3585
|
+
});
|
|
3586
|
+
Object.defineProperty(this, "panoIndex", {
|
|
3587
|
+
enumerable: true,
|
|
3588
|
+
configurable: true,
|
|
3589
|
+
writable: true,
|
|
3590
|
+
value: 0
|
|
3591
|
+
});
|
|
3592
|
+
Object.defineProperty(this, "floorIndex", {
|
|
3593
|
+
enumerable: true,
|
|
3594
|
+
configurable: true,
|
|
3595
|
+
writable: true,
|
|
3596
|
+
value: 0
|
|
3597
|
+
});
|
|
3598
|
+
Object.defineProperty(this, "configs", {
|
|
3599
|
+
enumerable: true,
|
|
3600
|
+
configurable: true,
|
|
3601
|
+
writable: true,
|
|
3602
|
+
value: {}
|
|
3603
|
+
});
|
|
3604
|
+
Object.defineProperty(this, "lastPanoramaLongitude", {
|
|
3605
|
+
enumerable: true,
|
|
3606
|
+
configurable: true,
|
|
3607
|
+
writable: true,
|
|
3608
|
+
value: 0
|
|
3609
|
+
});
|
|
3610
|
+
Object.defineProperty(this, "selector", {
|
|
3611
|
+
enumerable: true,
|
|
3612
|
+
configurable: true,
|
|
3613
|
+
writable: true,
|
|
3614
|
+
value: void 0
|
|
3615
|
+
});
|
|
3616
|
+
Object.defineProperty(this, "floorplanData", {
|
|
3617
|
+
enumerable: true,
|
|
3618
|
+
configurable: true,
|
|
3619
|
+
writable: true,
|
|
3620
|
+
value: void 0
|
|
3621
|
+
});
|
|
3622
|
+
Object.defineProperty(this, "wrapper", {
|
|
3623
|
+
enumerable: true,
|
|
3624
|
+
configurable: true,
|
|
3625
|
+
writable: true,
|
|
3626
|
+
value: void 0
|
|
3627
|
+
});
|
|
3628
|
+
Object.defineProperty(this, "container", {
|
|
3629
|
+
enumerable: true,
|
|
3630
|
+
configurable: true,
|
|
3631
|
+
writable: true,
|
|
3632
|
+
value: document.createElement('div')
|
|
3633
|
+
});
|
|
3634
|
+
Object.defineProperty(this, "showState", {
|
|
3635
|
+
enumerable: true,
|
|
3636
|
+
configurable: true,
|
|
3637
|
+
writable: true,
|
|
3638
|
+
value: void 0
|
|
3639
|
+
});
|
|
3640
|
+
/** 记录上次 show 的参数,如果不一致,需要 reject 掉正在进行的 showPromise */
|
|
3641
|
+
Object.defineProperty(this, "ModelFloorplanPluginsShowOpts", {
|
|
3642
|
+
enumerable: true,
|
|
3643
|
+
configurable: true,
|
|
3644
|
+
writable: true,
|
|
3645
|
+
value: void 0
|
|
3646
|
+
});
|
|
3647
|
+
Object.defineProperty(this, "showPromise", {
|
|
3648
|
+
enumerable: true,
|
|
3649
|
+
configurable: true,
|
|
3650
|
+
writable: true,
|
|
3651
|
+
value: void 0
|
|
3652
|
+
});
|
|
3653
|
+
Object.defineProperty(this, "showRejection", {
|
|
3654
|
+
enumerable: true,
|
|
3655
|
+
configurable: true,
|
|
3656
|
+
writable: true,
|
|
3657
|
+
value: void 0
|
|
3658
|
+
});
|
|
3659
|
+
Object.defineProperty(this, "dispose", {
|
|
3660
|
+
enumerable: true,
|
|
3661
|
+
configurable: true,
|
|
3662
|
+
writable: true,
|
|
3663
|
+
value: () => {
|
|
3664
|
+
var _a, _b;
|
|
3665
|
+
const five = this.five;
|
|
3666
|
+
this.hide();
|
|
3667
|
+
(_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
3668
|
+
(_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
|
|
3669
|
+
five.off('modelLoaded', this.handleModelLoaded);
|
|
3670
|
+
five.off('modeChange', this.handleModeChange);
|
|
3671
|
+
five.off('panGesture', this.handlePanGesture);
|
|
3672
|
+
five.off('panoArrived', this.handlePanoArrived);
|
|
3673
|
+
five.off('wantsChangeMode', this.handleWantsChangeMode);
|
|
3674
|
+
five.off('wantsInteriaPan', this.handleWantsInteriaPan);
|
|
3675
|
+
five.off('wantsTapGesture', this.handleWantsTapGesture);
|
|
3676
|
+
five.off('modelShownFloorChange', this.onModelShownFloorChange);
|
|
3677
|
+
}
|
|
3678
|
+
});
|
|
3679
|
+
/** 更新户型图大小 */
|
|
3680
|
+
Object.defineProperty(this, "updateSize", {
|
|
3681
|
+
enumerable: true,
|
|
3682
|
+
configurable: true,
|
|
3683
|
+
writable: true,
|
|
3684
|
+
value: () => {
|
|
3685
|
+
if (!this.floorplanData)
|
|
3686
|
+
return;
|
|
3687
|
+
if (!checkShowState(this.five, this.showState))
|
|
3688
|
+
return;
|
|
3689
|
+
if (!this.container || !this.wrapper)
|
|
3690
|
+
return;
|
|
3691
|
+
// 计算户型图展示大小
|
|
3692
|
+
const { min, max } = this.floorplanData.bounding;
|
|
3693
|
+
const width = max.x - min.x;
|
|
3694
|
+
const height = max.y - min.y;
|
|
3695
|
+
// 每毫米对应的 px 值
|
|
3696
|
+
const options = this.configs.attachedTo ? { attachedTo: this.configs.attachedTo } : undefined;
|
|
3697
|
+
const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
|
|
3698
|
+
const _width = Math.ceil(width * pxmm);
|
|
3699
|
+
const _height = Math.ceil(height * pxmm);
|
|
3700
|
+
if (this.size.width === _width && this.size.height === _height)
|
|
3701
|
+
return;
|
|
3702
|
+
this.pxmm = pxmm;
|
|
3703
|
+
this.size = { width: _width, height: _height };
|
|
3704
|
+
this.container.style.width = _width + 'px';
|
|
3705
|
+
this.container.style.height = _height + 'px';
|
|
3706
|
+
}
|
|
3707
|
+
});
|
|
3708
|
+
/** 展示户型图
|
|
3709
|
+
* 1. show 函数大部分情况下需要耗时
|
|
3710
|
+
* 2. 如果当前已经在展示中,将不会触发任何事件
|
|
3711
|
+
* 3. 如果展示过程被中断,将抛出错误
|
|
3712
|
+
* 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
|
|
3713
|
+
* 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
|
|
3714
|
+
* @param opts.floorIndex 楼层
|
|
3715
|
+
* @param opts.modelOpacity 模型透明度
|
|
3716
|
+
* @param opts.immediately 是否立即展示
|
|
3717
|
+
* @param opts.isAutoShow 是否是自动展示
|
|
3718
|
+
*/
|
|
3719
|
+
Object.defineProperty(this, "show", {
|
|
3720
|
+
enumerable: true,
|
|
3721
|
+
configurable: true,
|
|
3722
|
+
writable: true,
|
|
3723
|
+
value: (opts) => __awaiter(this, void 0, void 0, function* () {
|
|
3724
|
+
var _b, _c;
|
|
3725
|
+
// 已经在展示中了
|
|
3726
|
+
if (!this.showPromise && this.visible)
|
|
3727
|
+
return true;
|
|
3728
|
+
if (!((_b = this.five.model) === null || _b === void 0 ? void 0 : _b.loaded))
|
|
3729
|
+
throw new Error(FloorplanErrorType.ModelNotLoaded);
|
|
3730
|
+
if (!this.floorplanData)
|
|
3731
|
+
throw new Error(FloorplanErrorType.DataNotLoaded);
|
|
3732
|
+
this.visible = true;
|
|
3733
|
+
if (this.showPromise) {
|
|
3734
|
+
const sameWithLastOpts = equal(opts, this.ModelFloorplanPluginsShowOpts, { deep: false });
|
|
3735
|
+
if (!!this.showPromise && sameWithLastOpts)
|
|
3736
|
+
return this.showPromise;
|
|
3737
|
+
if (!!this.showPromise && !sameWithLastOpts)
|
|
3738
|
+
(_c = this.showRejection) === null || _c === void 0 ? void 0 : _c.call(this, FloorplanErrorType.DifferentShowParams);
|
|
3739
|
+
}
|
|
3740
|
+
this.ModelFloorplanPluginsShowOpts = opts;
|
|
3741
|
+
const getShowPromise = () => __awaiter(this, void 0, void 0, function* () {
|
|
3742
|
+
var _d, _e;
|
|
3743
|
+
let hasRejected = false;
|
|
3744
|
+
let externalErrorMsg;
|
|
3745
|
+
this.showRejection = (errorMsg) => {
|
|
3746
|
+
hasRejected = true;
|
|
3747
|
+
externalErrorMsg = errorMsg;
|
|
3748
|
+
};
|
|
3749
|
+
const [correctError] = yield to(correctFiveState(this.five, this.showState, opts === null || opts === void 0 ? void 0 : opts.userAction));
|
|
3750
|
+
if (correctError)
|
|
3751
|
+
throw correctError;
|
|
3752
|
+
// 异步结束要判断当前是不是被中断了,是不是调用了隐藏
|
|
3753
|
+
if (hasRejected)
|
|
3754
|
+
throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
|
|
3755
|
+
if (!this.visible)
|
|
3756
|
+
throw new Error(FloorplanErrorType.UnknownError);
|
|
3757
|
+
// 更新户型图状态
|
|
3758
|
+
this.visible = true;
|
|
3759
|
+
// 更新户型图大小
|
|
3760
|
+
this.updateSize();
|
|
3761
|
+
// 高亮当前楼层,有两个目的
|
|
3762
|
+
// 1. 点击模型时,可以跳转到当前楼层的点位上
|
|
3763
|
+
// 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
|
|
3764
|
+
if (opts === null || opts === void 0 ? void 0 : opts.floorIndex)
|
|
3765
|
+
this.floorIndex = opts.floorIndex;
|
|
3766
|
+
this.five.model.show(this.floorIndex);
|
|
3767
|
+
// 模型消失, 渲染户型图
|
|
3768
|
+
const modelOpacity = (_e = (_d = opts === null || opts === void 0 ? void 0 : opts.modelOpacity) !== null && _d !== void 0 ? _d : this.configs.modelOpacity) !== null && _e !== void 0 ? _e : 1;
|
|
3769
|
+
const renderDuration = (opts === null || opts === void 0 ? void 0 : opts.immediately) ? 0 : SHOW_ANIME_DURATION;
|
|
3770
|
+
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
3771
|
+
this.render(renderDuration);
|
|
3772
|
+
// 展示之后的事件监听
|
|
3773
|
+
this.five.on('wantsGesture', this.handleWantsGesture);
|
|
3774
|
+
this.five.on('wantsTapGesture', this.handleWantsTapGesture);
|
|
3775
|
+
return true;
|
|
3776
|
+
});
|
|
3777
|
+
const showPromise = getShowPromise()
|
|
3778
|
+
.then(() => {
|
|
3779
|
+
var _a;
|
|
3780
|
+
this.hooks.emit('showAnimationEnded', { auto: !!(opts === null || opts === void 0 ? void 0 : opts.isAutoShow), userAction: (_a = opts === null || opts === void 0 ? void 0 : opts.userAction) !== null && _a !== void 0 ? _a : true });
|
|
3781
|
+
return true;
|
|
3782
|
+
})
|
|
3783
|
+
.catch((error) => {
|
|
3784
|
+
// 自动展示的报错内部处理
|
|
3785
|
+
if (opts === null || opts === void 0 ? void 0 : opts.isAutoShow)
|
|
3786
|
+
return false;
|
|
3787
|
+
if (!(error instanceof Error))
|
|
3788
|
+
return false;
|
|
3789
|
+
// 非自动展示的报错继续向外抛出
|
|
3790
|
+
throw error;
|
|
3791
|
+
})
|
|
3792
|
+
.finally(() => {
|
|
3793
|
+
this.showPromise = undefined;
|
|
3794
|
+
this.showRejection = undefined;
|
|
3795
|
+
});
|
|
3796
|
+
this.showPromise = showPromise;
|
|
3797
|
+
return showPromise;
|
|
3798
|
+
})
|
|
3799
|
+
});
|
|
3800
|
+
/** 隐藏户型图 */
|
|
3801
|
+
Object.defineProperty(this, "hide", {
|
|
3802
|
+
enumerable: true,
|
|
3803
|
+
configurable: true,
|
|
3804
|
+
writable: true,
|
|
3805
|
+
value: (options) => {
|
|
3806
|
+
var _a, _b;
|
|
3807
|
+
if (this.size.width === 0)
|
|
3808
|
+
return true;
|
|
3809
|
+
if (this.visible === false)
|
|
3810
|
+
return true;
|
|
3811
|
+
const isAutoHide = !!(options === null || options === void 0 ? void 0 : options.isAutoHide);
|
|
3812
|
+
this.five.off('wantsGesture', this.handleWantsGesture);
|
|
3813
|
+
this.five.off('wantsTapGesture', this.handleWantsTapGesture);
|
|
3814
|
+
this.visible = false;
|
|
3815
|
+
(_a = this.showRejection) === null || _a === void 0 ? void 0 : _a.call(this, FloorplanErrorType.BreakOffByHide);
|
|
3816
|
+
changeModelCanvasOpacity(this.five, 1, 0);
|
|
3817
|
+
this.render();
|
|
3818
|
+
this.hooks.emit('hide', { auto: isAutoHide, userAction: (_b = options === null || options === void 0 ? void 0 : options.userAction) !== null && _b !== void 0 ? _b : true });
|
|
3819
|
+
return true;
|
|
3820
|
+
}
|
|
3821
|
+
});
|
|
3822
|
+
/** 模型楼层高亮改变时,自动进行楼层切换 */
|
|
3823
|
+
Object.defineProperty(this, "onModelShownFloorChange", {
|
|
3824
|
+
enumerable: true,
|
|
3825
|
+
configurable: true,
|
|
3826
|
+
writable: true,
|
|
3827
|
+
value: (shownFloor) => {
|
|
3828
|
+
if (shownFloor === null)
|
|
3829
|
+
return;
|
|
3830
|
+
this.floorIndex = shownFloor;
|
|
3831
|
+
this.updateSize();
|
|
3832
|
+
this.render();
|
|
3833
|
+
}
|
|
3834
|
+
});
|
|
3835
|
+
Object.defineProperty(this, "handleModelLoaded", {
|
|
3836
|
+
enumerable: true,
|
|
3837
|
+
configurable: true,
|
|
3838
|
+
writable: true,
|
|
3839
|
+
value: () => {
|
|
3840
|
+
if (this.wrapper)
|
|
3841
|
+
return;
|
|
3842
|
+
if (!this.selector)
|
|
3843
|
+
return;
|
|
3844
|
+
const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
|
|
3845
|
+
if (!wrapper)
|
|
3846
|
+
throw new Error('不正确的父容器选择器');
|
|
3847
|
+
this.wrapper = wrapper;
|
|
3848
|
+
wrapper.append(this.container);
|
|
3849
|
+
}
|
|
3850
|
+
});
|
|
3851
|
+
Object.defineProperty(this, "handleClick", {
|
|
3852
|
+
enumerable: true,
|
|
3853
|
+
configurable: true,
|
|
3854
|
+
writable: true,
|
|
3855
|
+
value: () => {
|
|
3856
|
+
if (!this.visible)
|
|
3857
|
+
return;
|
|
3858
|
+
const prevented = this.hooks.emit('click');
|
|
3859
|
+
if (prevented)
|
|
3860
|
+
return false;
|
|
3861
|
+
}
|
|
3862
|
+
});
|
|
3863
|
+
Object.defineProperty(this, "handleWantsTapGesture", {
|
|
3864
|
+
enumerable: true,
|
|
3865
|
+
configurable: true,
|
|
3866
|
+
writable: true,
|
|
3867
|
+
value: () => this.handleClick()
|
|
3868
|
+
});
|
|
3869
|
+
/** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
|
|
3870
|
+
Object.defineProperty(this, "handleWantsChangeMode", {
|
|
3871
|
+
enumerable: true,
|
|
3872
|
+
configurable: true,
|
|
3873
|
+
writable: true,
|
|
3874
|
+
value: (mode) => {
|
|
3875
|
+
if (mode !== 'Panorama') {
|
|
3876
|
+
this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
|
|
3877
|
+
}
|
|
3878
|
+
if (mode !== 'Floorplan')
|
|
3879
|
+
this.hide();
|
|
3880
|
+
}
|
|
3881
|
+
});
|
|
3882
|
+
/** 监听模型态变化,只有在模型态才进行手势动作监听 */
|
|
3883
|
+
Object.defineProperty(this, "handleModeChange", {
|
|
3884
|
+
enumerable: true,
|
|
3885
|
+
configurable: true,
|
|
3886
|
+
writable: true,
|
|
3887
|
+
value: (mode) => {
|
|
3888
|
+
if (mode === 'Floorplan') {
|
|
3889
|
+
this.five.on('panGesture', this.handlePanGesture);
|
|
3890
|
+
}
|
|
3891
|
+
else {
|
|
3892
|
+
this.hide();
|
|
3893
|
+
this.five.off('panGesture', this.handlePanGesture);
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
});
|
|
3897
|
+
/** panoIndex 改变时,更新 floorIndex */
|
|
3898
|
+
Object.defineProperty(this, "handlePanoArrived", {
|
|
3899
|
+
enumerable: true,
|
|
3900
|
+
configurable: true,
|
|
3901
|
+
writable: true,
|
|
3902
|
+
value: (index) => {
|
|
3903
|
+
var _a;
|
|
3904
|
+
if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
|
|
3905
|
+
return;
|
|
3906
|
+
this.panoIndex = index;
|
|
3907
|
+
this.floorIndex = this.five.work.observers[index].floorIndex;
|
|
3908
|
+
}
|
|
3909
|
+
});
|
|
3910
|
+
/** 当户型图正在展示中的时候禁用惯性 */
|
|
3911
|
+
Object.defineProperty(this, "handleWantsInteriaPan", {
|
|
3912
|
+
enumerable: true,
|
|
3913
|
+
configurable: true,
|
|
3914
|
+
writable: true,
|
|
3915
|
+
value: () => {
|
|
3916
|
+
if (this.visible)
|
|
3917
|
+
return false;
|
|
3918
|
+
}
|
|
3919
|
+
});
|
|
3920
|
+
/** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
|
|
3921
|
+
Object.defineProperty(this, "handleWantsGesture", {
|
|
3922
|
+
enumerable: true,
|
|
3923
|
+
configurable: true,
|
|
3924
|
+
writable: true,
|
|
3925
|
+
value: (type, pointers) => {
|
|
3926
|
+
if (!this.visible)
|
|
3927
|
+
return;
|
|
3928
|
+
if (pointers.length > 1)
|
|
3929
|
+
return false;
|
|
3930
|
+
if (type === 'mouseWheel')
|
|
3931
|
+
return false;
|
|
3932
|
+
}
|
|
3933
|
+
});
|
|
3934
|
+
/** 监听三维模型滑动
|
|
3935
|
+
* 1. 在三维模型转动结束时,如果达到设置的阈值,会自动切换到户型图
|
|
3936
|
+
* 2. 如何户型图已经展示,滑动时关闭户型图
|
|
3937
|
+
*/
|
|
3938
|
+
Object.defineProperty(this, "handlePanGesture", {
|
|
3939
|
+
enumerable: true,
|
|
3940
|
+
configurable: true,
|
|
3941
|
+
writable: true,
|
|
3942
|
+
value: ({ latitude, longitude }, isFinal) => __awaiter(this, void 0, void 0, function* () {
|
|
3943
|
+
if (this.configs.autoShowEnable === false)
|
|
3944
|
+
return;
|
|
3945
|
+
// 如果操作结束后,户型图还在展示中,初始化模型状态
|
|
3946
|
+
if (isFinal && this.visible)
|
|
3947
|
+
return this.five.setState(this.showState, true);
|
|
3948
|
+
// 满足消失的条件:
|
|
3949
|
+
// 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
|
|
3950
|
+
const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
|
|
3951
|
+
const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
|
|
3952
|
+
const canHide = latitudeHide || longitudeHide;
|
|
3953
|
+
if (this.visible && canHide)
|
|
3954
|
+
return this.hide({ isAutoHide: true });
|
|
3955
|
+
if (this.five.camera.fov / FIVE_CAMERA_DEFAULT_FOV < 0.8)
|
|
3956
|
+
return;
|
|
3957
|
+
// 户型图展示条件:
|
|
3958
|
+
// 水平旋转角正负 30 度 && 俯仰角度小于 10 度
|
|
3959
|
+
const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
|
|
3960
|
+
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
3961
|
+
if (isFinal && !this.visible && latitudeVisible && longitudeVisible) {
|
|
3962
|
+
// 当手指离开时需要等惯性结束之后在进行判断
|
|
3963
|
+
const handleInteriaPan = (any, isFinal) => __awaiter(this, void 0, void 0, function* () {
|
|
3964
|
+
if (!isFinal)
|
|
3965
|
+
return;
|
|
3966
|
+
this.five.off('interiaPan', handleInteriaPan);
|
|
3967
|
+
yield this.show({ isAutoShow: true });
|
|
3968
|
+
});
|
|
3969
|
+
this.five.on('interiaPan', handleInteriaPan);
|
|
3970
|
+
return;
|
|
3971
|
+
}
|
|
3972
|
+
})
|
|
3973
|
+
});
|
|
3499
3974
|
this.five = five$1;
|
|
3500
3975
|
this.hooks = new five.Subscribe();
|
|
3501
3976
|
this.selector = params.selector;
|
|
3502
3977
|
this.configs = omit(params, ['selector']);
|
|
3503
|
-
this.showState = { longitude: 0, latitude: Math.PI / 2, fov: FIVE_CAMERA_DEFAULT_FOV / (params
|
|
3978
|
+
this.showState = { longitude: 0, latitude: Math.PI / 2, fov: FIVE_CAMERA_DEFAULT_FOV / ((_a = params === null || params === void 0 ? void 0 : params.scale) !== null && _a !== void 0 ? _a : 1) };
|
|
3504
3979
|
// 设置 container 样式
|
|
3505
3980
|
this.container.classList.add('floorplan-plugin');
|
|
3506
3981
|
Object.assign(this.container.style, {
|
|
@@ -3520,25 +3995,13 @@ class ModelFloorplanPluginController {
|
|
|
3520
3995
|
five$1.on('wantsInteriaPan', this.handleWantsInteriaPan);
|
|
3521
3996
|
five$1.on('modelShownFloorChange', this.onModelShownFloorChange);
|
|
3522
3997
|
}
|
|
3523
|
-
dispose = () => {
|
|
3524
|
-
const five = this.five;
|
|
3525
|
-
this.hide();
|
|
3526
|
-
this.app?.$destroy();
|
|
3527
|
-
this.container?.remove();
|
|
3528
|
-
five.off('modelLoaded', this.handleModelLoaded);
|
|
3529
|
-
five.off('modeChange', this.handleModeChange);
|
|
3530
|
-
five.off('panGesture', this.handlePanGesture);
|
|
3531
|
-
five.off('panoArrived', this.handlePanoArrived);
|
|
3532
|
-
five.off('wantsChangeMode', this.handleWantsChangeMode);
|
|
3533
|
-
five.off('wantsInteriaPan', this.handleWantsInteriaPan);
|
|
3534
|
-
five.off('wantsTapGesture', this.handleWantsTapGesture);
|
|
3535
|
-
five.off('modelShownFloorChange', this.onModelShownFloorChange);
|
|
3536
|
-
};
|
|
3537
3998
|
/** 加载户型图数据 */
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3999
|
+
load(data) {
|
|
4000
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4001
|
+
const copyData = JSON.parse(JSON.stringify(data));
|
|
4002
|
+
this.floorplanData = yield formatData(copyData);
|
|
4003
|
+
this.render();
|
|
4004
|
+
});
|
|
3542
4005
|
}
|
|
3543
4006
|
/** 把插件的渲染DOM插入到对应的容器中去 */
|
|
3544
4007
|
appendTo(wrapper) {
|
|
@@ -3546,130 +4009,6 @@ class ModelFloorplanPluginController {
|
|
|
3546
4009
|
wrapper.appendChild(this.container);
|
|
3547
4010
|
return this;
|
|
3548
4011
|
}
|
|
3549
|
-
/** 更新户型图大小 */
|
|
3550
|
-
updateSize = () => {
|
|
3551
|
-
if (!this.floorplanData)
|
|
3552
|
-
return;
|
|
3553
|
-
if (!checkShowState(this.five, this.showState))
|
|
3554
|
-
return;
|
|
3555
|
-
if (!this.container || !this.wrapper)
|
|
3556
|
-
return;
|
|
3557
|
-
// 计算户型图展示大小
|
|
3558
|
-
const { min, max } = this.floorplanData.bounding;
|
|
3559
|
-
const width = max.x - min.x;
|
|
3560
|
-
const height = max.y - min.y;
|
|
3561
|
-
// 每毫米对应的 px 值
|
|
3562
|
-
const options = this.configs.attachedTo ? { attachedTo: this.configs.attachedTo } : undefined;
|
|
3563
|
-
const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
|
|
3564
|
-
const _width = Math.ceil(width * pxmm);
|
|
3565
|
-
const _height = Math.ceil(height * pxmm);
|
|
3566
|
-
if (this.size.width === _width && this.size.height === _height)
|
|
3567
|
-
return;
|
|
3568
|
-
this.pxmm = pxmm;
|
|
3569
|
-
this.size = { width: _width, height: _height };
|
|
3570
|
-
this.container.style.width = _width + 'px';
|
|
3571
|
-
this.container.style.height = _height + 'px';
|
|
3572
|
-
};
|
|
3573
|
-
/** 展示户型图
|
|
3574
|
-
* 1. show 函数大部分情况下需要耗时
|
|
3575
|
-
* 2. 如果当前已经在展示中,将不会触发任何事件
|
|
3576
|
-
* 3. 如果展示过程被中断,将抛出错误
|
|
3577
|
-
* 4. 多次调用 show 方法,只会触发一次 showAnimationEnded 事件,但是展示结果会取决于最后一次调用参数
|
|
3578
|
-
* 5. 如果多次调用 show 方法,参数与上次参数不一致时,上次 show Promise 会被 reject
|
|
3579
|
-
* @param opts.floorIndex 楼层
|
|
3580
|
-
* @param opts.modelOpacity 模型透明度
|
|
3581
|
-
* @param opts.immediately 是否立即展示
|
|
3582
|
-
* @param opts.isAutoShow 是否是自动展示
|
|
3583
|
-
*/
|
|
3584
|
-
show = async (opts) => {
|
|
3585
|
-
// 已经在展示中了
|
|
3586
|
-
if (!this.showPromise && this.visible)
|
|
3587
|
-
return true;
|
|
3588
|
-
if (!this.five.model?.loaded)
|
|
3589
|
-
throw new Error(FloorplanErrorType.ModelNotLoaded);
|
|
3590
|
-
if (!this.floorplanData)
|
|
3591
|
-
throw new Error(FloorplanErrorType.DataNotLoaded);
|
|
3592
|
-
this.visible = true;
|
|
3593
|
-
if (this.showPromise) {
|
|
3594
|
-
const sameWithLastOpts = equal(opts, this.ModelFloorplanPluginsShowOpts, { deep: false });
|
|
3595
|
-
if (!!this.showPromise && sameWithLastOpts)
|
|
3596
|
-
return this.showPromise;
|
|
3597
|
-
if (!!this.showPromise && !sameWithLastOpts)
|
|
3598
|
-
this.showRejection?.(FloorplanErrorType.DifferentShowParams);
|
|
3599
|
-
}
|
|
3600
|
-
this.ModelFloorplanPluginsShowOpts = opts;
|
|
3601
|
-
const getShowPromise = async () => {
|
|
3602
|
-
let hasRejected = false;
|
|
3603
|
-
let externalErrorMsg;
|
|
3604
|
-
this.showRejection = (errorMsg) => {
|
|
3605
|
-
hasRejected = true;
|
|
3606
|
-
externalErrorMsg = errorMsg;
|
|
3607
|
-
};
|
|
3608
|
-
const [correctError] = await to(correctFiveState(this.five, this.showState, opts?.userAction));
|
|
3609
|
-
if (correctError)
|
|
3610
|
-
throw correctError;
|
|
3611
|
-
// 异步结束要判断当前是不是被中断了,是不是调用了隐藏
|
|
3612
|
-
if (hasRejected)
|
|
3613
|
-
throw externalErrorMsg ? new Error(externalErrorMsg) : new Error(FloorplanErrorType.UnknownError);
|
|
3614
|
-
if (!this.visible)
|
|
3615
|
-
throw new Error(FloorplanErrorType.UnknownError);
|
|
3616
|
-
// 更新户型图状态
|
|
3617
|
-
this.visible = true;
|
|
3618
|
-
// 更新户型图大小
|
|
3619
|
-
this.updateSize();
|
|
3620
|
-
// 高亮当前楼层,有两个目的
|
|
3621
|
-
// 1. 点击模型时,可以跳转到当前楼层的点位上
|
|
3622
|
-
// 2. 当前楼层比较小时,户型图也比较小,如果展示全部楼层,会展示户型图外有一圈模型
|
|
3623
|
-
if (opts?.floorIndex)
|
|
3624
|
-
this.floorIndex = opts.floorIndex;
|
|
3625
|
-
this.five.model.show(this.floorIndex);
|
|
3626
|
-
// 模型消失, 渲染户型图
|
|
3627
|
-
const modelOpacity = opts?.modelOpacity ?? this.configs.modelOpacity ?? 1;
|
|
3628
|
-
const renderDuration = opts?.immediately ? 0 : SHOW_ANIME_DURATION;
|
|
3629
|
-
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
3630
|
-
this.render(renderDuration);
|
|
3631
|
-
// 展示之后的事件监听
|
|
3632
|
-
this.five.on('wantsGesture', this.handleWantsGesture);
|
|
3633
|
-
this.five.on('wantsTapGesture', this.handleWantsTapGesture);
|
|
3634
|
-
return true;
|
|
3635
|
-
};
|
|
3636
|
-
const showPromise = getShowPromise()
|
|
3637
|
-
.then(() => {
|
|
3638
|
-
this.hooks.emit('showAnimationEnded', { auto: !!opts?.isAutoShow, userAction: opts?.userAction ?? true });
|
|
3639
|
-
return true;
|
|
3640
|
-
})
|
|
3641
|
-
.catch((error) => {
|
|
3642
|
-
// 自动展示的报错内部处理
|
|
3643
|
-
if (opts?.isAutoShow)
|
|
3644
|
-
return false;
|
|
3645
|
-
if (!(error instanceof Error))
|
|
3646
|
-
return false;
|
|
3647
|
-
// 非自动展示的报错继续向外抛出
|
|
3648
|
-
throw error;
|
|
3649
|
-
})
|
|
3650
|
-
.finally(() => {
|
|
3651
|
-
this.showPromise = undefined;
|
|
3652
|
-
this.showRejection = undefined;
|
|
3653
|
-
});
|
|
3654
|
-
this.showPromise = showPromise;
|
|
3655
|
-
return showPromise;
|
|
3656
|
-
};
|
|
3657
|
-
/** 隐藏户型图 */
|
|
3658
|
-
hide = (options) => {
|
|
3659
|
-
if (this.size.width === 0)
|
|
3660
|
-
return true;
|
|
3661
|
-
if (this.visible === false)
|
|
3662
|
-
return true;
|
|
3663
|
-
const isAutoHide = !!options?.isAutoHide;
|
|
3664
|
-
this.five.off('wantsGesture', this.handleWantsGesture);
|
|
3665
|
-
this.five.off('wantsTapGesture', this.handleWantsTapGesture);
|
|
3666
|
-
this.visible = false;
|
|
3667
|
-
this.showRejection?.(FloorplanErrorType.BreakOffByHide);
|
|
3668
|
-
changeModelCanvasOpacity(this.five, 1, 0);
|
|
3669
|
-
this.render();
|
|
3670
|
-
this.hooks.emit('hide', { auto: isAutoHide, userAction: options?.userAction ?? true });
|
|
3671
|
-
return true;
|
|
3672
|
-
};
|
|
3673
4012
|
/** 更改户型图楼层 */
|
|
3674
4013
|
changeFloor(floorIndex) {
|
|
3675
4014
|
this.five.model.show(floorIndex);
|
|
@@ -3682,126 +4021,26 @@ class ModelFloorplanPluginController {
|
|
|
3682
4021
|
return;
|
|
3683
4022
|
this.render();
|
|
3684
4023
|
}
|
|
3685
|
-
/** 模型楼层高亮改变时,自动进行楼层切换 */
|
|
3686
|
-
onModelShownFloorChange = (shownFloor) => {
|
|
3687
|
-
if (shownFloor === null)
|
|
3688
|
-
return;
|
|
3689
|
-
this.floorIndex = shownFloor;
|
|
3690
|
-
this.updateSize();
|
|
3691
|
-
this.render();
|
|
3692
|
-
};
|
|
3693
|
-
handleModelLoaded = () => {
|
|
3694
|
-
if (this.wrapper)
|
|
3695
|
-
return;
|
|
3696
|
-
if (!this.selector)
|
|
3697
|
-
return;
|
|
3698
|
-
const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
|
|
3699
|
-
if (!wrapper)
|
|
3700
|
-
throw new Error('不正确的父容器选择器');
|
|
3701
|
-
this.wrapper = wrapper;
|
|
3702
|
-
wrapper.append(this.container);
|
|
3703
|
-
};
|
|
3704
|
-
handleClick = () => {
|
|
3705
|
-
if (!this.visible)
|
|
3706
|
-
return;
|
|
3707
|
-
const prevented = this.hooks.emit('click');
|
|
3708
|
-
if (prevented)
|
|
3709
|
-
return false;
|
|
3710
|
-
};
|
|
3711
|
-
handleWantsTapGesture = () => this.handleClick();
|
|
3712
|
-
/** 从 Panorama 切换到其他模态时,记录当前的相机水平视角 */
|
|
3713
|
-
handleWantsChangeMode = (mode) => {
|
|
3714
|
-
if (mode !== 'Panorama') {
|
|
3715
|
-
this.lastPanoramaLongitude = this.five.getCurrentState().longitude;
|
|
3716
|
-
}
|
|
3717
|
-
if (mode !== 'Floorplan')
|
|
3718
|
-
this.hide();
|
|
3719
|
-
};
|
|
3720
|
-
/** 监听模型态变化,只有在模型态才进行手势动作监听 */
|
|
3721
|
-
handleModeChange = (mode) => {
|
|
3722
|
-
if (mode === 'Floorplan') {
|
|
3723
|
-
this.five.on('panGesture', this.handlePanGesture);
|
|
3724
|
-
}
|
|
3725
|
-
else {
|
|
3726
|
-
this.hide();
|
|
3727
|
-
this.five.off('panGesture', this.handlePanGesture);
|
|
3728
|
-
}
|
|
3729
|
-
};
|
|
3730
|
-
/** panoIndex 改变时,更新 floorIndex */
|
|
3731
|
-
handlePanoArrived = (index) => {
|
|
3732
|
-
if (!this.five?.work)
|
|
3733
|
-
return;
|
|
3734
|
-
this.panoIndex = index;
|
|
3735
|
-
this.floorIndex = this.five.work.observers[index].floorIndex;
|
|
3736
|
-
};
|
|
3737
|
-
/** 当户型图正在展示中的时候禁用惯性 */
|
|
3738
|
-
handleWantsInteriaPan = () => {
|
|
3739
|
-
if (this.visible)
|
|
3740
|
-
return false;
|
|
3741
|
-
};
|
|
3742
|
-
/** 在户型图展示时阻止多指操作, 阻止鼠标放大 */
|
|
3743
|
-
handleWantsGesture = (type, pointers) => {
|
|
3744
|
-
if (!this.visible)
|
|
3745
|
-
return;
|
|
3746
|
-
if (pointers.length > 1)
|
|
3747
|
-
return false;
|
|
3748
|
-
if (type === 'mouseWheel')
|
|
3749
|
-
return false;
|
|
3750
|
-
};
|
|
3751
|
-
/** 监听三维模型滑动
|
|
3752
|
-
* 1. 在三维模型转动结束时,如果达到设置的阈值,会自动切换到户型图
|
|
3753
|
-
* 2. 如何户型图已经展示,滑动时关闭户型图
|
|
3754
|
-
*/
|
|
3755
|
-
handlePanGesture = async ({ latitude, longitude }, isFinal) => {
|
|
3756
|
-
if (this.configs.autoShowEnable === false)
|
|
3757
|
-
return;
|
|
3758
|
-
// 如果操作结束后,户型图还在展示中,初始化模型状态
|
|
3759
|
-
if (isFinal && this.visible)
|
|
3760
|
-
return this.five.setState(this.showState, true);
|
|
3761
|
-
// 满足消失的条件:
|
|
3762
|
-
// 水平旋转角大于正负 5 度 || 俯仰角度大于 5 度
|
|
3763
|
-
const latitudeHide = Math.abs(latitude - Math.PI / 2) > (5 * Math.PI) / 180;
|
|
3764
|
-
const longitudeHide = longitude > 5 * (Math.PI / 180) && longitude < 355 * (Math.PI / 180);
|
|
3765
|
-
const canHide = latitudeHide || longitudeHide;
|
|
3766
|
-
if (this.visible && canHide)
|
|
3767
|
-
return this.hide({ isAutoHide: true });
|
|
3768
|
-
if (this.five.camera.fov / FIVE_CAMERA_DEFAULT_FOV < 0.8)
|
|
3769
|
-
return;
|
|
3770
|
-
// 户型图展示条件:
|
|
3771
|
-
// 水平旋转角正负 30 度 && 俯仰角度小于 10 度
|
|
3772
|
-
const latitudeVisible = Math.abs(latitude - Math.PI / 2) < (10 * Math.PI) / 180;
|
|
3773
|
-
const longitudeVisible = longitude < 30 * (Math.PI / 180) || longitude > 330 * (Math.PI / 180);
|
|
3774
|
-
if (isFinal && !this.visible && latitudeVisible && longitudeVisible) {
|
|
3775
|
-
// 当手指离开时需要等惯性结束之后在进行判断
|
|
3776
|
-
const handleInteriaPan = async (any, isFinal) => {
|
|
3777
|
-
if (!isFinal)
|
|
3778
|
-
return;
|
|
3779
|
-
this.five.off('interiaPan', handleInteriaPan);
|
|
3780
|
-
await this.show({ isAutoShow: true });
|
|
3781
|
-
};
|
|
3782
|
-
this.five.on('interiaPan', handleInteriaPan);
|
|
3783
|
-
return;
|
|
3784
|
-
}
|
|
3785
|
-
};
|
|
3786
4024
|
render(duration) {
|
|
3787
4025
|
if (!this.container || !this.floorplanData)
|
|
3788
4026
|
return;
|
|
3789
4027
|
if (this.size.width === 0)
|
|
3790
4028
|
return;
|
|
3791
|
-
const { hoverEnable, cameraImageUrl, getLabelElement, roomLabelsEnable, compassEnable, ruleLabelsEnable } = this.configs;
|
|
4029
|
+
const { northDesc, hoverEnable, cameraImageUrl, getLabelElement, roomLabelsEnable, compassEnable, ruleLabelsEnable } = this.configs;
|
|
3792
4030
|
const props = {
|
|
4031
|
+
northDesc: northDesc !== null && northDesc !== void 0 ? northDesc : '北',
|
|
3793
4032
|
five: this.five,
|
|
3794
4033
|
pxmm: this.pxmm,
|
|
3795
4034
|
cameraImageUrl,
|
|
3796
4035
|
visible: this.visible,
|
|
3797
|
-
duration: duration
|
|
4036
|
+
duration: duration !== null && duration !== void 0 ? duration : 0,
|
|
3798
4037
|
panoIndex: this.panoIndex,
|
|
3799
4038
|
floorIndex: this.floorIndex,
|
|
3800
4039
|
floorplanData: this.floorplanData,
|
|
3801
|
-
hoverEnable: hoverEnable
|
|
3802
|
-
compassEnable: compassEnable
|
|
3803
|
-
ruleLabelsEnable: ruleLabelsEnable
|
|
3804
|
-
roomLabelsEnable: roomLabelsEnable
|
|
4040
|
+
hoverEnable: hoverEnable !== null && hoverEnable !== void 0 ? hoverEnable : false,
|
|
4041
|
+
compassEnable: compassEnable !== null && compassEnable !== void 0 ? compassEnable : true,
|
|
4042
|
+
ruleLabelsEnable: ruleLabelsEnable !== null && ruleLabelsEnable !== void 0 ? ruleLabelsEnable : true,
|
|
4043
|
+
roomLabelsEnable: roomLabelsEnable !== null && roomLabelsEnable !== void 0 ? roomLabelsEnable : true,
|
|
3805
4044
|
lastPanoramaLongitude: this.lastPanoramaLongitude,
|
|
3806
4045
|
getLabelElement,
|
|
3807
4046
|
onRoomHeightClick: this.handleClick,
|