fix: transform引起一直更新 & 丰富注释

This commit is contained in:
unanmed 2024-11-27 23:42:51 +08:00
parent c6cbdae5d5
commit 3d1e0a45c3
2 changed files with 7 additions and 1 deletions

View File

@ -138,6 +138,9 @@ export class MotaOffscreenCanvas2D extends EventEmitter<OffscreenCanvasEvent> {
MotaOffscreenCanvas2D.list.delete(this); MotaOffscreenCanvas2D.list.delete(this);
} }
/**
* 便
*/
freeze() { freeze() {
this._freezed = true; this._freezed = true;
MotaOffscreenCanvas2D.list.delete(this); MotaOffscreenCanvas2D.list.delete(this);

View File

@ -22,7 +22,9 @@ export interface IRenderUpdater {
} }
interface IRenderAnchor { interface IRenderAnchor {
/** 锚点横坐标0表示最左端1表示最右端 */
anchorX: number; anchorX: number;
/** 锚点纵坐标0表示最上端1表示最下端 */
anchorY: number; anchorY: number;
/** /**
@ -53,6 +55,7 @@ interface IRenderConfig {
} }
export interface IRenderChildable { export interface IRenderChildable {
/** 当前元素的子元素 */
children: Set<RenderItem>; children: Set<RenderItem>;
/** /**
@ -312,7 +315,7 @@ export abstract class RenderItem<E extends ERenderItemEvent = ERenderItemEvent>
if (this.hidden) return; if (this.hidden) return;
this.emit('beforeRender', transform); this.emit('beforeRender', transform);
this.needUpdate = false; this.needUpdate = false;
const tran = this.transformFallThrough ? transform : this.transform; const tran = this.transformFallThrough ? transform : this._transform;
const ax = -this.anchorX * this.width; const ax = -this.anchorX * this.width;
const ay = -this.anchorY * this.height; const ay = -this.anchorY * this.height;