Thanks Steve, I''ll see about merging this stuff in.
On 24 August 2010 22:56, Mitchell, Steve <Steve.Mitchell at garmin.com>
wrote:
> Working on a Bing click handler.
>
>
>
> Looking at mxn.google.core.js I find the following:
>
>
>
> GEvent.addListener(this.maps[api], ''click'',
function(marker,location) {
>
>
> if ( marker && marker.mapstraction_marker ) {
>
> *marker.mapstraction_marker.click.fire()**;*
>
> }
>
> else if ( location ) {
>
> me.click.fire({''location'': new
mxn.LatLonPoint(location.y, location.x)});
>
> }
>
> // 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);
>
> }
>
> });
>
>
>
> Clearly, the line ?*marker.mapstraction_marker.click.fire()*? allows
> listeners to be added to a mxn.Marker for Google.
>
>
>
> Looking that mxn.microsoft.core.js implementation I find this:
>
>
>
> this.maps[api].AttachEvent(''onclick'', function(event){
>
> me.clickHandler();
>
> var x = event.mapX;
>
> var y = event.mapY;
>
> var pixel = new VEPixel(x,y);
>
> me.click.fire({''location'': new
mxn.LatLonPoint(pixel.Latitude,
> pixel.Longitude)});
>
> });
>
>
>
> This code allows a map to be clickable, but no specific markers.
>
>
>
> Further down in mxn.microsoft.core.js I find this:
>
>
>
> addMarker: function(marker, old) {
>
> var map = this.maps[this.api];
>
> marker.pinID = "mspin-"+new
>
Date().getTime()+''-''+(Math.floor(Math.random()*Math.pow(2,16)));
>
> var pin = marker.toProprietary(this.api);
>
> if (marker.iconUrl){
>
> pin.SetCustomIcon(marker.iconUrl);
>
> }
>
> map.AddShape(pin);
>
> //give onclick event
>
> //give on double click event
>
> //give on close window
>
> //return the marker
>
> return pin;
>
> },
>
>
>
> In my solution I did not add the call for mapstraction_marker.click.fire()
> at the red comment above. Instead, following the example in
> mxn.google.core.js, I added it at line 10 of mxn.microsoft.core.js in the
> existing ?onclick? event. See the bold lines below.
>
>
>
> this.maps[api].AttachEvent(''onclick'', function(event){
>
> me.clickHandler();
>
> *var map = me.maps[me.api];*
>
> *var shape = map.GetShapeByID(event.elementID);*
>
> *if (shape && shape.mapstraction_marker) {*
>
> *shape.mapstraction_marker.click.fire(); *
>
> *} else {*
>
> var x = event.mapX;
>
> var y = event.mapY;
>
> var pixel = new VEPixel(x,y);
>
> me.click.fire({''location'': new
mxn.LatLonPoint(pixel.Latitude,
> pixel.Longitude)})
>
> *}*
>
> });
>
>
>
>
>
>
>
> ------------------------------
> This e-mail and any attachments may contain confidential material for the
> sole use of the intended recipient. If you are not the intended recipient,
> please be aware that any disclosure, copying, distribution or use of this
> e-mail or any attachment is prohibited. If you have received this e-mail in
> error, please contact the sender and delete all copies.
>
> Thank you for your cooperation.
>
> _______________________________________________
> Mapstraction mailing list
> Mapstraction at lists.mapstraction.com
> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
>
>
--
Derek Fowler
m. +44 (0) 7966 512 369
e. dezfowler at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100825/cf74ab0d/attachment.htm>