@realsee/dnalogel 0.1.7-alpha.3 → 0.1.7-alpha.7
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/components/ARVideoFigure/ImgBgTransparentMesh.js +2 -2
- package/components/GLTFView/index.d.ts +7 -1
- package/components/GLTFView/index.js +7 -1
- package/components/GlassFilters/index.js +2 -2
- package/components/ModelView/ModelViewController.js +6 -5
- package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
- package/data/81zxMaeVKLQU93OZMG.js +633 -0
- package/data/_vLykj3NWrllMrG06.d.ts +95 -0
- package/data/_vLykj3NWrllMrG06.js +1 -0
- package/libs/gltf-viewer/Subscribe.js +2 -0
- package/libs/gltf-viewer/coordsToDirection.d.ts +1 -1
- package/libs/gltf-viewer/index.d.ts +13 -0
- package/libs/gltf-viewer/index.js +119 -63
- package/package.json +1 -1
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +2 -0
- package/plugins/CSS3DRenderPlugin/index.js +17 -12
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.d.ts +7 -0
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.js +34 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +1 -1
- package/plugins/ModelChassisCompassPlugin/index.js +2 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +4 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.js +6 -1
- package/plugins/ModelExtrudeWallsPlugin/index.js +2 -2
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +2 -2
- package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
- package/plugins/ModelRoomLabelPlugin/index.js +7 -2
- package/plugins/ModelTVVideoPlugin/index.js +4 -2
- package/plugins/ModelViewPlugin/index.js +2 -2
- package/plugins/PanoCursorRaycasterPlugin/index.js +2 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.js +105 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.js +343 -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 +373 -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 +237 -0
- package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/plugins/PanoMeasurePlugin/Model/line.js +123 -0
- package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/point.js +72 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.js +111 -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 +184 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +68 -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 +125 -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 +39 -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 +8 -3
- package/plugins/TreasurePlugin/Controller.js +2 -2
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +2 -2
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -1
- package/plugins/floorplan/Assets/floorplanExtraObject.js +3 -3
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +2 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.js +6 -3
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +3 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +2 -2
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +3 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +13 -3
- package/plugins/floorplan/index.d.ts +4 -0
- package/plugins/floorplan/index.js +13 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +1 -1
- package/plugins/floorplan/typings/floorplanServerData.js +3 -3
- package/plugins/floorplan/utils/formatData.js +1 -1
- package/plugins/floorplan/utils/formatPosition.js +2 -0
- package/shared-utils/Subscribe.js +4 -2
- package/shared-utils/animationFrame/BetterTween.js +5 -1
- package/shared-utils/filter.js +4 -2
- package/shared-utils/math/evenNumber.d.ts +3 -1
- package/shared-utils/math/evenNumber.js +4 -2
- package/shared-utils/math/planimetry.js +2 -0
- package/shared-utils/removeArrayItem.d.ts +7 -0
- package/shared-utils/removeArrayItem.js +22 -0
|
@@ -16,6 +16,10 @@ export interface GLTFViewerConfig {
|
|
|
16
16
|
ambientLight?: THREE.AmbientLight | false;
|
|
17
17
|
minFov?: number;
|
|
18
18
|
maxFov?: number;
|
|
19
|
+
toneMapping?: {
|
|
20
|
+
toneMapping?: THREE.ToneMapping;
|
|
21
|
+
toneMappingExposure?: number;
|
|
22
|
+
};
|
|
19
23
|
}
|
|
20
24
|
export interface GLTFViewerState {
|
|
21
25
|
fov: number;
|
|
@@ -42,9 +46,14 @@ export declare class GLTFViewer extends Subscribe<GLTFViewerEventMap> {
|
|
|
42
46
|
latitude?: number;
|
|
43
47
|
longitude?: number;
|
|
44
48
|
});
|
|
49
|
+
set minFov(fov: number);
|
|
50
|
+
get minFov(): number;
|
|
51
|
+
set maxFov(fov: number);
|
|
52
|
+
get maxFov(): number;
|
|
45
53
|
/**
|
|
46
54
|
*
|
|
47
55
|
* @param url glTF 模型CDN地址
|
|
56
|
+
* @param options adaptive 是否开启自适应fov
|
|
48
57
|
*/
|
|
49
58
|
load(url: string): void;
|
|
50
59
|
/**
|
|
@@ -62,4 +71,8 @@ export declare class GLTFViewer extends Subscribe<GLTFViewerEventMap> {
|
|
|
62
71
|
* 销毁
|
|
63
72
|
*/
|
|
64
73
|
dispose(): void;
|
|
74
|
+
/**
|
|
75
|
+
* 响应式fov
|
|
76
|
+
*/
|
|
77
|
+
fitFov(): void;
|
|
65
78
|
}
|
|
@@ -23,12 +23,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
23
23
|
});
|
|
24
24
|
exports.GLTFViewer = void 0;
|
|
25
25
|
|
|
26
|
+
require("core-js/modules/es.object.assign.js");
|
|
27
|
+
|
|
26
28
|
require("core-js/modules/es.function.bind.js");
|
|
27
29
|
|
|
28
30
|
require("core-js/modules/web.timers.js");
|
|
29
31
|
|
|
30
|
-
require("core-js/modules/es.object.assign.js");
|
|
31
|
-
|
|
32
32
|
require("core-js/modules/es.object.to-string.js");
|
|
33
33
|
|
|
34
34
|
require("core-js/modules/es.promise.js");
|
|
@@ -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,11 +98,14 @@ 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);
|
|
107
|
-
this.config =
|
|
105
|
+
this.config = Object.assign({
|
|
106
|
+
maxFov: 120,
|
|
107
|
+
minFov: 1
|
|
108
|
+
}, config); // 异步事件回调
|
|
108
109
|
|
|
109
110
|
this.callbacks = callbacks; // 默认状态参数
|
|
110
111
|
|
|
@@ -135,8 +136,14 @@ var Controller = /*#__PURE__*/function () {
|
|
|
135
136
|
alpha: true
|
|
136
137
|
});
|
|
137
138
|
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
|
|
140
|
+
if (config.toneMapping) {
|
|
141
|
+
var _config$toneMapping = config.toneMapping,
|
|
142
|
+
toneMapping = _config$toneMapping.toneMapping,
|
|
143
|
+
toneMappingExposure = _config$toneMapping.toneMappingExposure;
|
|
144
|
+
if (toneMapping) this.renderer.toneMapping = toneMapping;
|
|
145
|
+
if (toneMappingExposure !== undefined) this.renderer.toneMappingExposure = toneMappingExposure;
|
|
146
|
+
}
|
|
140
147
|
|
|
141
148
|
if (config.backgroundColor) {
|
|
142
149
|
this.renderer.setClearColor(config.backgroundColor, 0);
|
|
@@ -148,10 +155,10 @@ var Controller = /*#__PURE__*/function () {
|
|
|
148
155
|
} // 相机
|
|
149
156
|
|
|
150
157
|
|
|
151
|
-
this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1,
|
|
158
|
+
this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1, 1500); // 光照
|
|
152
159
|
|
|
153
160
|
if (config.pointLight !== false) {
|
|
154
|
-
this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1,
|
|
161
|
+
this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1, 1500);
|
|
155
162
|
this.scene.add(this.pointLight);
|
|
156
163
|
}
|
|
157
164
|
|
|
@@ -219,7 +226,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
219
226
|
(0, _createClass2["default"])(Controller, [{
|
|
220
227
|
key: "minFov",
|
|
221
228
|
get: function get() {
|
|
222
|
-
return this.config.minFov ||
|
|
229
|
+
return this.config.minFov || 1;
|
|
223
230
|
}
|
|
224
231
|
}, {
|
|
225
232
|
key: "maxFov",
|
|
@@ -266,35 +273,14 @@ var Controller = /*#__PURE__*/function () {
|
|
|
266
273
|
|
|
267
274
|
this.target = object;
|
|
268
275
|
this.target.scene.visible = false;
|
|
269
|
-
this.scene.add(this.target.scene);
|
|
270
|
-
|
|
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
|
-
// const boundingSphere = boxHelper.geometry.boundingSphere
|
|
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
|
-
}
|
|
276
|
+
this.scene.add(this.target.scene);
|
|
293
277
|
setTimeout(function () {
|
|
294
278
|
if (object === _this3.target) {
|
|
295
279
|
_this3.target.scene.visible = true;
|
|
296
280
|
|
|
297
281
|
_this3.update({});
|
|
282
|
+
|
|
283
|
+
_this3.callbacks.loaded(object);
|
|
298
284
|
}
|
|
299
285
|
}, 50);
|
|
300
286
|
}
|
|
@@ -354,33 +340,59 @@ var Controller = /*#__PURE__*/function () {
|
|
|
354
340
|
latitude = state.latitude;
|
|
355
341
|
}
|
|
356
342
|
|
|
357
|
-
|
|
358
|
-
var
|
|
343
|
+
if (!this.target || !this.target.scene) return;
|
|
344
|
+
var boxHelper = new THREE.BoxHelper(this.target.scene, 0x2bb8aa);
|
|
359
345
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
346
|
+
var _ref = boxHelper.geometry.boundingSphere || {},
|
|
347
|
+
center = _ref.center,
|
|
348
|
+
radius = _ref.radius;
|
|
349
|
+
|
|
350
|
+
if (!center || !radius) return;
|
|
351
|
+
var box = new THREE.Box3();
|
|
352
|
+
box.expandByObject(this.target.scene);
|
|
353
|
+
box.getCenter(center); // 距离
|
|
354
|
+
|
|
355
|
+
var distance = radius / Math.sin(Math.PI / 4) * 3;
|
|
356
|
+
{// debug
|
|
357
|
+
// const geometry = new THREE.SphereGeometry(radius, 32, 16)
|
|
358
|
+
// const material = new THREE.MeshBasicMaterial({ color: 0x0000aa, wireframe: true })
|
|
359
|
+
// const sphere = new THREE.Mesh(geometry, material)
|
|
360
|
+
// sphere.position.copy(center.clone())
|
|
361
|
+
// this.scene.add(sphere)
|
|
362
|
+
} // 朝向
|
|
364
363
|
|
|
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
364
|
var direction = (0, _coordsToDirection.coordsToDirection)({
|
|
369
365
|
longitude: longitude,
|
|
370
366
|
latitude: latitude
|
|
371
367
|
});
|
|
372
|
-
direction.setLength(distance
|
|
368
|
+
direction.setLength(distance);
|
|
373
369
|
this.camera.position.copy(center.clone().add(direction));
|
|
374
370
|
this.camera.lookAt(center);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
371
|
+
|
|
372
|
+
if (this.pointLight) {
|
|
373
|
+
var lightDirection = (0, _coordsToDirection.coordsToDirection)({
|
|
374
|
+
longitude: longitude,
|
|
375
|
+
latitude: -Math.PI / 6
|
|
376
|
+
});
|
|
377
|
+
lightDirection.setLength(distance * 3);
|
|
378
|
+
this.pointLight.position.copy(center.clone().add(lightDirection));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
var calcFov = function calcFov(distance, width, r) {
|
|
382
|
+
var vertical = r < 1 ? width / r : width;
|
|
383
|
+
var fov = Math.atan(vertical / distance / 2) * 2 * (180 / Math.PI);
|
|
384
|
+
return fov;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
var d = this.camera.position.distanceTo(center);
|
|
388
|
+
|
|
389
|
+
if (fov === 0) {
|
|
390
|
+
fov = calcFov(d, radius * 2, this.renderer.domElement.offsetWidth / this.renderer.domElement.offsetHeight);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
fov = Math.max(this.minFov, Math.min(this.maxFov, fov));
|
|
381
394
|
|
|
382
395
|
if (fov !== this.fov) {
|
|
383
|
-
fov = Math.max(25, Math.min(this.maxFov, fov));
|
|
384
396
|
this.camera.fov = fov;
|
|
385
397
|
this.camera.updateProjectionMatrix();
|
|
386
398
|
}
|
|
@@ -483,8 +495,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
483
495
|
return;
|
|
484
496
|
}
|
|
485
497
|
|
|
498
|
+
var fov = this.__pinchCurrentFov ? this.__pinchCurrentFov / scale : 1;
|
|
486
499
|
this.update({
|
|
487
|
-
fov:
|
|
500
|
+
fov: fov
|
|
488
501
|
});
|
|
489
502
|
}
|
|
490
503
|
}, {
|
|
@@ -526,8 +539,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
526
539
|
key: "__onMouseWheel",
|
|
527
540
|
value: function __onMouseWheel(event) {
|
|
528
541
|
this.__interiaMovement = false;
|
|
542
|
+
var fov = this.fov - event.delta;
|
|
529
543
|
this.update({
|
|
530
|
-
fov:
|
|
544
|
+
fov: fov <= 1 ? 1 : fov
|
|
531
545
|
});
|
|
532
546
|
}
|
|
533
547
|
}, {
|
|
@@ -541,8 +555,6 @@ var Controller = /*#__PURE__*/function () {
|
|
|
541
555
|
loader.load(url, function (gltf) {
|
|
542
556
|
_this6.setTarget(gltf);
|
|
543
557
|
|
|
544
|
-
_this6.callbacks.loaded(gltf);
|
|
545
|
-
|
|
546
558
|
resolve(true);
|
|
547
559
|
}, function (xhr) {
|
|
548
560
|
_this6.callbacks.progressing(xhr.loaded / xhr.total * 100);
|
|
@@ -602,6 +614,9 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
602
614
|
return _this7.emit('loadError', error);
|
|
603
615
|
}
|
|
604
616
|
});
|
|
617
|
+
Object.assign(window, {
|
|
618
|
+
$controller: controller
|
|
619
|
+
});
|
|
605
620
|
caches[_this7.uuid] = controller;
|
|
606
621
|
return _this7;
|
|
607
622
|
}
|
|
@@ -636,10 +651,10 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
636
651
|
});
|
|
637
652
|
return proxy;
|
|
638
653
|
},
|
|
639
|
-
set: function set(
|
|
640
|
-
var fov =
|
|
641
|
-
latitude =
|
|
642
|
-
longitude =
|
|
654
|
+
set: function set(_ref2) {
|
|
655
|
+
var fov = _ref2.fov,
|
|
656
|
+
latitude = _ref2.latitude,
|
|
657
|
+
longitude = _ref2.longitude;
|
|
643
658
|
var controller = caches[this.uuid];
|
|
644
659
|
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
645
660
|
controller.update({
|
|
@@ -648,11 +663,39 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
648
663
|
longitude: longitude === undefined ? controller.longitude : longitude
|
|
649
664
|
});
|
|
650
665
|
}
|
|
666
|
+
}, {
|
|
667
|
+
key: "minFov",
|
|
668
|
+
get: function get() {
|
|
669
|
+
var controller = caches[this.uuid];
|
|
670
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
671
|
+
return controller.minFov;
|
|
672
|
+
},
|
|
673
|
+
set: function set(fov) {
|
|
674
|
+
var controller = caches[this.uuid];
|
|
675
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
676
|
+
controller.config.minFov = fov;
|
|
677
|
+
controller.update({});
|
|
678
|
+
}
|
|
679
|
+
}, {
|
|
680
|
+
key: "maxFov",
|
|
681
|
+
get: function get() {
|
|
682
|
+
var controller = caches[this.uuid];
|
|
683
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
684
|
+
return controller.maxFov;
|
|
685
|
+
}
|
|
651
686
|
/**
|
|
652
687
|
*
|
|
653
688
|
* @param url glTF 模型CDN地址
|
|
689
|
+
* @param options adaptive 是否开启自适应fov
|
|
654
690
|
*/
|
|
655
|
-
|
|
691
|
+
,
|
|
692
|
+
set: function set(fov) {
|
|
693
|
+
var controller = caches[this.uuid];
|
|
694
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
695
|
+
console.log('maxFov', controller.config);
|
|
696
|
+
controller.config.maxFov = fov;
|
|
697
|
+
controller.update({});
|
|
698
|
+
}
|
|
656
699
|
}, {
|
|
657
700
|
key: "load",
|
|
658
701
|
value: function load(url) {
|
|
@@ -697,6 +740,19 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
697
740
|
if (controller.dispose) controller.dispose();
|
|
698
741
|
delete caches[this.uuid];
|
|
699
742
|
}
|
|
743
|
+
/**
|
|
744
|
+
* 响应式fov
|
|
745
|
+
*/
|
|
746
|
+
|
|
747
|
+
}, {
|
|
748
|
+
key: "fitFov",
|
|
749
|
+
value: function fitFov() {
|
|
750
|
+
var controller = caches[this.uuid];
|
|
751
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
752
|
+
controller.update({
|
|
753
|
+
fov: 0
|
|
754
|
+
});
|
|
755
|
+
}
|
|
700
756
|
}]);
|
|
701
757
|
return GLTFViewer;
|
|
702
758
|
}(_Subscribe2.Subscribe);
|
package/package.json
CHANGED
|
@@ -27,6 +27,8 @@ require("core-js/modules/es.object.to-string.js");
|
|
|
27
27
|
|
|
28
28
|
require("core-js/modules/es.regexp.to-string.js");
|
|
29
29
|
|
|
30
|
+
require("core-js/modules/es.promise.js");
|
|
31
|
+
|
|
30
32
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
31
33
|
|
|
32
34
|
var _react = require("@realsee/five/react");
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
4
|
|
|
5
|
-
require("core-js/modules/es.object.to-string.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.string.iterator.js");
|
|
8
6
|
|
|
9
7
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -27,6 +25,8 @@ require("core-js/modules/es.array.map.js");
|
|
|
27
25
|
|
|
28
26
|
require("core-js/modules/es.array.for-each.js");
|
|
29
27
|
|
|
28
|
+
require("core-js/modules/es.object.to-string.js");
|
|
29
|
+
|
|
30
30
|
require("core-js/modules/es.array.find-index.js");
|
|
31
31
|
|
|
32
32
|
require("core-js/modules/es.array.splice.js");
|
|
@@ -47,6 +47,8 @@ var _centerPoint = _interopRequireDefault(require("../../shared-utils/three/cent
|
|
|
47
47
|
|
|
48
48
|
var _transformPositionToVector = _interopRequireDefault(require("../../shared-utils/three/transformPositionToVector3"));
|
|
49
49
|
|
|
50
|
+
var _createResizeObserver = _interopRequireDefault(require("./utils/createResizeObserver"));
|
|
51
|
+
|
|
50
52
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
51
53
|
|
|
52
54
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -125,13 +127,19 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
125
127
|
var render = function () {
|
|
126
128
|
if (!inited) {
|
|
127
129
|
var css3DRendererSetSize = function css3DRendererSetSize() {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
// 这里evenNumber策略是遇到奇数会加1,不知道为啥会触发滚动条显示,导致fiveElement变小,fiveElement变小又触发了这里的resize,宽高变小,滚动条消失,然后又触发resize。。。无限循环
|
|
131
|
+
// 为了规避上面这种情况,evenNumber设置了一个参数,遇到奇数可选择减一
|
|
132
|
+
var rendererWidth = (0, _evenNumber["default"])(fiveElement.clientWidth, {
|
|
133
|
+
smaller: true
|
|
134
|
+
});
|
|
135
|
+
var rendererHeight = (0, _evenNumber["default"])(fiveElement.clientHeight, {
|
|
136
|
+
smaller: true
|
|
137
|
+
});
|
|
130
138
|
css3DRenderer.setSize(rendererWidth, rendererHeight);
|
|
131
139
|
};
|
|
132
140
|
|
|
133
141
|
css3DRendererSetSize();
|
|
134
|
-
resizeObserver =
|
|
142
|
+
resizeObserver = (0, _createResizeObserver["default"])(css3DRendererSetSize, fiveElement);
|
|
135
143
|
css3DRenderer.domElement.style.position = 'absolute';
|
|
136
144
|
css3DRenderer.domElement.style.top = '0';
|
|
137
145
|
css3DRenderer.domElement.style.userSelect = 'none';
|
|
@@ -144,10 +152,10 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
144
152
|
};
|
|
145
153
|
|
|
146
154
|
return function () {
|
|
147
|
-
var _resizeObserver;
|
|
155
|
+
var _resizeObserver, _resizeObserver$obser;
|
|
148
156
|
|
|
149
157
|
scene.add(css3DObject);
|
|
150
|
-
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.observe(
|
|
158
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : (_resizeObserver$obser = _resizeObserver.observe) === null || _resizeObserver$obser === void 0 ? void 0 : _resizeObserver$obser.call(_resizeObserver);
|
|
151
159
|
renderEveryFrame();
|
|
152
160
|
|
|
153
161
|
if (mode === 'behind' && mesh) {
|
|
@@ -190,9 +198,9 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
190
198
|
if (mode === 'behind') state.behindMode = undefined;
|
|
191
199
|
|
|
192
200
|
if (!state.behindMode && !state.frontMode) {
|
|
193
|
-
var _resizeObserver2;
|
|
201
|
+
var _resizeObserver2, _resizeObserver2$unob;
|
|
194
202
|
|
|
195
|
-
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.unobserve(
|
|
203
|
+
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : (_resizeObserver2$unob = _resizeObserver2.unobserve) === null || _resizeObserver2$unob === void 0 ? void 0 : _resizeObserver2$unob.call(_resizeObserver2);
|
|
196
204
|
}
|
|
197
205
|
}
|
|
198
206
|
|
|
@@ -209,9 +217,6 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
209
217
|
state.disposeCallbacks.push(dispose);
|
|
210
218
|
}
|
|
211
219
|
|
|
212
|
-
console.log({
|
|
213
|
-
autoRender: autoRender
|
|
214
|
-
});
|
|
215
220
|
if (autoRender) render();
|
|
216
221
|
return {
|
|
217
222
|
container: container,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = createResizeObserver;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description: 究极简陋的 ResizeObserver polyfill
|
|
12
|
+
*/
|
|
13
|
+
function createResizeObserver(func, element) {
|
|
14
|
+
if (!element || typeof ResizeObserver === 'undefined') {
|
|
15
|
+
return {
|
|
16
|
+
observe: function observe() {
|
|
17
|
+
return window.addEventListener('resize', func);
|
|
18
|
+
},
|
|
19
|
+
unobserve: function unobserve() {
|
|
20
|
+
return window.removeEventListener('resize', func);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
var observer = new ResizeObserver(func);
|
|
25
|
+
return {
|
|
26
|
+
observe: function observe() {
|
|
27
|
+
return observer.observe(element);
|
|
28
|
+
},
|
|
29
|
+
unobserve: function unobserve() {
|
|
30
|
+
return observer.unobserve(element);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -15,5 +15,5 @@ export interface ModelChassisCompassPluginExportType {
|
|
|
15
15
|
/**
|
|
16
16
|
* 模型底盘指南针插件
|
|
17
17
|
*/
|
|
18
|
-
declare const ModelChassisCompassPlugin: FivePlugin<ModelChassisCompassPluginParameterType, ModelChassisCompassPluginExportType>;
|
|
18
|
+
export declare const ModelChassisCompassPlugin: FivePlugin<ModelChassisCompassPluginParameterType, ModelChassisCompassPluginExportType>;
|
|
19
19
|
export default ModelChassisCompassPlugin;
|
|
@@ -21,7 +21,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", {
|
|
22
22
|
value: true
|
|
23
23
|
});
|
|
24
|
-
exports["default"] = void 0;
|
|
24
|
+
exports["default"] = exports.ModelChassisCompassPlugin = void 0;
|
|
25
25
|
|
|
26
26
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
27
27
|
|
|
@@ -153,5 +153,6 @@ var ModelChassisCompassPlugin = function ModelChassisCompassPlugin(five, params)
|
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
+
exports.ModelChassisCompassPlugin = ModelChassisCompassPlugin;
|
|
156
157
|
var _default = ModelChassisCompassPlugin;
|
|
157
158
|
exports["default"] = _default;
|
|
@@ -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,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
4
|
|
|
5
|
-
require("core-js/modules/es.object.to-string.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.string.iterator.js");
|
|
8
6
|
|
|
9
7
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -23,6 +21,8 @@ exports.ModelExtrudeWallsPlugin = void 0;
|
|
|
23
21
|
|
|
24
22
|
require("core-js/modules/es.array.for-each.js");
|
|
25
23
|
|
|
24
|
+
require("core-js/modules/es.object.to-string.js");
|
|
25
|
+
|
|
26
26
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
27
27
|
|
|
28
28
|
require("core-js/modules/es.function.name.js");
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
4
|
|
|
5
|
-
require("core-js/modules/es.object.to-string.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.string.iterator.js");
|
|
8
6
|
|
|
9
7
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -37,6 +35,8 @@ require("core-js/modules/es.array.concat.js");
|
|
|
37
35
|
|
|
38
36
|
require("core-js/modules/es.array.for-each.js");
|
|
39
37
|
|
|
38
|
+
require("core-js/modules/es.object.to-string.js");
|
|
39
|
+
|
|
40
40
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
41
41
|
|
|
42
42
|
require("core-js/modules/es.array.sort.js");
|
|
@@ -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;
|
|
@@ -23,6 +23,8 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
23
23
|
|
|
24
24
|
require("core-js/modules/es.array.for-each.js");
|
|
25
25
|
|
|
26
|
+
require("core-js/modules/es.object.to-string.js");
|
|
27
|
+
|
|
26
28
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
27
29
|
|
|
28
30
|
require("core-js/modules/es.array.map.js");
|
|
@@ -31,8 +33,6 @@ require("core-js/modules/es.array.iterator.js");
|
|
|
31
33
|
|
|
32
34
|
require("core-js/modules/es.array-buffer.slice.js");
|
|
33
35
|
|
|
34
|
-
require("core-js/modules/es.object.to-string.js");
|
|
35
|
-
|
|
36
36
|
require("core-js/modules/es.typed-array.float32-array.js");
|
|
37
37
|
|
|
38
38
|
require("core-js/modules/es.typed-array.copy-within.js");
|
|
@@ -99,6 +99,8 @@ require("core-js/modules/web.url-search-params.js");
|
|
|
99
99
|
|
|
100
100
|
require("core-js/modules/es.object.assign.js");
|
|
101
101
|
|
|
102
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
103
|
+
|
|
102
104
|
require("core-js/modules/es.array.find.js");
|
|
103
105
|
|
|
104
106
|
require("core-js/modules/es.array.reduce.js");
|