Open javisantana opened 11 years ago
For any wandering souls out there, here is a workaround to get interactivity and non-flickering tiles in google maps when using wax:
wax.tilejson('url_to_tilejson.json', function(tilejson) {
var b = new wax.g.connector(tilejson);
var c = new google.maps.ImageMapType(b);
c.cache=b.cache;
c.interactive=true;
var old_getTile = c.getTile;
c.getTile=function(p,zoom,doc) {
var div=old_getTile.call(c,p,zoom,doc)
var key=zoom + '/' + p.x + '/' + p.y;
c.cache[key] = div;
c.cache[key].src = b.getTileUrl(p, zoom);
return div;
}
map.overlayMapTypes.insertAt(0, c);
wax.g.interaction().map(map).tilejson(tilejson).on(wax.tooltip().parent(map.getDiv()).events());
wax.g.interaction().map(map).tilejson(tilejson).on('on',function(o){console.log(o);});
});
the connector must be a MapType because the new google maps version wraps getTile method