TLabel – simple, smaller labels on Google Maps

If You use Google Maps API, probably You want to use smaller windows/labels on map than default infoWindow, which happens to be huge and bloated.

When I started Run-N-Share almost two years ago, I stumbled upon TLabel, minimalistic library for creating labels on Google Maps. It is abandoned project, but it still works with current API version (110a). However there are some issues with it. For example when You close label, and then move map or zoom in or out, there will be Java Script error. I have fixed recently this error for RNS, so if You are still using TLabel, here are some details.

When removeTLabel is called, DOM element representing label is destroyed, but handlers registered to refresh view after zoomend or moveend events does not get unregister. To fix it change lines with GEvent.bind in TLabel.prototype.initialize to:

    this.zoom_handler = GEvent.bind(a,"zoomend",this,function(){this.setPosition()});
    this.move_handler = GEvent.bind(a,"moveend",this,function(){this.setPosition()});

Then in GMap2.prototype.removeTLabel add at function begin:

    GEvent.removeListener (a.zoom_handler)
    GEvent.removeListener (a.move_handler)


Eventually – does anybody knows similar library to TLabel? Maybe it is time to switch?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.