Add an assertion to the dragchange handler.

This ensures that the result of resolution calculation stays inside of the
allowed bounds.
This commit is contained in:
Marc Jansen
2013-03-12 16:09:58 +01:00
parent ce67625b20
commit d77a8b0a1d

View File

@@ -307,6 +307,8 @@ ol.control.ZoomSlider.prototype.handleSliderChange_ = function(e) {
var map = this.getMap(),
amountDragged = this.amountDragged_(e),
res = this.resolutionForAmount_(amountDragged);
goog.asserts.assert(res >= this.minResolution_ && res <= this.maxResolution_,
'calculated new resolution is in allowed bounds.');
if (res !== this.currentResolution_) {
this.currentResolution_ = res;
map.getView().setResolution(res);