Use Matrix for projection relative scale

This commit is contained in:
ClemensFischer 2026-01-20 09:48:16 +01:00
parent 2c9e478095
commit ab155a26e7
21 changed files with 93 additions and 104 deletions

View file

@ -88,13 +88,13 @@ namespace MapControl
protected override Size MeasureOverride(Size availableSize)
{
double scale;
if (ParentMap == null || (scale = ParentMap.GetMapScale(ParentMap.Center).X) <= 0d)
if (ParentMap == null)
{
return new Size();
}
var p = ParentMap.GetMapToViewTransform(ParentMap.Center).Transform(new Point(1d, 0d));
var scale = Math.Sqrt(p.X * p.X + p.Y * p.Y);
var length = MinWidth / scale;
var magnitude = Math.Pow(10d, Math.Floor(Math.Log10(length)));