Marker Fix
Hi,
I just started developing with the modest maps as3 trunk.
For my markers (that were MovieClips), the markers were not put on the right location out of the box.
I had to fix the file com.modestmaps.core.MarkerClip.as following to center the markers exactly on the middle of the location:
public function updateClip(marker:DisplayObject):void
{
var location:Location = locations[marker];
var point:Point = map.locationPoint(location, this);
marker.x = point.x - marker.width/2;
marker.y = point.y - marker.height/2;
}
I dont know if this patch is necessary generally or only for my implementation. Maybe it could be helpful for someone else.
Mugdi
I just started developing with the modest maps as3 trunk.
For my markers (that were MovieClips), the markers were not put on the right location out of the box.
I had to fix the file com.modestmaps.core.MarkerClip.as following to center the markers exactly on the middle of the location:
public function updateClip(marker:DisplayObject):void
{
var location:Location = locations[marker];
var point:Point = map.locationPoint(location, this);
marker.x = point.x - marker.width/2;
marker.y = point.y - marker.height/2;
}
I dont know if this patch is necessary generally or only for my implementation. Maybe it could be helpful for someone else.
Mugdi
1
person likes this idea
I like this idea!
Tell me when this idea gets some attention.
The more people who like this idea, the more it gets noticed.
The more people who like this idea, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?Useful hack, thanks for letting us know it was an issue.
I think I prefer the current version, where my markers are centered at 0,0. The simplest marker I tested with was a sprite with a circle drawn at 0,0.
If you don't want to modify the modest maps source you can always add your marker movie clips to a Sprite which you pass to putMarker, and center the movie clip using the method above instead.
I’m thankful
Loading Profile...



EMPLOYEE