@cc-component/cc-ex-component 1.7.9 → 1.8.1
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/assets/core/ViewModel.ts +8 -5
- package/package.json +1 -1
package/assets/core/ViewModel.ts
CHANGED
|
@@ -294,6 +294,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
294
294
|
|
|
295
295
|
protected onLoad(): void {
|
|
296
296
|
super.onLoad()
|
|
297
|
+
this.onTouch()
|
|
297
298
|
this.managerData()
|
|
298
299
|
}
|
|
299
300
|
// 在 withDataBinding 返回的 class 中
|
|
@@ -309,11 +310,11 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
309
310
|
|
|
310
311
|
|
|
311
312
|
protected onEnable(): void {
|
|
312
|
-
|
|
313
|
+
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
protected onDisable(): void {
|
|
316
|
-
this.offTouch()
|
|
317
|
+
// this.offTouch()
|
|
317
318
|
}
|
|
318
319
|
|
|
319
320
|
refreshData(key: string, value: any) {
|
|
@@ -322,9 +323,11 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
322
323
|
|
|
323
324
|
resetButtonScale(btn: Button) {
|
|
324
325
|
if (btn.transition === Button.Transition.SCALE && ExComponentModule.EmitAnim()) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
326
|
+
if (btn[this.touch_start_scale]) {
|
|
327
|
+
btn.node.off(Node.EventType.TOUCH_START, btn[this.touch_start_scale]);
|
|
328
|
+
btn.node.off(Node.EventType.TOUCH_END, btn[this.touch_end_scale]);
|
|
329
|
+
btn.node.off(Node.EventType.TOUCH_CANCEL, btn[this.touch_end_scale]);
|
|
330
|
+
}
|
|
328
331
|
const scale = btn.zoomScale;
|
|
329
332
|
btn[this.touch_start_scale] = () => {
|
|
330
333
|
tween(btn.node).to(btn.duration, { scale: v3(scale, scale, scale) }).start()
|