Make zoom to extent control extensible
This commit is contained in:
@@ -22,9 +22,9 @@ ol.control.ZoomToExtent = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.Extent}
|
* @type {ol.Extent}
|
||||||
* @private
|
* @protected
|
||||||
*/
|
*/
|
||||||
this.extent_ = options.extent ? options.extent : null;
|
this.extent = options.extent ? options.extent : null;
|
||||||
|
|
||||||
var className = options.className !== undefined ? options.className :
|
var className = options.className !== undefined ? options.className :
|
||||||
'ol-zoom-extent';
|
'ol-zoom-extent';
|
||||||
@@ -62,16 +62,16 @@ ol.inherits(ol.control.ZoomToExtent, ol.control.Control);
|
|||||||
*/
|
*/
|
||||||
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.handleZoomToExtent_();
|
this.handleZoomToExtent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() {
|
ol.control.ZoomToExtent.prototype.handleZoomToExtent = function() {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
var extent = !this.extent_ ? view.getProjection().getExtent() : this.extent_;
|
var extent = !this.extent ? view.getProjection().getExtent() : this.extent;
|
||||||
view.fit(extent);
|
view.fit(extent);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user