B4J Question GoogleMaps Marker - Dragged To New Location - Where?

RichardN

Well-Known Member
Licensed User
Longtime User
If you move a draggable Marker to a new location there is no exposure of it's new LatLng position as there is no Marker_Drop event to exploit.

How is it possible to read the new position? Is it possible to listen for this event?
 

TILogistic

Expert
Licensed User
Longtime User
see:


googlemapext.bas
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
tips:


Class EventHandlers

google.maps.event.addListener(map, 'event_type', function(event) {
document.jsHandlers.handleUIEvent('key', event.latLng);
});

JSX:
   google.maps.event.addListener(marker, 'dragstart', function () {
     ...
    });

    google.maps.event.addListener(marker, 'drag', function () {
    ...
    });

    google.maps.event.addListener(marker, 'dragend', function () {
    ...
    })
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
@oparra.... Thanks for the suggestions however @Erel appears to be suggesting that implementing a listener event for Marker DragStart/Drag/DragEnd may not be as simple as we imagine.

To usefully employ a user generated sequence of Google Map Markers you must be able to do one of the following..... either,

- Keep a List of their positions in code...... which requires capturing a marker's position AFTER a drag event or,
- Be able to iterate through the markers as a collection, capturing their positions when the user is done editing. Something like....

This would be great!:
'Sadly markers are not a collection that can be accessed

For Each m As Marker In GoogleMap
    Log(m.Position.Latitude & ", " & m.Position.Longitude)
Next

Unfortunately it appears neither method is available.
 
Upvote 0
Top