コード例 #1
0
 protected override Size ArrangeOverride(Size finalSize)
 {
     foreach (UIElement child in Children)
     {
         var finalRect         = new Rect(0.0, 0.0, _ViewportSize.Width, _ViewportSize.Height);
         var positionRectangle = GetPositionRectangle(child);
         if (positionRectangle is object)
         {
             finalRect = MapMath.LocationToViewportPoint(ref _NormalizedMercatorToViewport, positionRectangle);
         }
         else
         {
             var position = GetPosition(child);
             if (position is object && MapMath.TryLocationToViewportPoint(ref _NormalizedMercatorToViewport, position, out var viewportPosition))
             {
                 var positionOrigin = GetPositionOrigin(child);
                 viewportPosition.X -= positionOrigin.X * child.DesiredSize.Width;
                 viewportPosition.Y -= positionOrigin.Y * child.DesiredSize.Height;
                 finalRect           = new Rect(viewportPosition.X, viewportPosition.Y, child.DesiredSize.Width, child.DesiredSize.Height);
             }
         }
         var positionOffset = GetPositionOffset(child);
         finalRect.X += positionOffset.X;
         finalRect.Y += positionOffset.Y;
         child.Arrange(finalRect);
     }
     return(_ViewportSize);
 }