@realsee/dnalogel 0.1.7-alpha.2 → 0.1.7-alpha.6

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.
Files changed (157) hide show
  1. package/components/ARVideoFigure/ImgBgTransparentMesh.js +2 -2
  2. package/components/GLTFView/index.d.ts +7 -1
  3. package/components/GLTFView/index.js +7 -1
  4. package/components/GlassFilters/index.js +2 -2
  5. package/components/ModelView/ModelViewController.js +6 -5
  6. package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
  7. package/data/81zxMaeVKLQU93OZMG.js +633 -0
  8. package/data/PrXel3aqGbp34JQn.js +139 -1
  9. package/data/_vLykj3NWrllMrG06.d.ts +95 -0
  10. package/data/_vLykj3NWrllMrG06.js +1 -0
  11. package/data/vLykj3NWrllMrG06.js +335 -71
  12. package/libs/gltf-viewer/Subscribe.js +2 -0
  13. package/libs/gltf-viewer/coordsToDirection.d.ts +1 -1
  14. package/libs/gltf-viewer/index.d.ts +18 -0
  15. package/libs/gltf-viewer/index.js +133 -45
  16. package/package.json +3 -3
  17. package/plugins/CSS3DRenderPlugin/components/Marker/index.js +2 -0
  18. package/plugins/CSS3DRenderPlugin/index.js +2 -2
  19. package/plugins/ModelChassisCompassPlugin/index.d.ts +1 -1
  20. package/plugins/ModelChassisCompassPlugin/index.js +2 -1
  21. package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +4 -0
  22. package/plugins/ModelEntryDoorGuidePlugin/index.js +6 -1
  23. package/plugins/ModelExtrudeWallsPlugin/index.js +2 -2
  24. package/plugins/ModelRoomLabelPlugin/Controller.js +1 -0
  25. package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +5 -5
  26. package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +2 -2
  27. package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
  28. package/plugins/ModelRoomLabelPlugin/index.js +7 -2
  29. package/plugins/ModelTVVideoPlugin/index.js +4 -2
  30. package/plugins/ModelViewPlugin/index.js +2 -2
  31. package/plugins/PanoCursorRaycasterPlugin/index.js +2 -0
  32. package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
  33. package/plugins/PanoMeasurePlugin/Controller/BaseController.js +105 -0
  34. package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
  35. package/plugins/PanoMeasurePlugin/Controller/EditController.js +343 -0
  36. package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
  37. package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.js +69 -0
  38. package/plugins/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
  39. package/plugins/PanoMeasurePlugin/Controller/WatchController.js +373 -0
  40. package/plugins/PanoMeasurePlugin/Controller/index.d.ts +61 -0
  41. package/plugins/PanoMeasurePlugin/Controller/index.js +230 -0
  42. package/plugins/PanoMeasurePlugin/Model/index.d.ts +38 -0
  43. package/plugins/PanoMeasurePlugin/Model/index.js +237 -0
  44. package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
  45. package/plugins/PanoMeasurePlugin/Model/line.js +123 -0
  46. package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
  47. package/plugins/PanoMeasurePlugin/Model/point.js +72 -0
  48. package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
  49. package/plugins/PanoMeasurePlugin/Model/polyline.js +111 -0
  50. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
  51. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -0
  52. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
  53. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +11 -0
  54. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
  55. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +11 -0
  56. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
  57. package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.js +184 -0
  58. package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
  59. package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +68 -0
  60. package/plugins/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
  61. package/plugins/PanoMeasurePlugin/Modules/GuideController.js +107 -0
  62. package/plugins/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
  63. package/plugins/PanoMeasurePlugin/Modules/Magnifier.js +139 -0
  64. package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
  65. package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.js +26 -0
  66. package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
  67. package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +169 -0
  68. package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
  69. package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +59 -0
  70. package/plugins/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
  71. package/plugins/PanoMeasurePlugin/Modules/UIController/index.js +125 -0
  72. package/plugins/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
  73. package/plugins/PanoMeasurePlugin/Modules/UIController/style.js +103 -0
  74. package/plugins/PanoMeasurePlugin/index.d.ts +7 -0
  75. package/plugins/PanoMeasurePlugin/index.js +20 -0
  76. package/plugins/PanoMeasurePlugin/typings/data.d.ts +28 -0
  77. package/plugins/PanoMeasurePlugin/typings/data.js +7 -0
  78. package/plugins/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
  79. package/plugins/PanoMeasurePlugin/typings/event.type.js +7 -0
  80. package/plugins/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
  81. package/plugins/PanoMeasurePlugin/typings/utils.type.js +7 -0
  82. package/plugins/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
  83. package/plugins/PanoMeasurePlugin/utils/clearGroup.js +16 -0
  84. package/plugins/PanoMeasurePlugin/utils/constants.d.ts +4 -0
  85. package/plugins/PanoMeasurePlugin/utils/constants.js +47 -0
  86. package/plugins/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
  87. package/plugins/PanoMeasurePlugin/utils/distanceDom.js +147 -0
  88. package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
  89. package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.js +39 -0
  90. package/plugins/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
  91. package/plugins/PanoMeasurePlugin/utils/findClosestPoint.js +49 -0
  92. package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
  93. package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +20 -0
  94. package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
  95. package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +33 -0
  96. package/plugins/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
  97. package/plugins/PanoMeasurePlugin/utils/ironbox.js +14 -0
  98. package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
  99. package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.js +16 -0
  100. package/plugins/PanoMeasurePlugin/utils/line.d.ts +17 -0
  101. package/plugins/PanoMeasurePlugin/utils/line.js +61 -0
  102. package/plugins/PanoMeasurePlugin/utils/math.d.ts +17 -0
  103. package/plugins/PanoMeasurePlugin/utils/math.js +57 -0
  104. package/plugins/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
  105. package/plugins/PanoMeasurePlugin/utils/mouseGroup.js +42 -0
  106. package/plugins/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
  107. package/plugins/PanoMeasurePlugin/utils/ndc2Screen.js +16 -0
  108. package/plugins/PanoRulerPlugin/index.d.ts +4 -0
  109. package/plugins/PanoRulerPlugin/index.js +8 -3
  110. package/plugins/TreasurePlugin/Controller.js +2 -2
  111. package/plugins/TreasurePlugin/TreasureOpenAnime.js +2 -2
  112. package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -1
  113. package/plugins/floorplan/Assets/floorplanExtraObject.js +3 -3
  114. package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +5 -2
  115. package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +22 -11
  116. package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +4 -4
  117. package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +5 -5
  118. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +2 -2
  119. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +2 -2
  120. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.d.ts +11 -0
  121. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +174 -0
  122. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.d.ts +8 -0
  123. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.js +182 -0
  124. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +2 -0
  125. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +14 -2
  126. package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +3 -0
  127. package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +1 -1
  128. package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.d.ts +2 -0
  129. package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.js +7 -0
  130. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +1 -1
  131. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +1 -1
  132. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +3 -2
  133. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +4 -4
  134. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +2 -2
  135. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +2 -2
  136. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +2 -2
  137. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +2 -2
  138. package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +3 -0
  139. package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +16 -6
  140. package/plugins/floorplan/index.d.ts +4 -0
  141. package/plugins/floorplan/index.js +13 -0
  142. package/plugins/floorplan/typings/floorplanData.d.ts +2 -0
  143. package/plugins/floorplan/typings/floorplanServerData.d.ts +3 -1
  144. package/plugins/floorplan/typings/floorplanServerData.js +3 -3
  145. package/plugins/floorplan/utils/formatData.js +3 -2
  146. package/plugins/floorplan/utils/formatPosition.js +2 -0
  147. package/shared-utils/Subscribe.js +4 -2
  148. package/shared-utils/animationFrame/BetterTween.js +5 -1
  149. package/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
  150. package/shared-utils/{changeModelCanvansOpacity.js → changeModelCanvasOpacity.js} +2 -2
  151. package/shared-utils/filter.js +4 -2
  152. package/shared-utils/math/planimetry.js +2 -0
  153. package/shared-utils/removeArrayItem.d.ts +7 -0
  154. package/shared-utils/removeArrayItem.js +22 -0
  155. package/shared-utils/three/loadTexture.d.ts +2 -2
  156. package/shared-utils/three/loadTexture.js +21 -2
  157. package/shared-utils/changeModelCanvansOpacity.d.ts +0 -2
@@ -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
  /**
@@ -53,8 +62,17 @@ export declare class GLTFViewer extends Subscribe<GLTFViewerEventMap> {
53
62
  * @param size
54
63
  */
55
64
  appendTo(container: HTMLDivElement, size?: GLTFViewerSize): void;
65
+ /**
66
+ * 刷新:如果传递宽高则以该宽高重新绘制;否则,以父容器的宽高重新绘制。
67
+ * @param size
68
+ */
69
+ refresh(size?: GLTFViewerSize): void;
56
70
  /**
57
71
  * 销毁
58
72
  */
59
73
  dispose(): void;
74
+ /**
75
+ * 响应式fov
76
+ */
77
+ fitFov(): void;
60
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");
@@ -37,8 +37,6 @@ require("core-js/modules/es.date.to-string.js");
37
37
 
38
38
  require("core-js/modules/es.regexp.to-string.js");
39
39
 
40
- require("core-js/modules/es.number.is-integer.js");
41
-
42
40
  require("core-js/modules/es.number.constructor.js");
43
41
 
44
42
  require("core-js/modules/es.array.concat.js");
@@ -69,8 +67,6 @@ var _coordsMoveByOffset = require("./coordsMoveByOffset");
69
67
 
70
68
  var _getFrameTime = require("./getFrameTime");
71
69
 
72
- var _formatRad = require("./formatRad");
73
-
74
70
  var _coordsToDirection = require("./coordsToDirection");
75
71
 
76
72
  var _mouseWheel = require("./mouseWheel");
@@ -91,8 +87,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
91
87
 
92
88
  var defaultPos = {
93
89
  longitude: 0,
94
- latitude: -0.3,
95
- fov: 35
90
+ latitude: 0,
91
+ fov: 0
96
92
  };
97
93
  var ERROR_NO_CONTROLLER = 'GLTFViewer 实例丢失';
98
94
  var loader = new _GLTFLoader.GLTFLoader();
@@ -102,11 +98,14 @@ var Controller = /*#__PURE__*/function () {
102
98
  var _this = this;
103
99
 
104
100
  (0, _classCallCheck2["default"])(this, Controller);
105
- (0, _defineProperty2["default"])(this, "fov", 35);
101
+ (0, _defineProperty2["default"])(this, "fov", 0);
106
102
  (0, _defineProperty2["default"])(this, "longitude", 0);
107
- (0, _defineProperty2["default"])(this, "latitude", -0.3);
103
+ (0, _defineProperty2["default"])(this, "latitude", 0);
108
104
  (0, _defineProperty2["default"])(this, "needsRender", false);
109
- this.config = config; // 异步事件回调
105
+ this.config = Object.assign({
106
+ maxFov: 120,
107
+ minFov: 1
108
+ }, config); // 异步事件回调
110
109
 
111
110
  this.callbacks = callbacks; // 默认状态参数
112
111
 
@@ -137,8 +136,14 @@ var Controller = /*#__PURE__*/function () {
137
136
  alpha: true
138
137
  });
139
138
  this.renderer.outputEncoding = THREE.sRGBEncoding;
140
- this.renderer.toneMapping = THREE.ReinhardToneMapping;
141
- this.renderer.toneMappingExposure = 1.5;
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
+ }
142
147
 
143
148
  if (config.backgroundColor) {
144
149
  this.renderer.setClearColor(config.backgroundColor, 0);
@@ -150,10 +155,10 @@ var Controller = /*#__PURE__*/function () {
150
155
  } // 相机
151
156
 
152
157
 
153
- this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1, 10000); // 光照
158
+ this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1, 1500); // 光照
154
159
 
155
160
  if (config.pointLight !== false) {
156
- this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1, 100000);
161
+ this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1, 1500);
157
162
  this.scene.add(this.pointLight);
158
163
  }
159
164
 
@@ -221,7 +226,7 @@ var Controller = /*#__PURE__*/function () {
221
226
  (0, _createClass2["default"])(Controller, [{
222
227
  key: "minFov",
223
228
  get: function get() {
224
- return this.config.minFov || 20;
229
+ return this.config.minFov || 1;
225
230
  }
226
231
  }, {
227
232
  key: "maxFov",
@@ -236,8 +241,7 @@ var Controller = /*#__PURE__*/function () {
236
241
  key: "clear",
237
242
  value: function clear() {
238
243
  if (this.target) {
239
- this.scene.remove(this.target.scene); // disposeObject(this.target)
240
-
244
+ this.scene.remove(this.target.scene);
241
245
  this.update(defaultPos);
242
246
  this.target = undefined;
243
247
  }
@@ -275,6 +279,8 @@ var Controller = /*#__PURE__*/function () {
275
279
  _this3.target.scene.visible = true;
276
280
 
277
281
  _this3.update({});
282
+
283
+ _this3.callbacks.loaded(object);
278
284
  }
279
285
  }, 50);
280
286
  }
@@ -334,33 +340,59 @@ var Controller = /*#__PURE__*/function () {
334
340
  latitude = state.latitude;
335
341
  }
336
342
 
337
- var center = new THREE.Vector3();
338
- var box = new THREE.Box3();
343
+ if (!this.target || !this.target.scene) return;
344
+ var boxHelper = new THREE.BoxHelper(this.target.scene, 0x2bb8aa);
339
345
 
340
- if (this.target) {
341
- box.expandByObject(this.target.scene);
342
- box.getCenter(center);
343
- }
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
+ } // 朝向
344
363
 
345
- longitude = (0, _formatRad.formatRad)(longitude);
346
- latitude = Math.max(-Math.PI / 2 + 0.01, Math.min(+Math.PI / 2, latitude));
347
- var distance = Math.max(center.distanceTo(box.min), center.distanceTo(box.max));
348
364
  var direction = (0, _coordsToDirection.coordsToDirection)({
349
365
  longitude: longitude,
350
366
  latitude: latitude
351
367
  });
352
- direction.setLength(distance * 3);
368
+ direction.setLength(distance);
353
369
  this.camera.position.copy(center.clone().add(direction));
354
370
  this.camera.lookAt(center);
355
- var lightDirection = (0, _coordsToDirection.coordsToDirection)({
356
- longitude: longitude,
357
- latitude: -Math.PI / 6
358
- });
359
- lightDirection.setLength(distance * 3);
360
- if (this.pointLight) this.pointLight.position.copy(center.clone().add(lightDirection));
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));
361
394
 
362
395
  if (fov !== this.fov) {
363
- fov = Math.max(25, Math.min(this.maxFov, fov));
364
396
  this.camera.fov = fov;
365
397
  this.camera.updateProjectionMatrix();
366
398
  }
@@ -463,8 +495,9 @@ var Controller = /*#__PURE__*/function () {
463
495
  return;
464
496
  }
465
497
 
498
+ var fov = this.__pinchCurrentFov ? this.__pinchCurrentFov / scale : 1;
466
499
  this.update({
467
- fov: (this.__pinchCurrentFov || 0) / scale
500
+ fov: fov
468
501
  });
469
502
  }
470
503
  }, {
@@ -506,8 +539,9 @@ var Controller = /*#__PURE__*/function () {
506
539
  key: "__onMouseWheel",
507
540
  value: function __onMouseWheel(event) {
508
541
  this.__interiaMovement = false;
542
+ var fov = this.fov - event.delta;
509
543
  this.update({
510
- fov: this.fov - event.delta
544
+ fov: fov <= 1 ? 1 : fov
511
545
  });
512
546
  }
513
547
  }, {
@@ -521,8 +555,6 @@ var Controller = /*#__PURE__*/function () {
521
555
  loader.load(url, function (gltf) {
522
556
  _this6.setTarget(gltf);
523
557
 
524
- _this6.callbacks.loaded(gltf);
525
-
526
558
  resolve(true);
527
559
  }, function (xhr) {
528
560
  _this6.callbacks.progressing(xhr.loaded / xhr.total * 100);
@@ -582,6 +614,9 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
582
614
  return _this7.emit('loadError', error);
583
615
  }
584
616
  });
617
+ Object.assign(window, {
618
+ $controller: controller
619
+ });
585
620
  caches[_this7.uuid] = controller;
586
621
  return _this7;
587
622
  }
@@ -598,7 +633,7 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
598
633
  }, {
599
634
  set: function set(obj, prop, value) {
600
635
  if (prop === 'fov') {
601
- if (!Number.isInteger(value)) {
636
+ if (Number(value) === NaN) {
602
637
  throw new TypeError('The fov is not an number');
603
638
  }
604
639
 
@@ -616,10 +651,10 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
616
651
  });
617
652
  return proxy;
618
653
  },
619
- set: function set(_ref) {
620
- var fov = _ref.fov,
621
- latitude = _ref.latitude,
622
- longitude = _ref.longitude;
654
+ set: function set(_ref2) {
655
+ var fov = _ref2.fov,
656
+ latitude = _ref2.latitude,
657
+ longitude = _ref2.longitude;
623
658
  var controller = caches[this.uuid];
624
659
  if (!controller) throw new Error(ERROR_NO_CONTROLLER);
625
660
  controller.update({
@@ -628,11 +663,39 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
628
663
  longitude: longitude === undefined ? controller.longitude : longitude
629
664
  });
630
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
+ }
631
686
  /**
632
687
  *
633
688
  * @param url glTF 模型CDN地址
689
+ * @param options adaptive 是否开启自适应fov
634
690
  */
635
-
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
+ }
636
699
  }, {
637
700
  key: "load",
638
701
  value: function load(url) {
@@ -653,6 +716,18 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
653
716
  if (!controller) throw new Error(ERROR_NO_CONTROLLER);
654
717
  controller.appendTo(container, size);
655
718
  }
719
+ /**
720
+ * 刷新:如果传递宽高则以该宽高重新绘制;否则,以父容器的宽高重新绘制。
721
+ * @param size
722
+ */
723
+
724
+ }, {
725
+ key: "refresh",
726
+ value: function refresh(size) {
727
+ var controller = caches[this.uuid];
728
+ if (!controller) throw new Error(ERROR_NO_CONTROLLER);
729
+ controller.refresh(size);
730
+ }
656
731
  /**
657
732
  * 销毁
658
733
  */
@@ -665,6 +740,19 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
665
740
  if (controller.dispose) controller.dispose();
666
741
  delete caches[this.uuid];
667
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
+ }
668
756
  }]);
669
757
  return GLTFViewer;
670
758
  }(_Subscribe2.Subscribe);
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@realsee/dnalogel",
3
- "version": "0.1.7-alpha.2",
4
- "description": "如视前端 Componets、Plugins 兼部分 SDKs \"Dnalogel\" 库。",
3
+ "version": "0.1.7-alpha.6",
4
+ "description": "如视前端 Components、Plugins 兼部分 SDKs \"Dnalogel\" 库。",
5
5
  "author": "BEIKE REALSEE TECHNOLOGY (HK) LIMITED",
6
6
  "peerDependencies": {
7
- "@realsee/five": "^5.0.0-alpha.52",
7
+ "@realsee/five": "^5.0.0-alpha.84",
8
8
  "@tweenjs/tween.js": "^18.6.4",
9
9
  "@types/styled-jsx": "^2.2.9",
10
10
  "hammerjs": "^2.0.8",
@@ -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");
@@ -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");
@@ -71,6 +71,7 @@ var ModelRoomLabelController = /*#__PURE__*/function () {
71
71
  this.container.style.width = '100%';
72
72
  this.container.style.height = '100%';
73
73
  this.container.style.position = 'absolute';
74
+ this.container.style.pointerEvents = 'none';
74
75
  this.container.style.left = '0';
75
76
  this.container.style.top = '0'; // five lisenter
76
77
 
@@ -50,14 +50,14 @@ function RoomLabelItem(props, ref) {
50
50
  return /*#__PURE__*/React.createElement("div", {
51
51
  onClick: handleClick,
52
52
  ref: ref,
53
- className: _style["default"].dynamic([["3619298579", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item"
53
+ className: _style["default"].dynamic([["312299051", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item"
54
54
  }, /*#__PURE__*/React.createElement(_style["default"], {
55
- id: "3619298579",
55
+ id: "312299051",
56
56
  dynamic: [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]
57
- }, [".room-guid-label-plugin__item.__jsx-style-dynamic-selector{position:absolute;z-index:0;font-size:".concat((0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), ";-webkit-transform:'';-ms-transform:'';transform:'';cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"), ".room-guid-label-plugin__item-text.__jsx-style-dynamic-selector{position:absolute;left:0;top:".concat((0, _px2rem["default"])(-64), ";-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:").concat((0, _px2rem["default"])(20), ";min-width:").concat((0, _px2rem["default"])(32), ";padding:0 ").concat((0, _px2rem["default"])(6), ";pointer-events:all;background:url('//vrlab-static.ljcdn.com/release/web/room-label-bg.23e9d038.png') no-repeat;background-size:100% 100%;white-space:nowrap;}"), ".room-guid-label-plugin__item-bar.__jsx-style-dynamic-selector{position:absolute;top:".concat((0, _px2rem["default"])(-44), ";height:").concat((0, _px2rem["default"])(48), ";width:").concat((0, _px2rem["default"])(1), ";background-image:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}")]), /*#__PURE__*/React.createElement("span", {
58
- className: _style["default"].dynamic([["3619298579", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item-text"
57
+ }, [".room-guid-label-plugin__item.__jsx-style-dynamic-selector{position:absolute;z-index:0;font-size:".concat((0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), ";-webkit-transform:'';-ms-transform:'';transform:'';cursor:pointer;point-events:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"), ".room-guid-label-plugin__item-text.__jsx-style-dynamic-selector{position:absolute;left:0;top:".concat((0, _px2rem["default"])(-64), ";-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:").concat((0, _px2rem["default"])(20), ";min-width:").concat((0, _px2rem["default"])(32), ";padding:0 ").concat((0, _px2rem["default"])(6), ";pointer-events:all;background:url('//vrlab-static.ljcdn.com/release/web/room-label-bg.23e9d038.png') no-repeat;background-size:100% 100%;white-space:nowrap;}"), ".room-guid-label-plugin__item-bar.__jsx-style-dynamic-selector{position:absolute;top:".concat((0, _px2rem["default"])(-44), ";height:").concat((0, _px2rem["default"])(48), ";width:").concat((0, _px2rem["default"])(1), ";background-image:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}")]), /*#__PURE__*/React.createElement("span", {
58
+ className: _style["default"].dynamic([["312299051", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item-text"
59
59
  }, roomName), /*#__PURE__*/React.createElement("div", {
60
- className: _style["default"].dynamic([["3619298579", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item-bar"
60
+ className: _style["default"].dynamic([["312299051", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item-bar"
61
61
  }));
62
62
  }
63
63
 
@@ -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");
@@ -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");
@@ -25,6 +23,8 @@ require("core-js/modules/es.array.concat.js");
25
23
 
26
24
  require("core-js/modules/es.array.for-each.js");
27
25
 
26
+ require("core-js/modules/es.object.to-string.js");
27
+
28
28
  require("core-js/modules/web.dom-collections.for-each.js");
29
29
 
30
30
  require("core-js/modules/es.array.map.js");
@@ -13,6 +13,8 @@ require("core-js/modules/es.string.sub.js");
13
13
 
14
14
  require("core-js/modules/es.array.for-each.js");
15
15
 
16
+ require("core-js/modules/es.object.to-string.js");
17
+
16
18
  require("core-js/modules/web.dom-collections.for-each.js");
17
19
 
18
20
  var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));