Øyvind Håkestad
2008-Mar-12 11:42 UTC
[Mapstraction] Execute custom code when clicking marker
Hello there! :) I''m new to this list and new to Mapstraction. I''m working at ?stfold University College in Norway as part of the Mobile Applications Group (MAG - http://mobapp.hiof.no/) and I''m developing a tool ("Storix") for viewing digital stories with references to time and place. Take a look at http://asia.hiof.no/storix if this sounds interesting (Firefox only at this time). At the moment, I''m in the process of exchanging Google Maps for Mapstraction in Storix. In relation to this, I have some proposals for a few changes in Mapstraction. I may help implement these, but I do not know the framework nor you methodology well enough to do this at the moment (I have, however, done a couple of hacks in Mapstraction to give it the functionality that I need, so these are not changes that are urgent to me nor my work). The thing that is most important for me is to be able to fire a function when a marker is clicked. The way Mapstraction seems to work at the moment, is to open an info bubble when a marker is clicked. What about making a function (for example Marker.addListener()) which takes a function as argument. When (for example) the GEvent is created in the toGoogle() function, the function added by addListener() could be assigned to the GEvent instead of the function (which calls gmarker.openInfoWindowHtml()) that is assigned now. Further, the addListener() function could take the event type as argument in addition to the function, but as I do not know which events are supported by the different map providers, I don''t know if this is a good idea. This could possibly eliminate setInfoDiv() (and code related to it), as the function passed to addListener() could handle such functionality. It seems to me that the Mapstraction.clickHandler() may give functionality similar to what I need, but I don''t really understand how to use it at the moment. A couple of additional comments: setHover() seems not to be mentioned in the documentation. Also, the clickHandler() function takes an argument "me" that seems not to be in use. Lastly, I will use the opportunity to let you know that I think Mapstraction seems to be a great tool! Keep up the good work! :) Cheers, ?yvind.