Use a standard title attribute for the control buttons
This commit is contained in:
64
css/ol.css
64
css/ol.css
@@ -131,65 +131,6 @@ button.ol-full-screen-true:after {
|
|||||||
content: "\00d7";
|
content: "\00d7";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* invisible but not hidden */
|
|
||||||
.ol-has-tooltip [role=tooltip] {
|
|
||||||
position: absolute;
|
|
||||||
clip: rect(1px 1px 1px 1px); /* < IE8 */
|
|
||||||
clip: rect(1px, 1px, 1px, 1px);
|
|
||||||
padding: 0;
|
|
||||||
border: 0;
|
|
||||||
height: 1px;
|
|
||||||
width: 1px;
|
|
||||||
overflow: hidden;
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 14px;
|
|
||||||
text-shadow: 0 0 2px #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* show a tooltip offset to below and right */
|
|
||||||
.ol-has-tooltip:hover [role=tooltip], .ol-has-tooltip:focus [role=tooltip] {
|
|
||||||
-moz-box-sizing: content-box;
|
|
||||||
-webkit-box-sizing: content-box;
|
|
||||||
box-sizing: content-box;
|
|
||||||
clip: auto;
|
|
||||||
padding: 0 .4em;
|
|
||||||
font-size: .8em;
|
|
||||||
height: 1.2em;
|
|
||||||
width: auto;
|
|
||||||
line-height: 1.2em;
|
|
||||||
z-index: 1100;
|
|
||||||
max-height: 100px;
|
|
||||||
white-space: nowrap;
|
|
||||||
display: inline-block;
|
|
||||||
background: #FFF;
|
|
||||||
background: rgba(255,255,255,0.6);
|
|
||||||
color: #000;
|
|
||||||
border: 3px solid rgba(255,255,255,0);
|
|
||||||
border-left-width: 0;
|
|
||||||
border-radius: 0 4px 4px 0;
|
|
||||||
bottom: .3em;
|
|
||||||
left: 2.2em;
|
|
||||||
}
|
|
||||||
.ol-touch .ol-has-tooltip:hover [role=tooltip],
|
|
||||||
.ol-touch .ol-has-tooltip:focus [role=tooltip] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.ol-zoom .ol-has-tooltip:hover [role=tooltip],
|
|
||||||
.ol-zoom .ol-has-tooltip:focus [role=tooltip] {
|
|
||||||
top: 1.1em;
|
|
||||||
}
|
|
||||||
.ol-rotate .ol-has-tooltip:hover [role=tooltip],
|
|
||||||
.ol-rotate .ol-has-tooltip:focus [role=tooltip],
|
|
||||||
.ol-attribution .ol-has-tooltip:hover [role=tooltip],
|
|
||||||
.ol-attribution .ol-has-tooltip:focus [role=tooltip],
|
|
||||||
.ol-full-screen .ol-has-tooltip:hover [role=tooltip],
|
|
||||||
.ol-full-screen .ol-has-tooltip:focus [role=tooltip] {
|
|
||||||
right: 2.2em;
|
|
||||||
left: auto;
|
|
||||||
border-radius: 4px 0 0 4px;
|
|
||||||
border-left-width: 3px;
|
|
||||||
border-right-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ol-attribution {
|
.ol-attribution {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@@ -222,7 +163,6 @@ button.ol-full-screen-true:after {
|
|||||||
.ol-attribution ul, .ol-attribution button {
|
.ol-attribution ul, .ol-attribution button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.ol-attribution:not(.ol-collapsed) button:hover [role=tooltip],
|
|
||||||
.ol-attribution.ol-collapsed ul {
|
.ol-attribution.ol-collapsed ul {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -284,8 +224,7 @@ button.ol-full-screen-true:after {
|
|||||||
|
|
||||||
.ol-control button,
|
.ol-control button,
|
||||||
.ol-attribution,
|
.ol-attribution,
|
||||||
.ol-scale-line-inner,
|
.ol-scale-line-inner {
|
||||||
.ol-has-tooltip [role=tooltip] {
|
|
||||||
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
|
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +253,6 @@ button.ol-full-screen-true:after {
|
|||||||
left: 2px;
|
left: 2px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
.ol-overviewmap:not(.ol-collapsed) button:hover [role=tooltip],
|
|
||||||
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
|
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
|
||||||
.ol-overviewmap.ol-uncollapsible button {
|
.ol-overviewmap.ol-uncollapsible button {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -69,9 +69,6 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
|
|
||||||
var tipLabel = goog.isDef(options.tipLabel) ?
|
var tipLabel = goog.isDef(options.tipLabel) ?
|
||||||
options.tipLabel : 'Attributions';
|
options.tipLabel : 'Attributions';
|
||||||
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
|
|
||||||
'role' : 'tooltip'
|
|
||||||
}, tipLabel);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -96,10 +93,9 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.labelSpan_ = label;
|
this.labelSpan_ = label;
|
||||||
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||||
'class': 'ol-has-tooltip',
|
'type': 'button',
|
||||||
'type': 'button'
|
'title': tipLabel
|
||||||
}, this.labelSpan_);
|
}, this.labelSpan_);
|
||||||
goog.dom.appendChild(button, tip);
|
|
||||||
|
|
||||||
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
||||||
this.registerDisposable(buttonHandler);
|
this.registerDisposable(buttonHandler);
|
||||||
|
|||||||
@@ -40,16 +40,11 @@ ol.control.FullScreen = function(opt_options) {
|
|||||||
|
|
||||||
var tipLabel = goog.isDef(options.tipLabel) ?
|
var tipLabel = goog.isDef(options.tipLabel) ?
|
||||||
options.tipLabel : 'Toggle full-screen';
|
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, {
|
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||||
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen() +
|
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen(),
|
||||||
' ol-has-tooltip',
|
'type': 'button',
|
||||||
'type': 'button'
|
'title': tipLabel
|
||||||
});
|
});
|
||||||
goog.dom.appendChild(button, tip);
|
|
||||||
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
||||||
this.registerDisposable(buttonHandler);
|
this.registerDisposable(buttonHandler);
|
||||||
goog.events.listen(buttonHandler,
|
goog.events.listen(buttonHandler,
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ ol.control.OverviewMap = function(opt_options) {
|
|||||||
|
|
||||||
var tipLabel = goog.isDef(options.tipLabel) ?
|
var tipLabel = goog.isDef(options.tipLabel) ?
|
||||||
options.tipLabel : 'Overview map';
|
options.tipLabel : 'Overview map';
|
||||||
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
|
|
||||||
'role' : 'tooltip'
|
|
||||||
}, tipLabel);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -83,10 +80,9 @@ ol.control.OverviewMap = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.labelSpan_ = label;
|
this.labelSpan_ = label;
|
||||||
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||||
'class': 'ol-has-tooltip',
|
'type': 'button',
|
||||||
'type': 'button'
|
'title': tipLabel
|
||||||
}, this.labelSpan_);
|
}, this.labelSpan_);
|
||||||
goog.dom.appendChild(button, tip);
|
|
||||||
|
|
||||||
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
||||||
this.registerDisposable(buttonHandler);
|
this.registerDisposable(buttonHandler);
|
||||||
|
|||||||
@@ -44,13 +44,11 @@ ol.control.Rotate = function(opt_options) {
|
|||||||
var tipLabel = goog.isDef(options.tipLabel) ?
|
var tipLabel = goog.isDef(options.tipLabel) ?
|
||||||
options.tipLabel : 'Reset rotation';
|
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, {
|
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||||
'class': className + '-reset ol-has-tooltip',
|
'class': className + '-reset',
|
||||||
'type' : 'button'
|
'type' : 'button',
|
||||||
}, tip, this.label_);
|
'title': tipLabel
|
||||||
|
}, this.label_);
|
||||||
|
|
||||||
var handler = new ol.pointer.PointerEventHandler(button);
|
var handler = new ol.pointer.PointerEventHandler(button);
|
||||||
this.registerDisposable(handler);
|
this.registerDisposable(handler);
|
||||||
|
|||||||
@@ -41,13 +41,11 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
var zoomOutTipLabel = goog.isDef(options.zoomOutTipLabel) ?
|
var zoomOutTipLabel = goog.isDef(options.zoomOutTipLabel) ?
|
||||||
options.zoomOutTipLabel : 'Zoom out';
|
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, {
|
var inElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||||
'class': className + '-in ol-has-tooltip',
|
'class': className + '-in',
|
||||||
'type' : 'button'
|
'type' : 'button',
|
||||||
}, tTipZoomIn, zoomInLabel);
|
'title': zoomInTipLabel
|
||||||
|
}, zoomInLabel);
|
||||||
|
|
||||||
var inElementHandler = new ol.pointer.PointerEventHandler(inElement);
|
var inElementHandler = new ol.pointer.PointerEventHandler(inElement);
|
||||||
this.registerDisposable(inElementHandler);
|
this.registerDisposable(inElementHandler);
|
||||||
@@ -65,13 +63,11 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
this.blur();
|
this.blur();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
var tTipsZoomOut = goog.dom.createDom(goog.dom.TagName.SPAN, {
|
|
||||||
'role' : 'tooltip'
|
|
||||||
}, zoomOutTipLabel);
|
|
||||||
var outElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
var outElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||||
'class': className + '-out ol-has-tooltip',
|
'class': className + '-out',
|
||||||
'type' : 'button'
|
'type' : 'button',
|
||||||
}, tTipsZoomOut, zoomOutLabel);
|
'title': zoomOutTipLabel
|
||||||
|
}, zoomOutLabel);
|
||||||
|
|
||||||
var outElementHandler = new ol.pointer.PointerEventHandler(outElement);
|
var outElementHandler = new ol.pointer.PointerEventHandler(outElement);
|
||||||
this.registerDisposable(outElementHandler);
|
this.registerDisposable(outElementHandler);
|
||||||
|
|||||||
@@ -35,14 +35,10 @@ ol.control.ZoomToExtent = function(opt_options) {
|
|||||||
|
|
||||||
var tipLabel = goog.isDef(options.tipLabel) ?
|
var tipLabel = goog.isDef(options.tipLabel) ?
|
||||||
options.tipLabel : 'Fit to extent';
|
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, {
|
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);
|
var buttonHandler = new ol.pointer.PointerEventHandler(button);
|
||||||
this.registerDisposable(buttonHandler);
|
this.registerDisposable(buttonHandler);
|
||||||
|
|||||||
Reference in New Issue
Block a user