Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Aug 11, 2010
  1. @mbostock

    Limit the size of "world-size" tiles.

    mbostock authored
    If we make the tiles actually world size, then there are precision problems at
    high zoom levels as the contents of the tiles are translated by millions of
    pixels (67M at zoom level 18). To avoid this, we now limit the maximum tile size
    to 2^16, such that the tile contents are always positioned relatively closely to
    the center of the map.
    
    In the event that more than one "world-size" tile would be visible (e.g., near
    Greenwich), we only show the tile that overlaps the center of the map. Thus,
    when the map is zoomed out, we now only show one copy of the data rather than
    multiple copies.
Commits on Aug 10, 2010
  1. @mbostock

    Allow compass pan controls to be hidden.

    mbostock authored
    The panning circle can be hidden by setting `compass.pan("none")`. This option
    is now used in the examples to reduce visual clutter while still providing a
    reliable alternative to mousewheel zooming. Note that the compass control must
    be configured before being added to the map (at least for now).
  2. @mbostock

    Add compass control to examples.

    mbostock authored
    I'm not a huge fan of the compass control cluttering up the examples, but on the
    other hand, we haven't yet figured out a way to support mousewheel interaction
    consistently across browsers. So it's good to have the compass control available
    as an obvious way to zoom in. (Dblclick, shift-dblclick, and +/- also work.)
  3. @mbostock
  4. @mbostock

    Change the semantics of `map.centerRange`.

    mbostock authored
    Previously, the centerRange constraint would directly restrict the allowed
    latitudes and longitude of the map center. This was not particularly useful,
    since usually you want to restrict the viewable area of the map, rather than the
    center point. In addition, the map had an internal constraint that the visible
    latitudes be between [-85.05112877980659, 85.05112877980659]. If zoomed out such
    that this entire range were visible, the map would be centered vertically. There
    was also a bug if the map were rotated at certain angles where this constraint
    would not be enforced correctly.
    
    The new meaning of centerRange is the "viewable" area of the world, and defaults
    to [
    
      {lat: -85.05112877980659, lon: -Infinity},
      {lat: 85.05112877980659, lon: Infinity}
    
    ], which subsumes the previous internal constraint. Thus, the internal
    constraint can now be disabled by setting the centerRange to null. If a
    centerRange is set, then at least some of the area within the centerRange is
    guaranteed to be visible. Note, however, that this visible area may be
    infinitely small. Thus, if the user pushes the map off the screen entirely, it
    is always immediately off the edge of the viewport, easily available to be
    brought back into view.
    
    The motivation for this commit is three-fold: First, it allows the internal
    constraint to be disabled, which is particularly useful for cases where the map
    tiles aren't really spherical mercator projections of the Earth. Second, it
    allows panning restrictions to be defined in a way that is more convenient than
    under previous semantics. Lastly, it guarantees that when zooming in (say, via
    mousewheel or dblclick), the visible location under the mouse is guaranteed to
    stay under the mouse after the zoom level changes.
  5. @mbostock

    Ignore invalid latitudes in hash control.

    mbostock authored
    If the latitude specified was -90 or less, or +90 or greater, the center of the
    map could become invalid (NaN), causing the map to crash. Now we clamp the
    latitude to the range [-89.99999999, 89.99999999].
Commits on Aug 9, 2010
  1. @mbostock

    Fixes for non-root maps.

    mbostock authored
    If the map's container is not a root SVGSSVGElement, then we need to apply the
    inverse transform to convert the mouse location to view coordinates. Also, set
    the size of the child rect to be the actual size of the map, rather than 100% of
    the window width and height.
  2. @mbostock

    Use `zoomBy` to set zoom and center simultaneously.

    mbostock authored
    Previously, the hash control would call `zoom` then `center`, which would
    trigger two move events. By using `zoomBy`, we coalesce these two steps into one
    move event, avoiding spurious tile loads. This is also important if, say, a
    listener sets the allowable zoom range based on the map center.
Commits on Aug 8, 2010
  1. @mbostock

    Fix a crash when emptying the cache.

    mbostock authored
    There was a bug in fixing the doubly-linked list when the last entry was removed
    from the cache. Thanks to Aaron Straup Cope for finding the bug!
Commits on Aug 6, 2010
  1. @mbostock
  2. @mbostock
  3. @mbostock

    Make polymaps.min.js target writeable.

    mbostock authored
    I'm leaving polymaps.js read-only, so that I don't accidentally edit polymaps.js
    when debugging. But when copying polymaps.min.js to another directory, it's
    useful for the file to be writeable so that I don't have to cp -f.
  4. @mbostock

    Fix two bugs with proxy tiles.

    mbostock authored
    With zoom transforms, it was possible for a proxy tile to be less than -4 or
    greater than +2 zoom levels from the map zoom level. This caused Polymaps to
    crash because the corresponding layer `g` element was missing. Now we properly
    shift the proxy zoom levels when a zoom transform is used.
    
    Another problem with proxy tiles is that we were accidentally doubling the proxy
    count for tiles along the viewport diagonal, per the new scanline algorithm. We
    now compute the correct proxy count, which is necessary so that the proxy tiles
    are removed when the referenced tiles load.
Commits on Aug 5, 2010
  1. @mbostock

    Layer transforms!

    mbostock authored
    Layers can now have associated affine transforms, affecting the layer's local
    tile coordinates. For example, this allows an individual layer to be rotated,
    scaled and translated within the map.
Commits on Aug 4, 2010
  1. @mbostock

    Use scanline algorithm to determine visible tiles.

    mbostock authored
    Previously, if the map were rotated, we would compute the axis-aligned bounding
    box to determine which tiles were visible. This is easy, but has the undesirable
    property that it can load (and display) many tiles that are inside the bounding
    box but outside the viewport.
    
    Now we use the triangle scanline algorithm to determine exactly which tiles are
    visible. The algorithm is modified slightly so that it displays any pixel (i.e.,
    tile) that intersects the triangle.
Commits on Aug 3, 2010
  1. @mbostock
  2. @mbostock

    Improve stability of mousewheel interaction (again).

    mbostock authored
    The previous fix suffered from two problems.
    
    First, redundant hashchange events are occasionally dispatched by the browser,
    and later events would not be ignored; thus the hash control would end up moving
    the map on map move. We avoid this now by caching the location hash, and only
    moving the map when the hash changes. This also allows us to ignore the
    hashchange event when the map moves.
    
    Second, the wheel control was caching the location under the mouse, and only
    updating it when the mouse moves. However, the map can move independently of the
    mouse, for example with arrow controls or animation. Thus, we now clear the
    cached location when the map moves. (And, we're careful to preserve the cached
    location when we zoom the map.)
  3. @mbostock
  4. @mbostock

    Simplify overlay example using Layer.

    mbostock authored
    We implement the static image overlay using a custom (but simple!) layer
    implementation that creates an image tile.
  5. @mbostock

    Improve stability of mousewheel interaction.

    mbostock authored
    Previously, the location under the mouse could drift as the mousewheel was used
    to zoom in and out. Now we compute the location under the mouse on mousemove, so
    that it does not drift when the map is zoomed. The location is specified as an
    optional third argument to `map.zoomBy`.
    
    The `map.panBy` method is reimplemented to be slightly faster and more accurate
    by avoiding an extra point <-> location conversion.
    
    Most importantly, the hash control now ignores the 'hashchange' event that it
    generates when it changes the hash. Previously, this was causing noticeable
    aliasing on smooth zoom as any movement of the map would be rounded to the
    precision of the hash control.
  6. @mbostock
Commits on Aug 2, 2010
  1. @mbostock

    Rotation!

    mbostock authored
    Maps can now be rotated using the `angle` property. For simplicity, the layer
    implementation currently computes the bounding box to fill the rotated viewport;
    in a future commit we will use a scanline fill algorithm to avoid loading tiles
    outside the viewport.
    
    This commit also fixes a bug in the `coordinatePoint` and `pointCoordinate`
    methods, which were treating points pre-fractional zoom. Now points are always
    considered to be in screen space (pixel coordinates), consistent with the
    `locationPoint` and `pointLocation` methods. Note, however, that the
    tile-specific projection used by layers is still pre-transform.
Commits on Jul 28, 2010
  1. @mbostock

    New layer `visible` property.

    mbostock authored
    A layer's visibility can now be toggled without adding or removing the layer
    from the map. This avoids inadvertantly changing the z-order of layers. In
    addition to removing the tiles from the SVG image, the layer container's
    visibility attribute is set to "hidden", such that if the user has extended the
    layer with additional elements, they become hidden as well.
Commits on Jul 27, 2010
  1. @mbostock

    Refine the tile scale & rounding logic.

    mbostock authored
    We now apply the scale transform to the layer group elements, rather than to
    each tile individually. In addition, rather than rounding each tile's position,
    we round the tileCenter coordinate.
  2. @mbostock

    Fix zoom transforms with non-tiled layers.

    mbostock authored
    Previously, if a zoom transform was used with a non-tiled layer, it could cause
    no tiles to be displayed. Now we guarantee that at least one (world-size) tile
    is visible.
  3. @mbostock

    Improve performance of re-adding a layer.

    mbostock authored
    Previously, when re-adding a layer to its map, the layer would be removed from
    the map only to be immediately added back. This prevents the browser from
    efficiently updating the display. Now we do the minimal amount of work, while
    still guaranteeing that layers appear in the order they were added.
  4. @mbostock

    Fix a bug in event dispatch.

    mbostock authored
    If an event listener is removed during an event dispatch, it shouldn't receive
    the active event. So now in addition to storing a defensive copy, we use a
    wrapper object for the event handler to store an `on` boolean. This is set to
    false when the listener is removed, preventing that handler from receiving the current event.
  5. @mbostock

    Make a defensive copy of registered listeners.

    mbostock authored
    This way, if a listener is removed while events are being dispatched, we won't
    inadvertantly skip a listener.
  6. @mbostock

    Cache reference to map.

    mbostock authored
    This way, if the layer is removed from the map by the time loaded tiles arrive,
    the map is still available for the purposes of projection.
  7. @mbostock
  8. @mbostock
Commits on Jul 25, 2010
  1. Added Stamen to copyright

    Michal Migurski authored
  2. @RandomEtc

    Fixing the "logo" :)

    RandomEtc authored
  3. @RandomEtc
Commits on Jul 23, 2010
  1. @mbostock

    Listen for hashchange events.

    mbostock authored
    Now, when the location.hash changes, the map center and zoom will change
    accordingly. This is particularly nice for pasting in a URL that only differs by
    hash. Also, the hash control now ignores the hash if any part of it isNaN, or if
    it contains fewer than three components.
Something went wrong with that request. Please try again.