The interaction control adds quite a bit of logic to the map, adding interactivity – mouse hovers and clicks – to layers that support it, like those made with TileMill and the interactive UTFGrid section of the MBTiles spec.
The interaction control takes a parameter, callbacks
, that has the
default value of new wax.tooltip()
– the default tooltip library that comes
with wax. Any other library that implements the same interface
(see tooltips.js
) can be passed into the callbacks parameter.
<div id='map-div'></div>
<script>
var mm = com.modestmaps;
wax.tilejson(
'http://tiles.mapbox.com/mapbox/api/Tileset/geography-class',
function(tilejson) {
var m = new mm.Map('map-div',
new wax.mm.connector(tilejson));
wax.mm.interaction(m, tilejson);
m.setCenterZoom(new mm.Location(39, -98), 1);
}
);
</script>
var interaction = wax.mm.interaction(map, tilejson, options)
window.location
when the 'location' formatter is used. In some cases, like when you're using
Backbone or another Javascript framework, you might want a different
Javascript link-follower, or do things like redirecting users to a 'leaving this site'
page. You can provide one with a clickHandler function.interaction.remove()