New zoomOnClick option for ZoomBox control.
This change also finally adds tests for the ZoomBox control.
This commit is contained in:
@@ -41,9 +41,17 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: alwaysZoom
|
||||
* {Boolean} Always zoom in/out, when box drawed
|
||||
* {Boolean} Always zoom in/out when box drawn, even if the zoom level does
|
||||
* not change.
|
||||
*/
|
||||
alwaysZoom: false,
|
||||
|
||||
/**
|
||||
* APIProperty: zoomOnClick
|
||||
* {Boolean} Should we zoom when no box was dragged, i.e. the user only
|
||||
* clicked? Default is true.
|
||||
*/
|
||||
zoomOnClick: true,
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
@@ -93,7 +101,7 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
|
||||
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
|
||||
}
|
||||
} else { // it's a pixel
|
||||
} else if (this.zoomOnClick) { // it's a pixel
|
||||
if (!this.out) {
|
||||
this.map.setCenter(this.map.getLonLatFromPixel(position),
|
||||
this.map.getZoom() + 1);
|
||||
|
||||
Reference in New Issue
Block a user