/// <summary>
/// Update our coordinates to reflect a new top-left pixel
/// </summary>
/// <param name="topLeftXY">The top-left pixel</param>
public void UpdateFromXY(Point topLeftXY)
{
var max = Point.Subtract(LngLatToXY(new PointF(180, -75), ZoomLevel), DisplayRectangle.Size);
var min = LngLatToXY(new PointF(-180, 82), ZoomLevel);
topLeftXY.X = Math.Max(Math.Min(max.X, topLeftXY.X), min.X);
topLeftXY.Y = Math.Max(Math.Min(max.Y, topLeftXY.Y), min.Y);
//Point.Subtract(TopLeftXY, DisplayRectangle.Size)
PointF oldCenter = Center;
//Update our top-left coordinates
this.TopLeftXY = topLeftXY;
this.TopLeft = XYToLngLat(topLeftXY, ZoomLevel);
//Determine our bottom-right pixel
this.BottomRightXY = Point.Add(topLeftXY, DisplayRectangle.Size);
this.BottomRight = XYToLngLat(this.BottomRightXY, ZoomLevel);
if (this.Panned != null)
{
this.Panned(oldCenter, Center);
}
}