Add label option to ZoomToExtent

This commit is contained in:
tsauerwein
2015-01-15 09:58:05 +01:00
parent c726cbfcd9
commit 0d26a9aa87
3 changed files with 12 additions and 4 deletions
-3
View File
@@ -114,9 +114,6 @@
background-color: #4c6079; background-color: #4c6079;
background-color: rgba(0,60,136,0.7); background-color: rgba(0,60,136,0.7);
} }
.ol-zoom-extent button:after {
content: "E";
}
.ol-zoom .ol-zoom-in { .ol-zoom .ol-zoom-in {
border-radius: 2px 2px 0 0; border-radius: 2px 2px 0 0;
} }
+9
View File
@@ -1409,6 +1409,7 @@ olx.control.ZoomSliderOptions.prototype.render;
/** /**
* @typedef {{className: (string|undefined), * @typedef {{className: (string|undefined),
* target: (Element|undefined), * target: (Element|undefined),
* label: (string|undefined),
* tipLabel: (string|undefined), * tipLabel: (string|undefined),
* extent: (ol.Extent|undefined)}} * extent: (ol.Extent|undefined)}}
* @api stable * @api stable
@@ -1432,6 +1433,14 @@ olx.control.ZoomToExtentOptions.prototype.className;
olx.control.ZoomToExtentOptions.prototype.target; olx.control.ZoomToExtentOptions.prototype.target;
/**
* Text label to use for the button. Default is `E`
* @type {string|undefined}
* @api stable
*/
olx.control.ZoomToExtentOptions.prototype.label;
/** /**
* Text label to use for the button tip. Default is `Zoom to extent` * Text label to use for the button tip. Default is `Zoom to extent`
* @type {string|undefined} * @type {string|undefined}
+3 -1
View File
@@ -32,12 +32,14 @@ ol.control.ZoomToExtent = function(opt_options) {
var className = goog.isDef(options.className) ? options.className : var className = goog.isDef(options.className) ? options.className :
'ol-zoom-extent'; 'ol-zoom-extent';
var label = goog.isDef(options.label) ?
options.label : 'E';
var tipLabel = goog.isDef(options.tipLabel) ? var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Fit to extent'; options.tipLabel : 'Fit to extent';
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, { var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'type': 'button', 'type': 'button',
'title': tipLabel 'title': tipLabel
}); }, label);
goog.events.listen(button, goog.events.EventType.CLICK, goog.events.listen(button, goog.events.EventType.CLICK,
this.handleClick_, false, this); this.handleClick_, false, this);