Draw/Drag FNC Maps Rectangle

I would like to be able to define a rectangle on a map by clicking and dragging out an area.

Attached are the modifications that I have made to the UDemo code in "PolyElements, Markers and Popups".

I would like to keep dynamically drawing/updating the changing shape of the rectangle as the mouse is being moved after a click (i.e. dragging out the area) in the MapMouseMove event.

This, however, results in the MapMouseUp event not getting fired. If I do not change/dynamically update the rectangle in the MapMouseMove event, the MapMouseUp event does get fired.

Any help on getting this to would would be much appreciatedUDemo.dfm (13.1 KB) UDemo.pas (12.2 KB)

Depending on zoomlevel change the latitude and longitude so that the mouse pointer is outside the rectangle.

dragRectangle.SouthWest.Latitude := AEventData.Coordinate.Latitude+0.2;
dragRectangle.NorthEast.Longitude := AEventData.Coordinate.Longitude-0.2;