How to use TransformToVisual with PlaneProjection present?
Posted: 14 Nov 2017, 16:27
I have a child inside a scrollviewer that is offset from it about (10,80) pixels. The code below works OK as long as the firstChild control has no PlaneProjection attached.
Without PlaneProjection, I get resultVector == -16,-79.21875,0,1
With PlaneProjection on firstChild, I get resultVector == -268.247,488.8769,-2322.5,0.9999921
This is not a blocker, since I can compute the offsets before applying any transforms (in which case I can just use matrix[3].XY since there's only translation), however curious to know.
Code: Select all
// get coordinates of a specific point relative to parent
Point pointToTransform = new Point(10, 20);
Matrix4 matrix = container.TransformToVisual(firstChild)
Vector4 resultVector = (new Vector4(pointToTransform.X, pointToTransform.Y, 0, 1) * transformMatrix);
Point result = resultVector.XY;
With PlaneProjection on firstChild, I get resultVector == -268.247,488.8769,-2322.5,0.9999921
This is not a blocker, since I can compute the offsets before applying any transforms (in which case I can just use matrix[3].XY since there's only translation), however curious to know.