Skip to content

Commit

Permalink
Fix zoom transforms with non-tiled layers.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mike Bostock committed Jul 27, 2010
1 parent 2a1a5e2 commit 3000eeb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions examples/streets/streets.html
Expand Up @@ -60,6 +60,7 @@

map.add(po.geoJson()
.url("streets.json")
.zoom(12)
.size(null)
.clip(false)
.on("load", load)
Expand All @@ -70,12 +71,10 @@
}

function load(e) {
var width = Math.pow(2, e.tile.zoom - 12);
for (var i = 0; i < e.features.length; i++) {
var feature = e.features[i], d = pci(feature);
if (!feature.element) continue;
feature.element.setAttribute("stroke", color(d).color);
feature.element.setAttribute("stroke-width", width);
feature.element.appendChild(po.svg("title").appendChild(
document.createTextNode(feature.data.properties.STREET + ": " + d + " PCI"))
.parentNode);
Expand Down
2 changes: 1 addition & 1 deletion src/Layer.js
Expand Up @@ -57,7 +57,7 @@ po.layer = function(load, unload) {
c0.column = Math.floor(c0.column);
c0.row = Math.max(0, Math.floor(c0.row));
c1.column = Math.floor(c1.column);
c1.row = Math.min((1 << (c0.zoom + 8)) / tileSize.y - 1, Math.floor(c1.row));
c1.row = Math.max(0, Math.min((1 << (c0.zoom + 8)) / tileSize.y - 1, Math.floor(c1.row)));

// tile-specific projection
function projection(c) {
Expand Down
2 changes: 1 addition & 1 deletion src/start.js
Expand Up @@ -2,4 +2,4 @@ if (!org) var org = {};
if (!org.polymaps) org.polymaps = {};
(function(po){

po.version = "1.0.9"; // semver.org
po.version = "1.0.10"; // semver.org

0 comments on commit 3000eeb

Please sign in to comment.