Merge pull request #7481 from gberaudo/make_zoom_to_extent_extensible

Make zoom to extent control extensible
This commit is contained in:
Frédéric Junod
2017-11-17 09:10:50 +01:00
committed by GitHub

View File

@@ -22,9 +22,9 @@ ol.control.ZoomToExtent = function(opt_options) {
/**
* @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 :
'ol-zoom-extent';
@@ -62,16 +62,16 @@ ol.inherits(ol.control.ZoomToExtent, ol.control.Control);
*/
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
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 view = map.getView();
var extent = !this.extent_ ? view.getProjection().getExtent() : this.extent_;
var extent = !this.extent ? view.getProjection().getExtent() : this.extent;
view.fit(extent);
};