three-base 1.0.78 → 1.0.80

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.
@@ -358,5 +358,6 @@ export default class ExtrudeMesh extends Mesh {
358
358
  geometry.computeVertexNormals();
359
359
  this.geometry.dispose();
360
360
  this.geometry = geometry;
361
+ this.dispatchEvent({ type: "loaded" });
361
362
  }
362
363
  }
@@ -563,6 +563,8 @@ export default class ExtrudeMesh extends Mesh<BufferGeometry, Material> {
563
563
 
564
564
  this.geometry.dispose();
565
565
  this.geometry = geometry;
566
+
567
+ this.dispatchEvent({ type: "loaded" });
566
568
  }
567
569
 
568
570
 
@@ -62,5 +62,6 @@ export default class PlaneWithHtml extends Mesh {
62
62
  resolve();
63
63
  });
64
64
  });
65
+ this.dispatchEvent({ type: "loaded" });
65
66
  }
66
67
  }
@@ -77,7 +77,7 @@ export default class PlaneWithHtml extends Mesh {
77
77
 
78
78
  });
79
79
 
80
-
80
+ this.dispatchEvent({ type: "loaded" });
81
81
  }
82
82
 
83
83
 
@@ -54,6 +54,7 @@ export default class Text3D extends Mesh {
54
54
  bevelSegments: this._config.bevelSegments, //斜角分段
55
55
  });
56
56
  this.geometry.center();
57
+ this.dispatchEvent({ type: "loaded" });
57
58
  }
58
59
  });
59
60
  }
@@ -81,6 +81,7 @@ export default class Text3D extends Mesh {
81
81
  bevelSegments: this._config.bevelSegments,//斜角分段
82
82
  });
83
83
  this.geometry.center();
84
+ this.dispatchEvent({ type: "loaded" });
84
85
  }
85
86
  })
86
87
 
@@ -42,7 +42,7 @@ export default class ThreeBase extends EventDispatcher {
42
42
  needRender: boolean;
43
43
  stopRender(): void;
44
44
  render(): void;
45
- renderBindThis: any;
45
+ private renderBindThis;
46
46
  download(fileName?: string): void;
47
47
  private _preMesh;
48
48
  private _preRT;
package/lib/ThreeBase.ts CHANGED
@@ -309,7 +309,7 @@ export default class ThreeBase extends EventDispatcher {
309
309
  this.dispatchEvent({ type: "afterRender" });
310
310
  }
311
311
 
312
- renderBindThis = this.render.bind(this);
312
+ private renderBindThis = this.render.bind(this);
313
313
 
314
314
  // 下载渲染图
315
315
  download(fileName: string = "download") {
@@ -23,9 +23,7 @@ export default class Transition {
23
23
  _: {
24
24
  [key: string]: number;
25
25
  };
26
- onChangeCall?: (josn: {
27
- [key: string]: number;
28
- }) => void;
26
+ private onChangeCall;
29
27
  run({ timeTemp }: any): this;
30
28
  runbindThis: any;
31
29
  onChange(onChangeCall: (josn: {
package/lib/Transition.js CHANGED
@@ -23,7 +23,7 @@ export default class Transition {
23
23
  constructor(param = {}, bezier = [0.8, 0, 0.2, 1], duration = 500) {
24
24
  this.setDuration(duration);
25
25
  this.setBezier(bezier);
26
- this.set(param);
26
+ this.reset(param);
27
27
  }
28
28
  // 所有的 key 的枚举
29
29
  _keys = [];
@@ -57,7 +57,7 @@ export default class Transition {
57
57
  }
58
58
  // 存储 每个参数的 起始位置 起始时间 终止位置 终止时间
59
59
  _ = {};
60
- onChangeCall;
60
+ onChangeCall = (josn) => { };
61
61
  // 执行过度动画
62
62
  run({ timeTemp }) {
63
63
  this.timeTemp = timeTemp;
@@ -133,9 +133,9 @@ export default class Transition {
133
133
  // // 执行状态未完成
134
134
  // this._isDone = false;
135
135
  }
136
- threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
137
- threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
138
136
  if (!this._isDone) {
137
+ threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
138
+ threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
139
139
  await new Promise(resolve => setTimeout(resolve, this._duration + 50));
140
140
  }
141
141
  return this;
@@ -143,6 +143,9 @@ export default class Transition {
143
143
  // 重置起始和终止位置
144
144
  reset(param) {
145
145
  for (let key in param) {
146
+ if (!this._keys.includes(key)) {
147
+ this._keys.push(key);
148
+ }
146
149
  this._[key + "_start"] = param[key];
147
150
  this._[key + "_end"] = param[key];
148
151
  this._[key + "_startTime"] = -this._duration;
package/lib/Transition.ts CHANGED
@@ -36,7 +36,7 @@ export default class Transition {
36
36
 
37
37
  this.setBezier(bezier);
38
38
 
39
- this.set(param);
39
+ this.reset(param);
40
40
  }
41
41
 
42
42
  // 所有的 key 的枚举
@@ -82,7 +82,7 @@ export default class Transition {
82
82
  // 存储 每个参数的 起始位置 起始时间 终止位置 终止时间
83
83
  _: { [key: string]: number } = {};
84
84
 
85
- onChangeCall?: (josn: { [key: string]: number }) => void;
85
+ private onChangeCall = (josn: { [key: string]: number }) => { };
86
86
 
87
87
  // 执行过度动画
88
88
  run({ timeTemp }: any) {
@@ -185,10 +185,9 @@ export default class Transition {
185
185
 
186
186
  }
187
187
 
188
- threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
189
- threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
190
-
191
188
  if (!this._isDone) {
189
+ threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
190
+ threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
192
191
  await new Promise(resolve => setTimeout(resolve, this._duration + 50));
193
192
  }
194
193
 
@@ -198,6 +197,11 @@ export default class Transition {
198
197
  reset(param: TParam): this {
199
198
 
200
199
  for (let key in param) {
200
+
201
+ if (!this._keys.includes(key)) {
202
+ this._keys.push(key);
203
+ }
204
+
201
205
  this._[key + "_start"] = param[key];
202
206
  this._[key + "_end"] = param[key];
203
207
  this._[key + "_startTime"] = -this._duration;
@@ -99,5 +99,6 @@ export default class PlaneModal1 extends Mesh {
99
99
  textPos.y += size;
100
100
  });
101
101
  this.texture.needsUpdate = true;
102
+ this.dispatchEvent({ type: "loaded" });
102
103
  }
103
104
  }
@@ -143,6 +143,7 @@ export default class PlaneModal1 extends Mesh {
143
143
 
144
144
  this.texture.needsUpdate = true;
145
145
 
146
+ this.dispatchEvent({ type: "loaded" });
146
147
  }
147
148
 
148
149
 
@@ -95,6 +95,7 @@ export default class SpritModal1 extends Sprite {
95
95
  textPos.y += size;
96
96
  });
97
97
  this.texture.needsUpdate = true;
98
+ this.dispatchEvent({ type: "loaded" });
98
99
  }
99
100
  //鼠标拾取计算
100
101
  raycast(raycaster, intersects) {
@@ -140,6 +140,7 @@ export default class SpritModal1 extends Sprite {
140
140
 
141
141
  this.texture.needsUpdate = true;
142
142
 
143
+ this.dispatchEvent({ type: "loaded" });
143
144
  }
144
145
 
145
146
  //鼠标拾取计算
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "1.0.78",
3
+ "version": "1.0.80",
4
4
  "description": "three 3d three-base",
5
5
  "repository": {
6
6
  "type": "git",