Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

v1.0.0 API proposals

tmcw edited this page Oct 25, 2011 · 5 revisions

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.

setSize

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))

setExtent

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.

MouseWheelHandler

Should allow arbitrary zoom levels, optionally. And normalize mouse behavior a la D3.

Other

  • 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 also enforceLimits 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.).

Rename from com.modestmaps to MM

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.

Clone this wiki locally