浏览代码

fix transform bug for Mathf.PI.

/main
kg 6 年前
当前提交
e86c8698
共有 3 个文件被更改,包括 23 次插入5 次删除
  1. 11
      Runtime/rendering/object.cs
  2. 13
      Runtime/ui/geometry.cs
  3. 4
      Runtime/ui/matrix.cs

11
Runtime/rendering/object.cs


public void pushTransform(bool needsCompositing, Offset offset, Matrix3 transform,
PaintingContextCallback painter) {
var effectiveTransform = Matrix3.makeTrans(offset.dx, offset.dy);
effectiveTransform.preConcat(transform);
effectiveTransform.preTranslate(-offset.dx, -offset.dy);
Matrix3 effectiveTransform;
if (offset == null || offset == Offset.zero) {
effectiveTransform = transform;
} else {
effectiveTransform = Matrix3.makeTrans(offset.dx, offset.dy);
effectiveTransform.preConcat(transform);
effectiveTransform.preTranslate(-offset.dx, -offset.dy);
}
if (needsCompositing) {
var inverse = Matrix3.I();

13
Runtime/ui/geometry.cs


Mathf.Floor(this.right), Mathf.Floor(this.bottom));
}
public Rect normalize() {
if (this.left <= this.right && this.top <= this.bottom) {
return this;
}
return fromLTRB(
Mathf.Min(this.left, this.right),
Mathf.Min(this.top, this.bottom),
Mathf.Max(this.left, this.right),
Mathf.Max(this.top, this.bottom)
);
}
public static Rect lerp(Rect a, Rect b, float t) {
if (a == null && b == null) {
return null;

4
Runtime/ui/matrix.cs


src.top + ty,
src.right + tx,
src.bottom + ty
);
).normalize();
return true;
}

src.top * sy + ty,
src.right * sx + tx,
src.bottom * sy + ty
);
).normalize();
}
public static bool operator ==(Matrix3 a, Matrix3 b) {

正在加载...
取消
保存