Use a standard title attribute for the control buttons

This commit is contained in:
Frederic Junod
2014-10-01 17:25:06 +02:00
parent abb86e16f0
commit 9ebde652dc
7 changed files with 22 additions and 107 deletions

View File

@@ -69,9 +69,6 @@ ol.control.Attribution = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Attributions';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
/**
* @private
@@ -96,10 +93,9 @@ ol.control.Attribution = function(opt_options) {
*/
this.labelSpan_ = label;
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
}, this.labelSpan_);
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);

View File

@@ -40,16 +40,11 @@ ol.control.FullScreen = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Toggle full-screen';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen() +
' ol-has-tooltip',
'type': 'button'
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen(),
'type': 'button',
'title': tipLabel
});
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);
goog.events.listen(buttonHandler,

View File

@@ -57,9 +57,6 @@ ol.control.OverviewMap = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Overview map';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
/**
* @private
@@ -83,10 +80,9 @@ ol.control.OverviewMap = function(opt_options) {
*/
this.labelSpan_ = label;
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
}, this.labelSpan_);
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);

View File

@@ -44,13 +44,11 @@ ol.control.Rotate = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Reset rotation';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-reset ol-has-tooltip',
'type' : 'button'
}, tip, this.label_);
'class': className + '-reset',
'type' : 'button',
'title': tipLabel
}, this.label_);
var handler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(handler);

View File

@@ -41,13 +41,11 @@ ol.control.Zoom = function(opt_options) {
var zoomOutTipLabel = goog.isDef(options.zoomOutTipLabel) ?
options.zoomOutTipLabel : 'Zoom out';
var tTipZoomIn = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, zoomInTipLabel);
var inElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-in ol-has-tooltip',
'type' : 'button'
}, tTipZoomIn, zoomInLabel);
'class': className + '-in',
'type' : 'button',
'title': zoomInTipLabel
}, zoomInLabel);
var inElementHandler = new ol.pointer.PointerEventHandler(inElement);
this.registerDisposable(inElementHandler);
@@ -65,13 +63,11 @@ ol.control.Zoom = function(opt_options) {
this.blur();
}, false);
var tTipsZoomOut = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, zoomOutTipLabel);
var outElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-out ol-has-tooltip',
'type' : 'button'
}, tTipsZoomOut, zoomOutLabel);
'class': className + '-out',
'type' : 'button',
'title': zoomOutTipLabel
}, zoomOutLabel);
var outElementHandler = new ol.pointer.PointerEventHandler(outElement);
this.registerDisposable(outElementHandler);

View File

@@ -35,14 +35,10 @@ ol.control.ZoomToExtent = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Fit to extent';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
});
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);