mirror of
https://github.com/motajs/template.git
synced 2026-11-09 03:34:30 +08:00
fix: container-custom 的渲染问题
This commit is contained in:
1 parent
bf6d64cce1
commit
5b1f866409
1 file changed
+6
-2
@@ -11,7 +11,7 @@ import {
|
||||
export class Container extends RenderItem {
|
||||
sortedChildren: RenderItem[] = [];
|
||||
|
||||
private needSort: boolean = false;
|
||||
protected needSort: boolean = false;
|
||||
|
||||
protected render(
|
||||
canvas: MotaOffscreenCanvas2D,
|
||||
@@ -84,7 +84,7 @@ export class Container extends RenderItem {
|
||||
}
|
||||
}
|
||||
|
||||
private sortChildren() {
|
||||
protected sortChildren() {
|
||||
this.sortedChildren = [...this.children]
|
||||
.filter(v => !v.isComment)
|
||||
.sort((a, b) => a.zIndex - b.zIndex);
|
||||
@@ -131,6 +131,10 @@ export class CustomContainer extends Container {
|
||||
canvas: MotaOffscreenCanvas2D,
|
||||
transform: Transform
|
||||
): void {
|
||||
if (this.needSort) {
|
||||
this.sortChildren();
|
||||
this.needSort = false;
|
||||
}
|
||||
if (!this.renderFn) {
|
||||
super.render(canvas, transform);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user