2 listeners for the same event?
google.maps.event.addDomListener(addFenceText, 'click', function
() {
addGeofenceMode = true;
deleteGeofenceMode = false;
editGeofenceMode = false;
});
google.maps.event.addDomListener(addFenceText, 'click',
handleAddClick);
On Jul 28, 1:28 pm, DuFF <[email protected]> wrote:
> I have a map which allows the user to draw, edit, and delete polygons.
> You can switch between draw, edit, and delete modes by selecting from
> a custom control drop down menu. Here is my code:
>
> var geofenceControlDiv = document.createElement('DIV');
> // Drop down menu
> var controlText = document.createElement('SELECT');
> controlText.style.fontFamily = 'Arial,sans-serif';
> controlText.style.fontSize = '12px';
> controlText.innerHTML = '<option selected>Geofence</option>';
> controlUI.appendChild(controlText);
>
> var addFenceText = document.createElement('OPTION');
> addFenceText.style.fontFamily = 'Arial,sans-serif';
> addFenceText.style.fontSize = '12px';
> addFenceText.innerHTML = "Add Geofence";
> controlText.appendChild(addFenceText);
>
> var remFenceText = document.createElement('OPTION');
> remFenceText.style.fontFamily = 'Arial,sans-serif';
> remFenceText.style.fontSize = '12px';
> remFenceText.innerHTML = "Delete Geofence";
> controlText.appendChild(remFenceText);
>
> var editFenceText = document.createElement('OPTION');
> editFenceText.style.fontFamily = 'Arial,sans-serif';
> editFenceText.style.fontSize = '12px';
> editFenceText.innerHTML = "Edit Geofence";
> controlText.appendChild(editFenceText);
>
> google.maps.event.addDomListener(addFenceText, 'click', function
> () {
> addGeofenceMode = true;
> deleteGeofenceMode = false;
> editGeofenceMode = false;
> });
> google.maps.event.addDomListener(addFenceText, 'click',
> handleAddClick);
> google.maps.event.addDomListener(remFenceText, 'click', function
> () {
> addGeofenceMode = false;
> deleteGeofenceMode = true;
> editGeofenceMode = false;
> });
> google.maps.event.addDomListener(editFenceText, 'click', function
> () {
> addGeofenceMode = false;
> deleteGeofenceMode = false;
> editGeofenceMode = true;
> });
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.