@realsee/dnalogel 0.1.7-alpha.3 → 0.1.7-alpha.4
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/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
- package/data/81zxMaeVKLQU93OZMG.js +633 -0
- package/libs/gltf-viewer/coordsToDirection.d.ts +1 -1
- package/libs/gltf-viewer/index.d.ts +5 -1
- package/libs/gltf-viewer/index.js +97 -57
- package/package.json +1 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +4 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.js +6 -1
- package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
- package/plugins/ModelRoomLabelPlugin/index.js +7 -2
- package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.js +103 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.js +341 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.js +69 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.js +371 -0
- package/plugins/PanoMeasurePlugin/Controller/index.d.ts +61 -0
- package/plugins/PanoMeasurePlugin/Controller/index.js +230 -0
- package/plugins/PanoMeasurePlugin/Model/index.d.ts +38 -0
- package/plugins/PanoMeasurePlugin/Model/index.js +235 -0
- package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/plugins/PanoMeasurePlugin/Model/line.js +121 -0
- package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/point.js +68 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.js +109 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.js +182 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +66 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.js +107 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.js +139 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.js +26 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +169 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +59 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.js +123 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.js +103 -0
- package/plugins/PanoMeasurePlugin/index.d.ts +7 -0
- package/plugins/PanoMeasurePlugin/index.js +20 -0
- package/plugins/PanoMeasurePlugin/typings/data.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/data.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.js +7 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/constants.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/constants.js +47 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.js +147 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.js +37 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.js +49 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +20 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +33 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.js +14 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/line.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/line.js +61 -0
- package/plugins/PanoMeasurePlugin/utils/math.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/math.js +57 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.js +42 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.js +16 -0
- package/plugins/PanoRulerPlugin/index.d.ts +4 -0
- package/plugins/PanoRulerPlugin/index.js +6 -1
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +1 -0
- package/plugins/floorplan/index.d.ts +4 -0
- package/plugins/floorplan/index.js +13 -0
- package/shared-utils/removeArrayItem.d.ts +7 -0
- package/shared-utils/removeArrayItem.js +22 -0
|
@@ -67,8 +67,6 @@ var _coordsMoveByOffset = require("./coordsMoveByOffset");
|
|
|
67
67
|
|
|
68
68
|
var _getFrameTime = require("./getFrameTime");
|
|
69
69
|
|
|
70
|
-
var _formatRad = require("./formatRad");
|
|
71
|
-
|
|
72
70
|
var _coordsToDirection = require("./coordsToDirection");
|
|
73
71
|
|
|
74
72
|
var _mouseWheel = require("./mouseWheel");
|
|
@@ -89,8 +87,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
89
87
|
|
|
90
88
|
var defaultPos = {
|
|
91
89
|
longitude: 0,
|
|
92
|
-
latitude:
|
|
93
|
-
fov:
|
|
90
|
+
latitude: 0,
|
|
91
|
+
fov: 0
|
|
94
92
|
};
|
|
95
93
|
var ERROR_NO_CONTROLLER = 'GLTFViewer 实例丢失';
|
|
96
94
|
var loader = new _GLTFLoader.GLTFLoader();
|
|
@@ -100,7 +98,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
100
98
|
var _this = this;
|
|
101
99
|
|
|
102
100
|
(0, _classCallCheck2["default"])(this, Controller);
|
|
103
|
-
(0, _defineProperty2["default"])(this, "fov",
|
|
101
|
+
(0, _defineProperty2["default"])(this, "fov", 0);
|
|
104
102
|
(0, _defineProperty2["default"])(this, "longitude", 0);
|
|
105
103
|
(0, _defineProperty2["default"])(this, "latitude", 0);
|
|
106
104
|
(0, _defineProperty2["default"])(this, "needsRender", false);
|
|
@@ -135,8 +133,11 @@ var Controller = /*#__PURE__*/function () {
|
|
|
135
133
|
alpha: true
|
|
136
134
|
});
|
|
137
135
|
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
|
|
137
|
+
if (config.toneMapping) {
|
|
138
|
+
this.renderer.toneMapping = THREE.ReinhardToneMapping;
|
|
139
|
+
this.renderer.toneMappingExposure = 1.5;
|
|
140
|
+
}
|
|
140
141
|
|
|
141
142
|
if (config.backgroundColor) {
|
|
142
143
|
this.renderer.setClearColor(config.backgroundColor, 0);
|
|
@@ -148,10 +149,10 @@ var Controller = /*#__PURE__*/function () {
|
|
|
148
149
|
} // 相机
|
|
149
150
|
|
|
150
151
|
|
|
151
|
-
this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1,
|
|
152
|
+
this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1, 1000); // 光照
|
|
152
153
|
|
|
153
154
|
if (config.pointLight !== false) {
|
|
154
|
-
this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1,
|
|
155
|
+
this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1, 10000);
|
|
155
156
|
this.scene.add(this.pointLight);
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -219,7 +220,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
219
220
|
(0, _createClass2["default"])(Controller, [{
|
|
220
221
|
key: "minFov",
|
|
221
222
|
get: function get() {
|
|
222
|
-
return this.config.minFov ||
|
|
223
|
+
return this.config.minFov || 1;
|
|
223
224
|
}
|
|
224
225
|
}, {
|
|
225
226
|
key: "maxFov",
|
|
@@ -266,30 +267,13 @@ var Controller = /*#__PURE__*/function () {
|
|
|
266
267
|
|
|
267
268
|
this.target = object;
|
|
268
269
|
this.target.scene.visible = false;
|
|
269
|
-
this.scene.add(this.target.scene); //
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
// if (boundingSphere) {
|
|
277
|
-
// const { center, radius } = boundingSphere
|
|
278
|
-
// const fov = Math.PI / 2 - Math.asin(this.renderer.domElement.offsetWidth / 2 / radius)
|
|
279
|
-
// console.log('fov', fov, this.renderer.domElement.offsetWidth / 2, radius)
|
|
280
|
-
// }
|
|
281
|
-
// const VFov = 45
|
|
282
|
-
// const aspect = this.camera.aspect
|
|
283
|
-
// // // 计算水平 fov
|
|
284
|
-
// const HFov = (2 * Math.atan(Math.tan((VFov * Math.PI) / 180 / 2) * aspect) * 180) / Math.PI
|
|
285
|
-
// const zEye = Math.abs(radius) / Math.sin(((HFov / 2) * Math.PI) / 180)
|
|
286
|
-
// console.log('HFOV', HFov, zEye)
|
|
287
|
-
// const lookPos = new THREE.Vector3(
|
|
288
|
-
// center.x + this.scene.position.x,
|
|
289
|
-
// center.x + this.scene.position.y,
|
|
290
|
-
// center.x + this.scene.position.z,
|
|
291
|
-
// )
|
|
292
|
-
}
|
|
270
|
+
this.scene.add(this.target.scene); // {
|
|
271
|
+
// const boxHelper = new THREE.BoxHelper(this.target.scene, 0x2bb8aa)
|
|
272
|
+
// this.scene.add(boxHelper)
|
|
273
|
+
// const axesHelper = new THREE.AxesHelper(300)
|
|
274
|
+
// this.scene.add(axesHelper)
|
|
275
|
+
// }
|
|
276
|
+
|
|
293
277
|
setTimeout(function () {
|
|
294
278
|
if (object === _this3.target) {
|
|
295
279
|
_this3.target.scene.visible = true;
|
|
@@ -354,37 +338,84 @@ var Controller = /*#__PURE__*/function () {
|
|
|
354
338
|
latitude = state.latitude;
|
|
355
339
|
}
|
|
356
340
|
|
|
357
|
-
|
|
358
|
-
var
|
|
341
|
+
if (!this.target || !this.target.scene) return;
|
|
342
|
+
var boxHelper = new THREE.BoxHelper(this.target.scene, 0x2bb8aa);
|
|
359
343
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
344
|
+
var _ref = boxHelper.geometry.boundingSphere || {},
|
|
345
|
+
center = _ref.center,
|
|
346
|
+
radius = _ref.radius;
|
|
347
|
+
|
|
348
|
+
if (!center || !radius) return;
|
|
349
|
+
var box = new THREE.Box3();
|
|
350
|
+
box.expandByObject(this.target.scene);
|
|
351
|
+
box.getCenter(center); // 距离
|
|
352
|
+
|
|
353
|
+
var distance = radius / Math.sin(Math.PI / 4) * 3;
|
|
354
|
+
{// debug
|
|
355
|
+
// const geometry = new THREE.SphereGeometry(radius, 32, 16)
|
|
356
|
+
// const material = new THREE.MeshBasicMaterial({ color: 0x0000aa, wireframe: true })
|
|
357
|
+
// const sphere = new THREE.Mesh(geometry, material)
|
|
358
|
+
// sphere.position.copy(center.clone())
|
|
359
|
+
// this.scene.add(sphere)
|
|
360
|
+
} // 朝向
|
|
364
361
|
|
|
365
|
-
longitude = (0, _formatRad.formatRad)(longitude);
|
|
366
|
-
latitude = Math.max(-Math.PI / 2 + 0.01, Math.min(+Math.PI / 2, latitude));
|
|
367
|
-
var distance = Math.max(center.distanceTo(box.min), center.distanceTo(box.max));
|
|
368
362
|
var direction = (0, _coordsToDirection.coordsToDirection)({
|
|
369
363
|
longitude: longitude,
|
|
370
364
|
latitude: latitude
|
|
371
365
|
});
|
|
372
|
-
direction.setLength(distance
|
|
366
|
+
direction.setLength(distance);
|
|
373
367
|
this.camera.position.copy(center.clone().add(direction));
|
|
374
368
|
this.camera.lookAt(center);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
369
|
+
|
|
370
|
+
if (this.pointLight) {
|
|
371
|
+
var lightDirection = (0, _coordsToDirection.coordsToDirection)({
|
|
372
|
+
longitude: longitude,
|
|
373
|
+
latitude: -Math.PI / 6
|
|
374
|
+
});
|
|
375
|
+
lightDirection.setLength(distance * 3);
|
|
376
|
+
this.pointLight.position.copy(center.clone().add(lightDirection));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
var calcFov = function calcFov(distance, width, r) {
|
|
380
|
+
var vertical = r < 1 ? width / r : width;
|
|
381
|
+
var fov = Math.atan(vertical / distance / 2) * 2 * (180 / Math.PI);
|
|
382
|
+
return fov;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
var d = this.camera.position.distanceTo(center);
|
|
386
|
+
|
|
387
|
+
if (fov === 0) {
|
|
388
|
+
fov = calcFov(d, radius * 2, this.renderer.domElement.offsetWidth / this.renderer.domElement.offsetHeight);
|
|
389
|
+
}
|
|
381
390
|
|
|
382
391
|
if (fov !== this.fov) {
|
|
383
|
-
fov = Math.max(
|
|
392
|
+
fov = Math.max(this.minFov, Math.min(this.maxFov, fov));
|
|
384
393
|
this.camera.fov = fov;
|
|
385
394
|
this.camera.updateProjectionMatrix();
|
|
386
395
|
}
|
|
387
396
|
|
|
397
|
+
this.camera.updateProjectionMatrix(); // const center = new THREE.Vector3()
|
|
398
|
+
// const box = new THREE.Box3()
|
|
399
|
+
// if (this.target) {
|
|
400
|
+
// box.expandByObject(this.target.scene)
|
|
401
|
+
// box.getCenter(center)
|
|
402
|
+
// }
|
|
403
|
+
// longitude = formatRad(longitude)
|
|
404
|
+
// latitude = Math.max(-Math.PI / 2 + 0.01, Math.min(+Math.PI / 2, latitude))
|
|
405
|
+
// const distance = Math.max(center.distanceTo(box.min), center.distanceTo(box.max))
|
|
406
|
+
// const direction = coordsToDirection({ longitude, latitude })
|
|
407
|
+
// direction.setLength(distance * 3)
|
|
408
|
+
// this.camera.position.copy(center.clone().add(direction))
|
|
409
|
+
// this.camera.lookAt(center)
|
|
410
|
+
// const lightDirection = coordsToDirection({ longitude, latitude: -Math.PI / 6 })
|
|
411
|
+
// lightDirection.setLength(distance * 3)
|
|
412
|
+
// if (this.pointLight) this.pointLight.position.copy(center.clone().add(lightDirection))
|
|
413
|
+
// if (fov !== this.fov) {
|
|
414
|
+
// fov = Math.max(25, Math.min(this.maxFov, fov))
|
|
415
|
+
// this.camera.fov = fov
|
|
416
|
+
// this.camera.updateProjectionMatrix()
|
|
417
|
+
// }
|
|
418
|
+
|
|
388
419
|
var needsRender = this.fov !== fov || this.longitude !== longitude || this.latitude !== latitude;
|
|
389
420
|
Object.assign(this, {
|
|
390
421
|
longitude: longitude,
|
|
@@ -483,8 +514,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
483
514
|
return;
|
|
484
515
|
}
|
|
485
516
|
|
|
517
|
+
var fov = this.__pinchCurrentFov ? this.__pinchCurrentFov / scale : 1;
|
|
486
518
|
this.update({
|
|
487
|
-
fov:
|
|
519
|
+
fov: fov
|
|
488
520
|
});
|
|
489
521
|
}
|
|
490
522
|
}, {
|
|
@@ -526,8 +558,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
526
558
|
key: "__onMouseWheel",
|
|
527
559
|
value: function __onMouseWheel(event) {
|
|
528
560
|
this.__interiaMovement = false;
|
|
561
|
+
var fov = this.fov - event.delta;
|
|
529
562
|
this.update({
|
|
530
|
-
fov:
|
|
563
|
+
fov: fov <= 1 ? 1 : fov
|
|
531
564
|
});
|
|
532
565
|
}
|
|
533
566
|
}, {
|
|
@@ -602,6 +635,9 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
602
635
|
return _this7.emit('loadError', error);
|
|
603
636
|
}
|
|
604
637
|
});
|
|
638
|
+
Object.assign(window, {
|
|
639
|
+
$controller: controller
|
|
640
|
+
});
|
|
605
641
|
caches[_this7.uuid] = controller;
|
|
606
642
|
return _this7;
|
|
607
643
|
}
|
|
@@ -636,10 +672,10 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
636
672
|
});
|
|
637
673
|
return proxy;
|
|
638
674
|
},
|
|
639
|
-
set: function set(
|
|
640
|
-
var fov =
|
|
641
|
-
latitude =
|
|
642
|
-
longitude =
|
|
675
|
+
set: function set(_ref2) {
|
|
676
|
+
var fov = _ref2.fov,
|
|
677
|
+
latitude = _ref2.latitude,
|
|
678
|
+
longitude = _ref2.longitude;
|
|
643
679
|
var controller = caches[this.uuid];
|
|
644
680
|
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
645
681
|
controller.update({
|
|
@@ -651,11 +687,15 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
651
687
|
/**
|
|
652
688
|
*
|
|
653
689
|
* @param url glTF 模型CDN地址
|
|
690
|
+
* @param options adaptive 是否开启自适应fov
|
|
654
691
|
*/
|
|
655
692
|
|
|
656
693
|
}, {
|
|
657
694
|
key: "load",
|
|
658
695
|
value: function load(url) {
|
|
696
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
697
|
+
adaptive: true
|
|
698
|
+
};
|
|
659
699
|
var controller = caches[this.uuid];
|
|
660
700
|
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
661
701
|
controller.load(url);
|
package/package.json
CHANGED
|
@@ -19,4 +19,8 @@ export interface ModelEntryDoorGuidePluginExportType {
|
|
|
19
19
|
* 模型入户门引导插件
|
|
20
20
|
*/
|
|
21
21
|
declare const ModelEntryDoorGuidePlugin: FivePlugin<ModelEntryDoorGuidePluginParameterType, ModelEntryDoorGuidePluginExportType>;
|
|
22
|
+
export declare const modelEntryDoorGuidePluginServerParams: {
|
|
23
|
+
name: string;
|
|
24
|
+
version: number;
|
|
25
|
+
};
|
|
22
26
|
export default ModelEntryDoorGuidePlugin;
|
|
@@ -19,7 +19,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", {
|
|
20
20
|
value: true
|
|
21
21
|
});
|
|
22
|
-
exports["default"] = void 0;
|
|
22
|
+
exports.modelEntryDoorGuidePluginServerParams = exports["default"] = void 0;
|
|
23
23
|
|
|
24
24
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
25
25
|
|
|
@@ -243,5 +243,10 @@ var ModelEntryDoorGuidePlugin = function ModelEntryDoorGuidePlugin(five, params)
|
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
+
var modelEntryDoorGuidePluginServerParams = {
|
|
247
|
+
name: 'ModelEntryDoorGuidePlugin',
|
|
248
|
+
version: 0
|
|
249
|
+
};
|
|
250
|
+
exports.modelEntryDoorGuidePluginServerParams = modelEntryDoorGuidePluginServerParams;
|
|
246
251
|
var _default = ModelEntryDoorGuidePlugin;
|
|
247
252
|
exports["default"] = _default;
|
|
@@ -2,6 +2,10 @@ import { FivePlugin } from '@realsee/five';
|
|
|
2
2
|
import { ModelRoomLabelController, ModelRoomLabelPluginParameters } from './Controller';
|
|
3
3
|
export declare const ModelRoomLabelPlugin: FivePlugin<ModelRoomLabelPluginParameters, ModelRoomLabelPluginReturnType>;
|
|
4
4
|
export default ModelRoomLabelPlugin;
|
|
5
|
+
export declare const modelRoomLabelPluginServerParams: {
|
|
6
|
+
name: string;
|
|
7
|
+
version: number;
|
|
8
|
+
};
|
|
5
9
|
export type { ModelRoomLabelController } from './Controller';
|
|
6
10
|
export type { ModelRoomLabelPluginData, RoomLabel } from './typings';
|
|
7
11
|
export declare type ModelRoomLabelPluginReturnType = ModelRoomLabelController;
|
|
@@ -5,7 +5,7 @@ require("core-js/modules/es.object.define-property.js");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.ModelRoomLabelPlugin = void 0;
|
|
8
|
+
exports.modelRoomLabelPluginServerParams = exports["default"] = exports.ModelRoomLabelPlugin = void 0;
|
|
9
9
|
|
|
10
10
|
var _Controller = require("./Controller");
|
|
11
11
|
|
|
@@ -15,4 +15,9 @@ var ModelRoomLabelPlugin = function ModelRoomLabelPlugin(five) {
|
|
|
15
15
|
|
|
16
16
|
exports.ModelRoomLabelPlugin = ModelRoomLabelPlugin;
|
|
17
17
|
var _default = ModelRoomLabelPlugin;
|
|
18
|
-
exports["default"] = _default;
|
|
18
|
+
exports["default"] = _default;
|
|
19
|
+
var modelRoomLabelPluginServerParams = {
|
|
20
|
+
name: 'ModelRoomLabelPlugin',
|
|
21
|
+
version: 0
|
|
22
|
+
};
|
|
23
|
+
exports.modelRoomLabelPluginServerParams = modelRoomLabelPluginServerParams;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Line from '../Model/line';
|
|
2
|
+
import Magnifier from '../Modules/Magnifier';
|
|
3
|
+
import FiveHelper from '../Modules/FiveHelper';
|
|
4
|
+
import { Group } from 'three';
|
|
5
|
+
import { Model } from '../Model';
|
|
6
|
+
import { PluginEvent } from '../typings/event.type';
|
|
7
|
+
import { Five, Intersection, IntersectMeshInterface, Subscribe } from '@realsee/five';
|
|
8
|
+
import { UserDistanceItem } from '../utils/distanceDom';
|
|
9
|
+
export interface IControllerParams {
|
|
10
|
+
five: Five;
|
|
11
|
+
group: Group;
|
|
12
|
+
model: Model;
|
|
13
|
+
mouseGroup: Group;
|
|
14
|
+
container: Element;
|
|
15
|
+
magnifier: Magnifier;
|
|
16
|
+
fiveHelper: FiveHelper;
|
|
17
|
+
hook: Subscribe<PluginEvent>;
|
|
18
|
+
userDistanceItemCreator?: () => UserDistanceItem;
|
|
19
|
+
}
|
|
20
|
+
export default abstract class BaseController {
|
|
21
|
+
protected five: Five;
|
|
22
|
+
protected group: Group;
|
|
23
|
+
protected model: Model;
|
|
24
|
+
protected disposed: boolean;
|
|
25
|
+
protected mouseGroup: Group;
|
|
26
|
+
protected container: Element;
|
|
27
|
+
protected fiveHelper: FiveHelper;
|
|
28
|
+
protected hook: IControllerParams['hook'];
|
|
29
|
+
protected magnifier: IControllerParams['magnifier'];
|
|
30
|
+
protected userDistanceItemCreator: IControllerParams['userDistanceItemCreator'];
|
|
31
|
+
constructor(params: IControllerParams);
|
|
32
|
+
protected removeLine(line: Line): void;
|
|
33
|
+
protected updateDistanceUI: () => void;
|
|
34
|
+
protected updateMouseGroup(intersection: Intersection, mesh?: IntersectMeshInterface): Group;
|
|
35
|
+
protected dispose(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.for-each.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
22
|
+
var _ironbox = require("../utils/ironbox");
|
|
23
|
+
|
|
24
|
+
var BaseController = /*#__PURE__*/function () {
|
|
25
|
+
function BaseController(params) {
|
|
26
|
+
var _this = this;
|
|
27
|
+
|
|
28
|
+
(0, _classCallCheck2["default"])(this, BaseController);
|
|
29
|
+
(0, _defineProperty2["default"])(this, "disposed", false);
|
|
30
|
+
(0, _defineProperty2["default"])(this, "updateDistanceUI", function () {
|
|
31
|
+
_this.model.lines.forEach(function (line) {
|
|
32
|
+
return line.distanceItem.update(_this.five);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
// ==================== Params ====================
|
|
36
|
+
this.five = params.five;
|
|
37
|
+
this.hook = params.hook;
|
|
38
|
+
this.model = params.model;
|
|
39
|
+
this.magnifier = params.magnifier;
|
|
40
|
+
this.container = params.container;
|
|
41
|
+
this.fiveHelper = params.fiveHelper;
|
|
42
|
+
this.userDistanceItemCreator = params.userDistanceItemCreator; // ==================== Groups ====================
|
|
43
|
+
|
|
44
|
+
this.group = params.group;
|
|
45
|
+
this.mouseGroup = params.mouseGroup;
|
|
46
|
+
var fiveElement = this.five.getElement();
|
|
47
|
+
|
|
48
|
+
if (fiveElement) {
|
|
49
|
+
fiveElement.addEventListener('touchstart', _ironbox.preventDefault);
|
|
50
|
+
fiveElement.addEventListener('contextmenu', _ironbox.preventDefault);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
(0, _createClass2["default"])(BaseController, [{
|
|
55
|
+
key: "removeLine",
|
|
56
|
+
value: function removeLine(line) {
|
|
57
|
+
this.group.remove(line.mesh, line.lightMesh);
|
|
58
|
+
line.distanceItem.remove();
|
|
59
|
+
this.five.needsRender = true;
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "updateMouseGroup",
|
|
63
|
+
value: function updateMouseGroup(intersection, mesh) {
|
|
64
|
+
if (!intersection) return this.mouseGroup; // ============ update mouseGroup position ============
|
|
65
|
+
|
|
66
|
+
var adsorbentPoint = this.fiveHelper.getAdsorbentPoint(intersection);
|
|
67
|
+
var viewPosition = adsorbentPoint ? adsorbentPoint : intersection.point;
|
|
68
|
+
this.mouseGroup.position.copy(viewPosition); // ============ update mouseGroup quaternion ============
|
|
69
|
+
|
|
70
|
+
if (mesh) {
|
|
71
|
+
this.mouseGroup.quaternion.copy(mesh.quaternion);
|
|
72
|
+
} else if (intersection.face) {
|
|
73
|
+
var normal = intersection.face.normal;
|
|
74
|
+
var positionVector = normal.clone().multiplyScalar(0.05);
|
|
75
|
+
var position = intersection.point.clone().add(positionVector);
|
|
76
|
+
var lookAtVector = position.clone().add(positionVector);
|
|
77
|
+
this.mouseGroup.lookAt(lookAtVector);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return this.mouseGroup;
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "dispose",
|
|
84
|
+
value: function dispose() {
|
|
85
|
+
var _this2 = this;
|
|
86
|
+
|
|
87
|
+
this.disposed = true;
|
|
88
|
+
this.magnifier.dispose();
|
|
89
|
+
this.model.lines.forEach(function (line) {
|
|
90
|
+
return _this2.removeLine(line);
|
|
91
|
+
});
|
|
92
|
+
var fiveElement = this.five.getElement();
|
|
93
|
+
|
|
94
|
+
if (fiveElement) {
|
|
95
|
+
fiveElement.removeEventListener('touchstart', _ironbox.preventDefault);
|
|
96
|
+
fiveElement.removeEventListener('contextmenu', _ironbox.preventDefault);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}]);
|
|
100
|
+
return BaseController;
|
|
101
|
+
}();
|
|
102
|
+
|
|
103
|
+
exports["default"] = BaseController;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Model } from '../Model';
|
|
2
|
+
import Line from '../Model/line';
|
|
3
|
+
import { LineJson } from '../typings/data';
|
|
4
|
+
import BaseController, { IControllerParams } from './BaseController';
|
|
5
|
+
export interface EditEvent {
|
|
6
|
+
editedLineChange: (lines: LineJson[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export default class EditController extends BaseController {
|
|
9
|
+
type: string;
|
|
10
|
+
model: Model;
|
|
11
|
+
private pressPoint?;
|
|
12
|
+
private hasAppendDashed;
|
|
13
|
+
private hasAppendMouseGroup;
|
|
14
|
+
private fiveElement?;
|
|
15
|
+
/** 上一个端点位置 */
|
|
16
|
+
private lastPoint;
|
|
17
|
+
/** 鼠标点到上一个端点连接的虚线 */
|
|
18
|
+
private dashed;
|
|
19
|
+
private hammer?;
|
|
20
|
+
/** 根据 intersection 更新放大镜和吸附点 */
|
|
21
|
+
private onIntersectionUpdate;
|
|
22
|
+
constructor(params: IControllerParams);
|
|
23
|
+
dispose(): void;
|
|
24
|
+
getEditingLines(): Line[];
|
|
25
|
+
/** 撤销编辑 */
|
|
26
|
+
revoke: () => void;
|
|
27
|
+
private onMouseLeave;
|
|
28
|
+
/** 编辑线条发生改变时通知外部 */
|
|
29
|
+
private onLineChanged;
|
|
30
|
+
private onPress;
|
|
31
|
+
/**
|
|
32
|
+
* 1. 如果之前没有长按行为「即没有长按点时」-> 滑动全景
|
|
33
|
+
* 2. 如果有长按点,把长按点位置更新为当前位置
|
|
34
|
+
*/
|
|
35
|
+
private onPan;
|
|
36
|
+
private onPanEnd;
|
|
37
|
+
/**
|
|
38
|
+
* 1. 如果存在上一个点,需要绘制当前点到上一个点的连线
|
|
39
|
+
* 2. 把上一个点的位置更新为当前点的位置
|
|
40
|
+
* 3. 清除 mouseGroup 和 magnifier
|
|
41
|
+
*/
|
|
42
|
+
private onTap;
|
|
43
|
+
private onWantsTapGesture;
|
|
44
|
+
/** 编辑时取消走点 */
|
|
45
|
+
private onWantsToMoveToPano;
|
|
46
|
+
/** 存在长按点时不能移动全景 */
|
|
47
|
+
private onWantsPanGesture;
|
|
48
|
+
/** 移动全景时更新 distanceItem 在屏幕上的位置 */
|
|
49
|
+
private onCameraUpdate;
|
|
50
|
+
/** 更新虚线 */
|
|
51
|
+
private updateDashed;
|
|
52
|
+
}
|