-
Notifications
You must be signed in to change notification settings - Fork 152
v1.0.0 API proposals
This page lists proposed changes to Modest Maps JS v0.x.x that would be require a major API increment. We should coordinate these changes if possible to make sure it's easy to keep up with the latest versions.
Should be cleaned up to always take a com.modestmaps.Point (or x/y Object and the callback should always pass a MM.Point https://github.com/stamen/modestmaps-js/issues/54
before:
setSize(x, y);
setSize({x: 0, y: 0}); // or setSize(new com.modestmaps.Point(0, 0))
after:
setSize({x: 0, y: 0}); // or setSize(new com.modestmaps.Point(0, 0))
Historically setExtent
has rounded zoom levels (which means round-tripping getExtent and setExtent is a lossy process). @tmcw added support for precise zoom levels with an optional parameter but it might be worth revisiting the choice of default for 1.0.
Should allow arbitrary zoom levels, optionally. And normalize mouse behavior a la D3.
- adding and removing handlers could/should be easier
- adding and removing callbacks could/should be easier
- the callbacks for 'extentset', 'centered', 'panned' and 'zoomed' overlap in their definitions and usage and aren't consistently fired. It might be simplest to rely on a single 'changed' event that fires as soon as centerCoordinate is modified, and the 'drawn' event that fires whenever a frame completes.
*
provider.outerLimits
has always been tricky for people to understand, as it affects tile URL generation and alsoenforceLimits
in the Map. Setting provider limits to describe the tiles that exist on the server should be simple. Setting Map limits to describe the permitted centers and zoom levels should be separate and simple too.
Though it's not currently a published part of the API, it might be useful to review the current MM DOM structure (tile-loaded classes, layer divs, etc.) and version it along with the JS API. There are also several JS functions that are undocumented in the API and could/should be wrapped in a single object or hidden as privately as possible in our current JS architecture (getStats, enforceLimits, draw, getTileComplete, requestRedraw, getRedraw, createOrGetLayer, checkCache, getCenterDistanceCompare, etc.).
https://github.com/stamen/modestmaps-js/issues/26
The library should be visible from window.MM
by default, either in replacement or alongside window.com.modestmaps
. A noConflict
function should be added to keep this from being dangerous.