Don't let wrapDateLine maps be wider than one world width.

This commit is contained in:
ahocevar
2011-11-14 17:49:41 +01:00
parent 29256bd156
commit 0b39d32031
3 changed files with 47 additions and 3 deletions
+17
View File
@@ -1967,6 +1967,23 @@
t.eq(map.layerContainerDiv.style.top, '0px', 'layer container top correct');
}
function test_adjustZoom(t) {
t.plan(3);
var map = new OpenLayers.Map({
div: 'map',
layers: [
new OpenLayers.Layer('name', {
isBaseLayer: true,
wrapDateLine: true
})
]
});
map.zoomToMaxExtent();
t.ok(map.getResolution() <= map.getMaxExtent().getWidth() / map.getSize().w, "wrapDateLine map not wider than world");
t.eq(map.adjustZoom(9), 9, "valid zoom maintained");
t.eq(map.adjustZoom(1), 2, "zoom adjusted to not exceed world width");
}
</script>
</head>