three-base 2.0.64 → 2.0.66

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/ThreeBase.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: xiaosihan
3
3
  * @Date: 2021-12-20 13:38:22
4
4
  * @Last Modified by: xiaosihan
5
- * @Last Modified time: 2024-06-18 21:03:02
5
+ * @Last Modified time: 2024-08-10 04:23:41
6
6
  */
7
7
  import { round } from "lodash";
8
8
  import { AxesHelper, Box3, DepthFormat, DepthTexture, EventDispatcher, GridHelper, LinearFilter, MOUSE, Mesh, NoBlending, NormalBlending, OrthographicCamera, PerspectiveCamera, RGBAFormat, Scene, TOUCH, UnsignedShortType, Vector2, Vector3, WebGLRenderTarget, WebGLRenderer } from "three";
@@ -132,11 +132,13 @@ export default class ThreeBase extends EventDispatcher {
132
132
  div.append(this.renderer.domElement);
133
133
  if (this.rendererLost) {
134
134
  this.renderer.forceContextRestore();
135
- this.renderer.domElement.style.opacity = "1";
136
135
  this.needRender = true;
137
136
  setTimeout(() => {
138
137
  this.needRender = true;
139
138
  }, 100);
139
+ setTimeout(() => {
140
+ this.renderer.domElement.style.opacity = "1";
141
+ }, 200);
140
142
  }
141
143
  this.setSize(div.clientWidth, div.clientHeight);
142
144
  // 开启时时渲染
@@ -264,11 +266,11 @@ export default class ThreeBase extends EventDispatcher {
264
266
  // 设置控制器的位置 以动画的方式移动控制器
265
267
  async setLookAt({ position = this.perspectiveCamera.position, center = this.controls.target, duration = 1000 }) {
266
268
  // 停止控制器的惯性
267
- this.controls.enableDamping = false;
269
+ const originEnableDamping = this.controls.enableDamping;
268
270
  this.controls.saveState();
269
271
  this.controls.update();
270
272
  this.controls.reset();
271
- this.controls.enableDamping = true;
273
+ this.controls.enableDamping = originEnableDamping;
272
274
  let currentPosition = this.perspectiveCamera.position.clone();
273
275
  let currentCenter = this.controls.target.clone();
274
276
  // 等待动画执行完成
package/ThreeBase.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: xiaosihan
3
3
  * @Date: 2021-12-20 13:38:22
4
4
  * @Last Modified by: xiaosihan
5
- * @Last Modified time: 2024-06-18 21:03:02
5
+ * @Last Modified time: 2024-08-10 04:23:41
6
6
  */
7
7
 
8
8
  import { add, round } from "lodash";
@@ -151,11 +151,13 @@ export default class ThreeBase extends EventDispatcher {
151
151
 
152
152
  if (this.rendererLost) {
153
153
  this.renderer.forceContextRestore();
154
- this.renderer.domElement.style.opacity = "1";
155
154
  this.needRender = true;
156
155
  setTimeout(() => {
157
156
  this.needRender = true;
158
157
  }, 100);
158
+ setTimeout(() => {
159
+ this.renderer.domElement.style.opacity = "1";
160
+ }, 200);
159
161
  }
160
162
 
161
163
  this.setSize(div.clientWidth, div.clientHeight);
@@ -321,11 +323,11 @@ export default class ThreeBase extends EventDispatcher {
321
323
  }: { position: Vector3, center: Vector3, duration?: number }) {
322
324
 
323
325
  // 停止控制器的惯性
324
- this.controls.enableDamping = false;
326
+ const originEnableDamping = this.controls.enableDamping;
325
327
  this.controls.saveState();
326
328
  this.controls.update();
327
329
  this.controls.reset();
328
- this.controls.enableDamping = true;
330
+ this.controls.enableDamping = originEnableDamping;
329
331
 
330
332
  let currentPosition = this.perspectiveCamera.position.clone();
331
333
  let currentCenter = this.controls.target.clone();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "2.0.64",
3
+ "version": "2.0.66",
4
4
  "description": "three 3d three-base",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"