Hi Dominic
I''m thinking something like..
GEvent.addListener(this.maps[api], ''click'',
function(marker,location) {
// If the user puts their own Google markers directly on the map
// then there is no location and this event should not fire.
if ( location ) {
me.clickHandler(location.y,location.x,location,marker,me);
}
});
This would need to be repeated for each API
Mapstraction.clickHandler would be modified as well.
Mapstraction.prototype.clickHandler = function(lat,lon, marker, me) { //FIXME
need to consolidate some of these handlers...
for(var i = 0; i < this.eventListeners.length; i++) {
if(this.eventListeners[i][1] == ''click'') {
this.eventListeners[i][0](new LatLonPoint(lat,lon), marker);
}
}
}
Then if you wanted your own callback to receive the marker, you''d
define it like
map.addEventListener(''click'',function (point, marker) {
doClick(point, marker);
} );
If you were only interested in the point, then the old way should still work.
map.addEventListener(''click'',function (point) {
doClick(point);
} );
Mikel
----- Original Message ----
From: dominic depetris <ddepetris1 at yahoo.com>
To: Mikel Maron <mikel_maron at yahoo.com>; mapstraction at
openstreetmap.org
Sent: Wednesday, November 7, 2007 4:52:18 PM
Subject: Re: [Mapstraction] (no subject)
Hello Mikel,
Please understand that I am not the worlds best Javascript coder so bear with me
if I''m a little slow.
Currently I do the following;
map.addEventListener(''click'',function (point) {
doClick(point);
} );
where doClick does a bunch of stuff. You are saying that I would need to change
the addAPI in the mapstraction.js to do what I want. That''s where I
get lost. Would I, for example, for Google, change this
GEvent.addListener(this.maps[api], ''click'',
function(marker,location) {
// If the user puts their own Google markers directly on the map
// then there is no location and this event should not fire.
if ( location ) {
me.clickHandler(location.y,location.x,location,me);
}
});
to have an if (marker) option? Would I have to change the clickHandler
function?
Thanks for your help with this,
Dominic
----- Original Message ----
From: Mikel Maron <mikel_maron at yahoo.com>
To: dominic depetris <ddepetris1 at yahoo.com>; mapstraction at
openstreetmap.org
Sent: Tuesday, November 6, 2007 6:36:06 AM
Subject: Re: [Mapstraction] (no subject)
hi Dominic
Mapstraction would need some small tweaks to accomplish this.
Currently you can register a ''click'' event handler using
addEventListener. But the call back function only receives the lat/long of the
location clicked -- not a reference to the marker if it exists.
The interfaces to each API''s event handling is set up in addAPI. These
would need to be modified to pass through a reference to the mapstraction
marker. To retrieve the mapstraction marker linked to the proprietary marker, a
reference would need to be added in the Marker.setChild method.
Mikel
----- Original Message ----
From: dominic depetris <ddepetris1 at yahoo.com>
To: mapstraction at openstreetmap.org
Sent: Friday, November 2, 2007 12:36:17 PM
Subject: [Mapstraction] (no subject)
I am trying to figure out how to remove a specific marker on a map.
Let?s say there are 10 markers on a map and the user wants to remove
one of them by clicking on it. How do I know what marker has been
selected?
By the way, this program has been extremely helpful. Thanks!
Dominic
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Mapstraction mailing list
Mapstraction at lists.mapstraction.com
http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com