lythreeframe 1.1.0 → 1.1.2

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.
@@ -3031,8 +3031,8 @@ class TransformGizmo extends Pawn {
3031
3031
  this.onDraggingChangedEvent = (param) => { this.onDraggingChanged(param); };
3032
3032
  this.onObjectChangeEvent = () => { this.onObjectChanged(); };
3033
3033
  this.onChangeEvent = () => { this.onChange(); };
3034
- this.onUpdateFunctions = [];
3035
- this.onDraggingFunctions = [];
3034
+ this.onUpdateFunction = null;
3035
+ this.onDraggingFunction = null;
3036
3036
  let canvas = controller.viewPort.canvas;
3037
3037
  if (!canvas) {
3038
3038
  throw new Error("TransformGizmo:Canvas not found");
@@ -3079,6 +3079,7 @@ class TransformGizmo extends Pawn {
3079
3079
  });
3080
3080
  }
3081
3081
  onChange() {
3082
+ console.log("onChange");
3082
3083
  this.controller.viewPort.markRenderStateDirty();
3083
3084
  }
3084
3085
  onDraggingChanged(event) {
@@ -3086,11 +3087,12 @@ class TransformGizmo extends Pawn {
3086
3087
  let tMatrix = this.primaryTarget.getMatrixInWorld();
3087
3088
  tMatrix.decompose(this.helperObject.position, this.helperObject.quaternion, this.helperObject.scale);
3088
3089
  }
3089
- this.onDraggingFunctions.forEach((elem) => {
3090
- elem(event.value);
3091
- });
3090
+ if (this.onDraggingFunction) {
3091
+ this.onDraggingFunction(event.value);
3092
+ }
3092
3093
  }
3093
3094
  onObjectChanged() {
3095
+ console.log("onObjectChanged");
3094
3096
  if (this.primaryTarget) {
3095
3097
  //const TA1 = this.primaryTarget.getMatrixInWorld();
3096
3098
  this.helperObject.updateMatrixWorld(true);
@@ -3108,9 +3110,9 @@ class TransformGizmo extends Pawn {
3108
3110
  }
3109
3111
  });
3110
3112
  }
3111
- this.onUpdateFunctions.forEach((elem) => {
3112
- elem();
3113
- });
3113
+ if (this.onUpdateFunction) {
3114
+ this.onUpdateFunction();
3115
+ }
3114
3116
  }
3115
3117
  set enable(newEnable) {
3116
3118
  this.control.enabled = newEnable;
@@ -3130,13 +3132,10 @@ class TransformGizmo extends Pawn {
3130
3132
  this.targetMatrixMap.set(elem, TB_local);
3131
3133
  });
3132
3134
  if (onUpdate) {
3133
- this.onUpdateFunctions.push(onUpdate);
3134
- }
3135
- if (onUpdate) {
3136
- this.onUpdateFunctions.push(onUpdate);
3135
+ this.onUpdateFunction = onUpdate;
3137
3136
  }
3138
3137
  if (onDragging) {
3139
- this.onDraggingFunctions.push(onDragging);
3138
+ this.onDraggingFunction = onDragging;
3140
3139
  }
3141
3140
  this.isTickEnabled = true;
3142
3141
  }
@@ -3182,8 +3181,8 @@ class TransformGizmo extends Pawn {
3182
3181
  this.targetMatrixMap.clear();
3183
3182
  this.targets = [];
3184
3183
  this.primaryTarget = null;
3185
- this.onUpdateFunctions = [];
3186
- this.onDraggingFunctions = [];
3184
+ this.onUpdateFunction = null;
3185
+ this.onDraggingFunction = null;
3187
3186
  (_a = this._control) === null || _a === void 0 ? void 0 : _a.dispose();
3188
3187
  this._control = null;
3189
3188
  super.destroy();
@@ -3029,8 +3029,8 @@ class TransformGizmo extends Pawn {
3029
3029
  this.onDraggingChangedEvent = (param) => { this.onDraggingChanged(param); };
3030
3030
  this.onObjectChangeEvent = () => { this.onObjectChanged(); };
3031
3031
  this.onChangeEvent = () => { this.onChange(); };
3032
- this.onUpdateFunctions = [];
3033
- this.onDraggingFunctions = [];
3032
+ this.onUpdateFunction = null;
3033
+ this.onDraggingFunction = null;
3034
3034
  let canvas = controller.viewPort.canvas;
3035
3035
  if (!canvas) {
3036
3036
  throw new Error("TransformGizmo:Canvas not found");
@@ -3077,6 +3077,7 @@ class TransformGizmo extends Pawn {
3077
3077
  });
3078
3078
  }
3079
3079
  onChange() {
3080
+ console.log("onChange");
3080
3081
  this.controller.viewPort.markRenderStateDirty();
3081
3082
  }
3082
3083
  onDraggingChanged(event) {
@@ -3084,11 +3085,12 @@ class TransformGizmo extends Pawn {
3084
3085
  let tMatrix = this.primaryTarget.getMatrixInWorld();
3085
3086
  tMatrix.decompose(this.helperObject.position, this.helperObject.quaternion, this.helperObject.scale);
3086
3087
  }
3087
- this.onDraggingFunctions.forEach((elem) => {
3088
- elem(event.value);
3089
- });
3088
+ if (this.onDraggingFunction) {
3089
+ this.onDraggingFunction(event.value);
3090
+ }
3090
3091
  }
3091
3092
  onObjectChanged() {
3093
+ console.log("onObjectChanged");
3092
3094
  if (this.primaryTarget) {
3093
3095
  //const TA1 = this.primaryTarget.getMatrixInWorld();
3094
3096
  this.helperObject.updateMatrixWorld(true);
@@ -3106,9 +3108,9 @@ class TransformGizmo extends Pawn {
3106
3108
  }
3107
3109
  });
3108
3110
  }
3109
- this.onUpdateFunctions.forEach((elem) => {
3110
- elem();
3111
- });
3111
+ if (this.onUpdateFunction) {
3112
+ this.onUpdateFunction();
3113
+ }
3112
3114
  }
3113
3115
  set enable(newEnable) {
3114
3116
  this.control.enabled = newEnable;
@@ -3128,13 +3130,10 @@ class TransformGizmo extends Pawn {
3128
3130
  this.targetMatrixMap.set(elem, TB_local);
3129
3131
  });
3130
3132
  if (onUpdate) {
3131
- this.onUpdateFunctions.push(onUpdate);
3132
- }
3133
- if (onUpdate) {
3134
- this.onUpdateFunctions.push(onUpdate);
3133
+ this.onUpdateFunction = onUpdate;
3135
3134
  }
3136
3135
  if (onDragging) {
3137
- this.onDraggingFunctions.push(onDragging);
3136
+ this.onDraggingFunction = onDragging;
3138
3137
  }
3139
3138
  this.isTickEnabled = true;
3140
3139
  }
@@ -3180,8 +3179,8 @@ class TransformGizmo extends Pawn {
3180
3179
  this.targetMatrixMap.clear();
3181
3180
  this.targets = [];
3182
3181
  this.primaryTarget = null;
3183
- this.onUpdateFunctions = [];
3184
- this.onDraggingFunctions = [];
3182
+ this.onUpdateFunction = null;
3183
+ this.onDraggingFunction = null;
3185
3184
  (_a = this._control) === null || _a === void 0 ? void 0 : _a.dispose();
3186
3185
  this._control = null;
3187
3186
  super.destroy();
@@ -25,8 +25,8 @@ export declare class TransformGizmo extends Pawn {
25
25
  }) => void;
26
26
  protected onObjectChangeEvent: () => void;
27
27
  protected onChangeEvent: () => void;
28
- protected onUpdateFunctions: (() => void)[];
29
- protected onDraggingFunctions: ((event: any) => void)[];
28
+ protected onUpdateFunction: (() => void) | null;
29
+ protected onDraggingFunction: ((event: any) => void) | null;
30
30
  constructor(controller: Controller);
31
31
  possess(): void;
32
32
  unpossess(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",