internal void GoToCurrentPositionOnZoom() { renderOffset = MapPoint.Empty; centerTileXYLocationLast = MapPoint.Empty; dragPoint = MapPoint.Empty; if (MouseWheelZooming) { if (MouseWheelZoomType != MouseWheelZoomType.MousePositionWithoutCenter) { MapPoint pt = new MapPoint(-(CurrentPositionGPixel.X - Width / 2), -(CurrentPositionGPixel.Y - Height / 2)); renderOffset.X = pt.X - dragPoint.X; renderOffset.Y = pt.Y - dragPoint.Y; } else { renderOffset.X = -CurrentPositionGPixel.X - dragPoint.X; renderOffset.Y = -CurrentPositionGPixel.Y - dragPoint.Y; renderOffset.Offset(mouseLastZoom); } } else { mouseLastZoom = MapPoint.Empty; MapPoint pt = new MapPoint(-(CurrentPositionGPixel.X - Width / 2), -(CurrentPositionGPixel.Y - Height / 2)); renderOffset.X = pt.X - dragPoint.X; renderOffset.Y = pt.Y - dragPoint.Y; } UpdateCenterTileXYLocation(); }
public MapPoint FromLatLngToLocal(PointLatLng latlng) { MapPoint pLocal = Projection.FromLatLngToPixel(latlng, Zoom); pLocal.Offset(renderOffset); return(pLocal); }
public void DragOffset(MapPoint offset) { renderOffset.Offset(offset); UpdateCenterTileXYLocation(); if (centerTileXYLocation != centerTileXYLocationLast) { centerTileXYLocationLast = centerTileXYLocation; UpdateBounds(); } { LastLocationInBounds = CurrentPosition; CurrentPosition = FromLocalToLatLng((int)Width / 2, (int)Height / 2); } if (OnMapDrag != null) { OnMapDrag(); } }