View / refactor how zoom and resolution are computed
This commit aims to simplify the computation of zoom and resolution in the View class. Previously zoom levels and resolution computations were mixed in different places, ie resolution constraints, initial values, etc. Now the View class only has the `getZoomForResolution` and `getResolutionForZoom` methods to convert from one system to another. Other than that, most computations use the resolution system internally. The `constrainResolution` method also does not exist anymore, and is replaced by `getValidResolution` and `getValidZoomLevel` public methods.
This commit is contained in:
@@ -103,7 +103,7 @@ describe('ol.interaction.DragZoom', function() {
|
||||
setTimeout(function() {
|
||||
const view = map.getView();
|
||||
const resolution = view.getResolution();
|
||||
expect(resolution).to.eql(view.constrainResolution(0.5));
|
||||
expect(resolution).to.eql(view.getValidResolution(0.5));
|
||||
done();
|
||||
}, 50);
|
||||
}, 50);
|
||||
|
||||
Reference in New Issue
Block a user