|
@@ -26,7 +26,7 @@ class CompBase<T extends object> extends Container {
|
|
|
radius: "",
|
|
|
position: "absolute" as "absolute" | "relative",
|
|
|
children: [] as string[],
|
|
|
- dirty: 0,
|
|
|
+ matrix: "matrix(1,0,0,1,0,0)",
|
|
|
});
|
|
|
|
|
|
constructor(value:T) {
|
|
@@ -101,9 +101,7 @@ class CompBase<T extends object> extends Container {
|
|
|
const state = this.state;
|
|
|
const style :any = {opacity: state.opacity}
|
|
|
const size = state.size;
|
|
|
- // const pos = state.pos;
|
|
|
- let _ = state.dirty;
|
|
|
- // _ = state.rotation as any;
|
|
|
+
|
|
|
|
|
|
if (!state.visible) {
|
|
|
style.display = "none";
|
|
@@ -136,8 +134,7 @@ class CompBase<T extends object> extends Container {
|
|
|
|
|
|
style.transformOrigin = `0 0`;
|
|
|
// const transform = new Matrix();
|
|
|
-
|
|
|
- style.transform = this.localTransform.getMatrixStr(utils.designSizeToPx);
|
|
|
+ style.transform = this.state.matrix;
|
|
|
}
|
|
|
|
|
|
return style;
|
|
@@ -187,7 +184,7 @@ class CompBase<T extends object> extends Container {
|
|
|
const obj = CompBase.objsMap.get(c) as any;
|
|
|
worldNoChange ? this.addChildWorldNoChange(obj) : this.addChild(obj);
|
|
|
})
|
|
|
- this.updateTransform();
|
|
|
+ this.updateMatrix();
|
|
|
this.changingChildWordNoChange=undefined;
|
|
|
}
|
|
|
|
|
@@ -217,19 +214,25 @@ class CompBase<T extends object> extends Container {
|
|
|
let targetPivot = pivots[index];
|
|
|
|
|
|
let point = { x: targetPivot.x, y: targetPivot.y } as any;
|
|
|
- this.transform.worldTransform.apply(point, point);
|
|
|
+ this.transform.localTransform.apply(point, point);
|
|
|
|
|
|
this.transform.pivot = targetPivot as any;
|
|
|
this.transform.position.x = point.x;
|
|
|
this.transform.position.y = point.y;
|
|
|
|
|
|
- this.updateTransform();
|
|
|
+ this.updateMatrix();
|
|
|
|
|
|
this.pivotIndex = index;
|
|
|
|
|
|
+
|
|
|
return { x: point.x, y: point.y};
|
|
|
}
|
|
|
|
|
|
+ updateMatrix() {
|
|
|
+ this.updateTransform();
|
|
|
+ this.state.setMatrix(this.localTransform.getMatrixStr(utils.designSizeToPx))
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
export {CompBase};
|