zoomFactor defaults to 2

This commit is contained in:
Éric Lemoine
2013-02-20 16:47:22 +01:00
parent 3803275a1e
commit 57a86353cd
4 changed files with 5 additions and 21 deletions

View File

@@ -19,19 +19,6 @@ var epsg21781 = new ol.Projection('EPSG:21781', ol.ProjectionUnits.METERS,
new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864));
ol.projection.addProjection(epsg21781);
// We could give the single image source a set of resolutions. This prevents the
// source from requesting images of arbitrary resolutions. To try it, uncomment
// the block below and the resolutions option in the SingleImageWMS config.
/*
var projectionExtent = epsg21781.getExtent();
var maxResolution = Math.max(projectionExtent.getWidth(),
projectionExtent.getHeight()) / 256;
var resolutions = new Array(10);
for (var i = 0; i < 10; ++i) {
resolutions[i] = maxResolution / Math.pow(2.0, i);
}
*/
var extent = new ol.Extent(420000, 30000, 900000, 350000);
var layers = new ol.Collection([
new ol.layer.TileLayer({
@@ -50,7 +37,6 @@ var layers = new ol.Collection([
}),
new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({
//resolutions: resolutions,
url: 'http://wms.geo.admin.ch/',
attributions: [new ol.Attribution(
'&copy; ' +

View File

@@ -941,7 +941,7 @@ ol.Map.createControls_ = function(mapOptions) {
mapOptions.zoomControl : true;
if (zoomControl) {
var zoomDelta = goog.isDef(mapOptions.zoomDelta) ?
mapOptions.zoomDelta : 4;
mapOptions.zoomDelta : 1;
controls.push(new ol.control.Zoom({
delta: zoomDelta
}));
@@ -971,7 +971,7 @@ ol.Map.createInteractions_ = function(mapOptions) {
mapOptions.doubleClickZoom : true;
if (doubleClickZoom) {
var zoomDelta = goog.isDef(mapOptions.zoomDelta) ?
mapOptions.zoomDelta : 4;
mapOptions.zoomDelta : 1;
interactions.push(new ol.interaction.DblClickZoom(zoomDelta));
}

View File

@@ -359,10 +359,8 @@ ol.View2D.createConstraints_ = function(view2DOptions) {
maxResolution = Math.max(
projectionExtent.maxX - projectionExtent.minX,
projectionExtent.maxY - projectionExtent.minY) / ol.DEFAULT_TILE_SIZE;
// number of steps we want between two data resolutions
var numSteps = 4;
numZoomLevels = 29 * numSteps;
zoomFactor = Math.exp(Math.log(2) / numSteps);
numZoomLevels = 29;
zoomFactor = 2;
}
resolutionConstraint = ol.ResolutionConstraint.createSnapToPower(
zoomFactor, maxResolution, numZoomLevels - 1);

View File

@@ -121,7 +121,7 @@ describe('ol.Map', function() {
var interactions = ol.Map.createInteractions_(options);
expect(interactions.getLength()).toEqual(1);
expect(interactions.getAt(0)).toBeA(ol.interaction.DblClickZoom);
expect(interactions.getAt(0).delta_).toEqual(4);
expect(interactions.getAt(0).delta_).toEqual(1);
});
});