Skip to content

Commit

Permalink
Add explicit text nodes to zoom in/out controls
Browse files Browse the repository at this point in the history
IE < 9 does not support CSS content properties, so the +/- does not
get rendered. Instead, add the +/- as text nodes when creating the
DOM nodes for the control.
  • Loading branch information
austinhyde committed Jan 24, 2014
1 parent 3013674 commit a4901e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 0 additions & 6 deletions css/ol.css
Expand Up @@ -219,16 +219,10 @@ a.ol-full-screen-true:after {
.ol-zoom-in {
border-radius: 2px 2px 0 0;
}
.ol-zoom-in:before {
content: "+";
}

.ol-zoom-out {
border-radius: 0 0 2px 2px;
}
.ol-zoom-out:before {
content: "\2212";
}

.ol-zoomslider {
position: absolute;
Expand Down
2 changes: 2 additions & 0 deletions src/objectliterals.jsdoc
Expand Up @@ -228,6 +228,8 @@
* @typedef {Object} olx.control.ZoomOptions
* @property {number|undefined} duration Animation duration in milliseconds. Default is `250`.
* @property {string|undefined} className CSS class name. Default is `ol-zoom`.
* @property {string|undefined} zoomInLabel Text label to use for the zoom-in button. Default is `+`
* @property {string|undefined} zoomOutLabel Text label to use for the zoom-out button. Default is `-`
* @property {number|undefined} delta The zoom delta applied on each click.
* @property {Element|undefined} target Target.
* @todo stability experimental
Expand Down
8 changes: 6 additions & 2 deletions src/ol/control/zoomcontrol.js
Expand Up @@ -32,10 +32,14 @@ ol.control.Zoom = function(opt_options) {

var delta = goog.isDef(options.delta) ? options.delta : 1;

var zoomInLabel = goog.isDef(options.zoomInLabel) ? options.zoomInLabel : '+',
zoomOutLabel =
goog.isDef(options.zoomOutLabel) ? options.zoomOutLabel : '-';

var inElement = goog.dom.createDom(goog.dom.TagName.A, {
'href': '#zoomIn',
'class': className + '-in'
});
}, zoomInLabel);
goog.events.listen(inElement, [
goog.events.EventType.TOUCHEND,
goog.events.EventType.CLICK
Expand All @@ -44,7 +48,7 @@ ol.control.Zoom = function(opt_options) {
var outElement = goog.dom.createDom(goog.dom.TagName.A, {
'href': '#zoomOut',
'class': className + '-out'
});
}, zoomOutLabel);
goog.events.listen(outElement, [
goog.events.EventType.TOUCHEND,
goog.events.EventType.CLICK
Expand Down

0 comments on commit a4901e6

Please sign in to comment.