Frage

I have a canvas with zoom (ScaleTransform). Now I have scaled the canvas by some arbitrary zoom value. I'm adding RectangleGeomtry at the MouseDown Point with every MouseDown event. But the strange thing is the Shape is getting added to the canvas with some +/-dx and +/-dy to the MouseDown Point.

Any leads on why this happening is much appreciated.

War es hilfreich?

Lösung

In a scaled canvas, you should get an inverse transform (Scale and Translate) of the point and then apply transform (Scale and Translate) after constructing geometry. It worked. I am not sure if that's the best way.

Andere Tipps

When you apply a scale transform all points get transformed (moved). For instance if you have point A(10,20) and you apply a scale of 2 to the image your point A will now be A(20,40). When you want to add a point to a scaled image you must adjust the coordinates like that ... (multiply by scale)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top