您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
1.0 KiB
36 行
1.0 KiB
using UIWidgets.painting;
|
|
using UIWidgets.ui;
|
|
using Matrix4x4 = UnityEngine.Matrix4x4;
|
|
|
|
namespace UIWidgets.flow {
|
|
public class TransformLayer : ContainerLayer {
|
|
private Matrix4x4 _tranform;
|
|
|
|
public Matrix4x4 transform {
|
|
set { this._tranform = value; }
|
|
}
|
|
|
|
public override void preroll(PrerollContext context, Matrix4x4 matrix) {
|
|
var childMatrix = this._tranform * matrix;
|
|
|
|
Rect childPaintBounds = Rect.zero;
|
|
this.prerollChildren(context, childMatrix, ref childPaintBounds);
|
|
|
|
childPaintBounds = MatrixUtils.transformRect(this._tranform, childPaintBounds);
|
|
this.paintBounds = childPaintBounds;
|
|
}
|
|
|
|
public override void paint(PaintContext context) {
|
|
var canvas = context.canvas;
|
|
|
|
canvas.save();
|
|
try {
|
|
canvas.concat(this._tranform);
|
|
this.paintChildren(context);
|
|
}
|
|
finally {
|
|
canvas.restore();
|
|
}
|
|
}
|
|
}
|
|
}
|