Map position to 0,0 after selection release and mouse click on the map

Topics: Bugs
Aug 23, 2013 at 9:27 AM
Edited Aug 23, 2013 at 9:30 AM
I found the following bug.
Your solution to release the selected area works fine.
However it reveals a bug. After selection of the area, the selection is emptied. Then when I click on the map the map position moves to 0, 0 (lat, lng).

In my situation:
mGmapControl.DragButton = MouseButtons.Left;
mGmapControl.DisableAltForSelection = true;

// on release of the selected area
mGmapControl.OnSelectionChange += new SelectionChange(mGmapControl_OnSelectionRelease);

/// <summary>
/// Zoom to selected area
/// </summary>
private void mGmapControl_OnSelectionRelease(RectLatLng Selection, bool ZoomToFit)
{
     mGmapControl.SetZoomToFitRect(Selection);
     mGmapControl.SelectedArea = RectLatLng.Empty;
     mGmapControl.ReloadMap();
}
You can reproduce the bug in your demo project.
In the MainForm.cs:

Add on line 79:
MainMap.DragButton = MouseButtons.Left;
MainMap.DisableAltForSelection = true;
Add on line 114:
MainMap.OnSelectionChange += new SelectionChange(MainMap_SelectionChange);  
Add on line 259:
private void MainMap_SelectionChange(RectLatLng Selection, bool ZoomToFit)
{
          MainMap.SetZoomToFitRect(Selection);
          MainMap.SelectedArea = RectLatLng.Empty;
          MainMap.ReloadMap();
}
Aug 23, 2013 at 10:32 AM
because you set zero position in MainMap_SelectionChange, internally after selection change it zooms to selected area
Aug 23, 2013 at 10:38 AM
Edited Aug 23, 2013 at 10:44 AM
p.s. if you hold the Shift

..and i've added small change, maybe it helps
Aug 23, 2013 at 11:18 AM
I've tested with the change you made in RectLatLng.cs. Doesn' t make a difference.
I'm trying to create a work around.