|
|
|
|
|
|
|
|
|
|
public class RenderTransform : RenderProxyBox { |
|
|
|
public RenderTransform( |
|
|
|
Matrix4x4 transform, |
|
|
|
Matrix3 transform, |
|
|
|
Offset origin = null, |
|
|
|
Alignment alignment = null, |
|
|
|
bool transformHitTests = true, |
|
|
|
|
|
|
|
|
|
|
public bool transformHitTests; |
|
|
|
|
|
|
|
public Matrix4x4 transform { |
|
|
|
public Matrix3 transform { |
|
|
|
set { |
|
|
|
if (this._transform == value) { |
|
|
|
return; |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Matrix4x4 _transform; |
|
|
|
Matrix3 _transform; |
|
|
|
this._transform = Matrix4x4.identity; |
|
|
|
this._transform = Matrix3.I(); |
|
|
|
this._transform = Matrix4x4.Rotate(Quaternion.Euler((float) degrees, 0, 0)) * this._transform; |
|
|
|
this.markNeedsPaint(); |
|
|
|
//2D, do nothing
|
|
|
|
this._transform = Matrix4x4.Rotate(Quaternion.Euler(0, (float) degrees, 0)) * this._transform; |
|
|
|
this.markNeedsPaint(); |
|
|
|
//2D, do nothing
|
|
|
|
this._transform = Matrix4x4.Rotate(Quaternion.Euler(0, 0, (float) degrees)) * this._transform; |
|
|
|
this._transform = Matrix3.makeRotate((float) degrees) * this._transform; |
|
|
|
this._transform = Matrix4x4.Translate(new Vector3((float) x, (float) y, (float) z)) * this._transform; |
|
|
|
this._transform = Matrix3.makeTrans((float)x, (float)y) * this._transform; |
|
|
|
this._transform = Matrix4x4.Scale(new Vector3((float) x, (float) y, (float) z)) * this._transform; |
|
|
|
this._transform = Matrix3.makeScale((float) x, (float) y) * this._transform; |
|
|
|
Matrix4x4 _effectiveTransform { |
|
|
|
Matrix3 _effectiveTransform { |
|
|
|
get { |
|
|
|
Alignment resolvedAlignment = this.alignment; |
|
|
|
if (this._origin == null && resolvedAlignment == null) { |
|
|
|
|
|
|
var result = Matrix4x4.identity; |
|
|
|
var result = Matrix3.I(); |
|
|
|
result = Matrix4x4.Translate(new Vector2((float) this._origin.dx, (float) this._origin.dy)) * |
|
|
|
result = Matrix3.makeTrans((float) this._origin.dx, (float) this._origin.dy) * |
|
|
|
result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
result = Matrix4x4.Translate(new Vector2((float) translation.dx, (float) translation.dy)) * result; |
|
|
|
result = Matrix3.makeTrans((float) translation.dx, (float) translation.dy) * result; |
|
|
|
result = Matrix4x4.Translate(new Vector2((float) -translation.dx, (float) -translation.dy)) * |
|
|
|
result = Matrix3.makeTrans((float) -translation.dx, (float) -translation.dy) * |
|
|
|
result = Matrix4x4.Translate(new Vector2((float) -this._origin.dx, (float) -this._origin.dy)) * |
|
|
|
result = Matrix3.makeTrans((float) -this._origin.dx, (float) -this._origin.dy) * |
|
|
|
result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public override bool hitTest(HitTestResult result, Offset position = null) { |
|
|
|
return this.hitTestChildren(result, position: position); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (transform.determinant == 0) { |
|
|
|
var inverse = Matrix3.I(); |
|
|
|
var invertible = transform.invert(inverse); |
|
|
|
|
|
|
|
if (!invertible) { |
|
|
|
position = transform.inverse.transformPoint(position); |
|
|
|
position = inverse.mapPoint(position); |
|
|
|
} |
|
|
|
|
|
|
|
return base.hitTestChildren(result, position: position); |
|
|
|
|
|
|
if (this.child != null) { |
|
|
|
if (this.child != null) |
|
|
|
{ |
|
|
|
|
|
|
|
if (childOffset == null) { |
|
|
|
context.pushTransform(this.needsCompositing, offset, transform, base.paint); |
|
|
|
} else { |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public override void applyPaintTransform(RenderObject child, ref Matrix4x4 transform) { |
|
|
|
public override void applyPaintTransform(RenderObject child, ref Matrix3 transform) { |
|
|
|
properties.add(new DiagnosticsProperty<Matrix4x4>("transform matrix", this._transform)); |
|
|
|
properties.add(new DiagnosticsProperty<Matrix3>("transform matrix", this._transform)); |
|
|
|
properties.add(new DiagnosticsProperty<Offset>("origin", this.origin)); |
|
|
|
properties.add(new DiagnosticsProperty<Alignment>("alignment", this.alignment)); |
|
|
|
properties.add(new DiagnosticsProperty<bool>("transformHitTests", this.transformHitTests)); |
|
|
|