Don't round wheel change zoom for maps with fractional zoom

This commit is contained in:
Gregers Gram Rygg
2012-05-21 15:08:31 +02:00
parent 985233c2dd
commit 7bc54e1517

View File

@@ -261,8 +261,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* deltaZ - {Integer} * deltaZ - {Integer}
*/ */
wheelChange: function(evt, deltaZ) { wheelChange: function(evt, deltaZ) {
if (!this.map.fractionalZoom) {
deltaZ = Math.round(deltaZ);
}
var currentZoom = this.map.getZoom(); var currentZoom = this.map.getZoom();
var newZoom = this.map.getZoom() + Math.round(deltaZ); var newZoom = this.map.getZoom() + deltaZ;
newZoom = Math.max(newZoom, 0); newZoom = Math.max(newZoom, 0);
newZoom = Math.min(newZoom, this.map.getNumZoomLevels()); newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
if (newZoom === currentZoom) { if (newZoom === currentZoom) {