From 5a1e92830f7b5a42a1a848b21591efc42c4268a9 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Wed, 28 May 2014 15:10:01 +0200 Subject: [PATCH 01/10] Make attribution control collapsible. --- css/ol.css | 116 +++++++++++++++------------ examples/simple.js | 6 ++ externs/olx.js | 31 +++++++ resources/layout.css | 2 +- src/ol/control/attributioncontrol.js | 69 +++++++++++++++- 5 files changed, 171 insertions(+), 53 deletions(-) diff --git a/css/ol.css b/css/ol.css index 8b3c61de35..40e94c5561 100644 --- a/css/ol.css +++ b/css/ol.css @@ -1,53 +1,3 @@ -.ol-attribution { - position: absolute; - text-align: right; - bottom: 0; - right: 0; - padding: 6px; - color: #000000; - color: rgba(238,238,238,1); - background: rgba(0,60,136,0.3); -} -.ol-attribution a { - text-decoration: none; - color: #7b98bc; - color: rgba(255,255,255,1); -} - -.ol-attribution ul { - margin: 0; - padding: 0; - font-size: 10px; - line-height: 12px; -} -.ol-attribution li { - display: inline; - list-style: none; - line-height: inherit; -} -.ol-attribution li:not(:last-child):after { - content: "\2003"; -} -.ol-attribution-bing-tos { - float:right; - padding-top: 2px; - white-space: nowrap; -} - -.ol-logo { - bottom: 0; - left: 0; - padding: 2px; - position: absolute; -} -.ol-logo ul { - margin: 0; - padding: 0; -} -.ol-logo ul li { - display: inline; - list-style: none; -} .ol-mouse-position { top: 8px; @@ -226,13 +176,79 @@ button.ol-full-screen-true:after { } .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 { + text-align: right; + bottom: .5em; + right: .5em; +} + +.ol-attribution ul { + margin: 0; + padding: 0 .5em; + font-size: .7rem; + line-height: 1.375em; + color: #000; + text-shadow: 0 0 2px #fff; +} +.ol-attribution li { + display: inline; + list-style: none; + line-height: inherit; +} +.ol-attribution li:not(:last-child):after { + content: " "; +} +.ol-attribution-bing-tos { + /* float:right; */ + /* padding-left: .4em; */ + /* line-height: 1.5em; */ +} +.ol-attribution ul, .ol-attribution button { + display: inline-block; +} +.ol-attribution:not(.ol-collapsed) button:hover [role=tooltip], +.ol-attribution.ol-collapsed ul { + display: none; +} +.ol-attribution:not(.ol-collapsed) { + background: rgba(255,255,255,0.8); +} +.ol-attribution.ol-uncollapsible { + bottom: 0; + right: 0; + border-radius: 4px 0 0; + height: 1em; + line-height: .9em; +} +.ol-attribution.ol-uncollapsible button { + display: none; +} + +.ol-logo { + bottom: 0; + left: 0; + padding: 2px; + position: absolute; +} +.ol-logo ul { + margin: 0; + padding: 0; +} +.ol-logo ul li { + display: inline; + list-style: none; +} .ol-zoomslider { position: absolute; top: 4.5em; diff --git a/examples/simple.js b/examples/simple.js index 96b91a8b63..accd01a5f4 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -10,6 +11,11 @@ var map = new ol.Map({ source: new ol.source.OSM() }) ], + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), renderer: exampleNS.getRendererFromQueryString(), target: 'map', view: new ol.View({ diff --git a/externs/olx.js b/externs/olx.js index 59f641f951..8c48325f55 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -660,6 +660,37 @@ olx.control.AttributionOptions.prototype.className; olx.control.AttributionOptions.prototype.target; +/** + * Specify if attributions can be collapsed. If you use an OSM source, + * should be set to `false` — see + * {@link http://www.openstreetmap.org/copyright OSM Copyright} — + * Default is `true`. + * @type {boolean|undefined} + */ +olx.control.AttributionOptions.prototype.collapsible; + + +/** + * Specify if attributions should be collapsed at startup. Default is `true`. + * @type {boolean|undefined} + */ +olx.control.AttributionOptions.prototype.collapsed; + + +/** + * Text label to use for the button tip. Default is `Attributions` + * @type {string|undefined} + */ +olx.control.AttributionOptions.prototype.tipLabel; + + +/** + * Text label to use for the attributions button. Default is `i` + * @type {string|undefined} + */ +olx.control.AttributionOptions.prototype.label; + + /** * @typedef {{element: (Element|undefined), * target: (Element|string|undefined)}} diff --git a/resources/layout.css b/resources/layout.css index 18441b8a6e..44f2fc5c12 100644 --- a/resources/layout.css +++ b/resources/layout.css @@ -9,7 +9,7 @@ body { background: url(textured_paper.jpeg) repeat; } .ol-attribution { - max-width: 50%; + max-width: calc(100%-3em); } #tags { display: none; diff --git a/src/ol/control/attributioncontrol.js b/src/ol/control/attributioncontrol.js index 0be67c3ee2..bcb9f359da 100644 --- a/src/ol/control/attributioncontrol.js +++ b/src/ol/control/attributioncontrol.js @@ -4,11 +4,15 @@ goog.provide('ol.control.Attribution'); goog.require('goog.dom'); goog.require('goog.dom.TagName'); +goog.require('goog.dom.classes'); +goog.require('goog.events'); +goog.require('goog.events.EventType'); goog.require('goog.object'); goog.require('goog.style'); goog.require('ol.Attribution'); goog.require('ol.control.Control'); goog.require('ol.css'); +goog.require('ol.pointer.PointerEventHandler'); @@ -34,11 +38,59 @@ ol.control.Attribution = function(opt_options) { */ this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL); + /** + * @private + * @type {boolean} + */ + this.collapsed_ = goog.isDef(options.collapsed) ? options.collapsed : true; + + var collapsible = goog.isDef(options.collapsible) ? + options.collapsible : true; + var className = goog.isDef(options.className) ? options.className : 'ol-attribution'; + + var tipLabel = goog.isDef(options.tipLabel) ? + options.tipLabel : 'Attributions'; + var tip = goog.dom.createDom(goog.dom.TagName.SPAN, { + 'role' : 'tooltip' + }, tipLabel); + + /** + * @private + * @type {string} + */ + this.label_ = goog.isDef(options.label) ? options.label : 'i'; + var label = goog.dom.createDom(goog.dom.TagName.SPAN, {}, this.label_); + + /** + * @private + * @type {Element} + */ + this.labelSpan_ = label; + var button = goog.dom.createDom(goog.dom.TagName.BUTTON, { + 'class': 'ol-has-tooltip' + }, this.labelSpan_); + goog.dom.appendChild(button, tip); + + var buttonHandler = new ol.pointer.PointerEventHandler(button); + this.registerDisposable(buttonHandler); + goog.events.listen(buttonHandler, ol.pointer.EventType.POINTERUP, + this.handleToggle_, false, this); + + goog.events.listen(button, [ + goog.events.EventType.MOUSEOUT, + goog.events.EventType.FOCUSOUT + ], function() { + this.blur(); + }, false); + var element = goog.dom.createDom(goog.dom.TagName.DIV, { - 'class': className + ' ' + ol.css.CLASS_UNSELECTABLE - }, this.ulElement_); + 'class': className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + + ol.css.CLASS_CONTROL + + (this.collapsed_ && collapsible ? ' ol-collapsed' : '') + + (collapsible ? '' : ' ol-uncollapsible') + }, this.ulElement_, button); goog.base(this, { element: element, @@ -187,3 +239,16 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) { } }; + + +/** + * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @private + */ +ol.control.Attribution.prototype.handleToggle_ = function(pointerEvent) { + pointerEvent.browserEvent.preventDefault(); + goog.dom.classes.toggle(this.element, 'ol-collapsed'); + goog.dom.setTextContent(this.labelSpan_, + (this.collapsed_) ? '\u00D7' : this.label_); + this.collapsed_ = !this.collapsed_; +}; From aeaa172abe19ccf5bfcd3ce49de01d752e0d8b18 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Fri, 30 May 2014 16:12:41 +0200 Subject: [PATCH 02/10] Remove Logo Control from defaults --- src/ol/control/controldefaults.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/ol/control/controldefaults.js b/src/ol/control/controldefaults.js index 6e28ffe8aa..fbd705638f 100644 --- a/src/ol/control/controldefaults.js +++ b/src/ol/control/controldefaults.js @@ -2,7 +2,6 @@ goog.provide('ol.control'); goog.require('ol.Collection'); goog.require('ol.control.Attribution'); -goog.require('ol.control.Logo'); goog.require('ol.control.Rotate'); goog.require('ol.control.Zoom'); @@ -15,7 +14,6 @@ goog.require('ol.control.Zoom'); * * {@link ol.control.Zoom} * * {@link ol.control.Rotate} * * {@link ol.control.Attribution} - * * {@link ol.control.Logo} * * @param {olx.control.DefaultsOptions=} opt_options Defaults options. * @return {ol.Collection} Controls. @@ -45,12 +43,6 @@ ol.control.defaults = function(opt_options) { controls.push(new ol.control.Attribution(options.attributionOptions)); } - var logoControl = goog.isDef(options.logo) ? - options.logo : true; - if (logoControl) { - controls.push(new ol.control.Logo(options.logoOptions)); - } - return controls; }; From da74fbf529bd6c7d05ed95be4afc28ba03f9270f Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Fri, 30 May 2014 16:16:07 +0200 Subject: [PATCH 03/10] Remove Logo Control --- externs/olx.js | 38 ----------- src/ol/control/logocontrol.js | 122 ---------------------------------- 2 files changed, 160 deletions(-) delete mode 100644 src/ol/control/logocontrol.js diff --git a/externs/olx.js b/externs/olx.js index 8c48325f55..d3e67a1ea6 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -718,8 +718,6 @@ olx.control.ControlOptions.prototype.target; /** * @typedef {{attribution: (boolean|undefined), * attributionOptions: (olx.control.AttributionOptions|undefined), - * logo: (boolean|undefined), - * logoOptions: (olx.control.LogoOptions|undefined), * zoom: (boolean|undefined), * rotateOptions: (olx.control.RotateOptions|undefined), * zoomOptions: (olx.control.ZoomOptions|undefined)}} @@ -742,20 +740,6 @@ olx.control.DefaultsOptions.prototype.attribution; olx.control.DefaultsOptions.prototype.attributionOptions; -/** - * Logo. Default is `true`. - * @type {boolean|undefined} - */ -olx.control.DefaultsOptions.prototype.logo; - - -/** - * Logo options. - * @type {olx.control.LogoOptions|undefined} - */ -olx.control.DefaultsOptions.prototype.logoOptions; - - /** * Rotate. Default is `true`. * @type {boolean|undefined} @@ -822,28 +806,6 @@ olx.control.FullScreenOptions.prototype.keys; olx.control.FullScreenOptions.prototype.target; -/** - * @typedef {{className: (string|undefined), - * target: (Element|undefined)}} - * @api - */ -olx.control.LogoOptions; - - -/** - * CSS class name. Default is `ol-logo`. - * @type {string|undefined} - */ -olx.control.LogoOptions.prototype.className; - - -/** - * Target. - * @type {Element|undefined} - */ -olx.control.LogoOptions.prototype.target; - - /** * @typedef {{className: (string|undefined), * coordinateFormat: (ol.CoordinateFormatType|undefined), diff --git a/src/ol/control/logocontrol.js b/src/ol/control/logocontrol.js deleted file mode 100644 index c4c29d76f7..0000000000 --- a/src/ol/control/logocontrol.js +++ /dev/null @@ -1,122 +0,0 @@ -goog.provide('ol.control.Logo'); - -goog.require('goog.dom'); -goog.require('goog.dom.TagName'); -goog.require('goog.object'); -goog.require('goog.style'); -goog.require('ol.control.Control'); -goog.require('ol.css'); - - - -/** - * @classdesc - * Shows a logo for all the layer sources in the map that have a logo - * associated with them, such as Bing. This control is part of a default map. - * By default it will show in the bottom-left portion of the map, but it can - * be styled by using a css selector for `.ol-logo`. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.LogoOptions=} opt_options Logo options. - * @api - */ -ol.control.Logo = function(opt_options) { - - var options = goog.isDef(opt_options) ? opt_options : {}; - - /** - * @private - * @type {Element} - */ - this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL); - - var className = goog.isDef(options.className) ? options.className : 'ol-logo'; - - var element = goog.dom.createDom(goog.dom.TagName.DIV, { - 'class': className + ' ' + ol.css.CLASS_UNSELECTABLE - }, this.ulElement_); - - goog.base(this, { - element: element, - target: options.target - }); - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = true; - - /** - * @private - * @type {Object.} - */ - this.logoElements_ = {}; - -}; -goog.inherits(ol.control.Logo, ol.control.Control); - - -/** - * @param {ol.MapEvent} mapEvent Map event. - */ -ol.control.Logo.prototype.handleMapPostrender = function(mapEvent) { - this.updateElement_(mapEvent.frameState); -}; - - -/** - * @param {?olx.FrameState} frameState Frame state. - * @private - */ -ol.control.Logo.prototype.updateElement_ = function(frameState) { - - if (goog.isNull(frameState)) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.element, false); - this.renderedVisible_ = false; - } - return; - } - - var logo; - var logos = frameState.logos; - var logoElements = this.logoElements_; - - for (logo in logoElements) { - if (!(logo in logos)) { - goog.dom.removeNode(logoElements[logo]); - delete logoElements[logo]; - } - } - - var image, logoElement, logoKey; - for (logoKey in logos) { - if (!(logoKey in logoElements)) { - image = new Image(); - image.src = logoKey; - var logoValue = logos[logoKey]; - var child; - if (logoValue === '') { - child = image; - } else { - child = goog.dom.createDom(goog.dom.TagName.A, { - 'href': logoValue, - 'target': '_blank' - }); - child.appendChild(image); - } - logoElement = goog.dom.createDom(goog.dom.TagName.LI, undefined, child); - goog.dom.appendChild(this.ulElement_, logoElement); - logoElements[logoKey] = logoElement; - } - } - - var renderVisible = !goog.object.isEmpty(logos); - if (this.renderedVisible_ != renderVisible) { - goog.style.setElementShown(this.element, renderVisible); - this.renderedVisible_ = renderVisible; - } - -}; From 4d150e6b84f16bbee31d0febcfdd4fdd483e2953 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Tue, 3 Jun 2014 15:22:53 +0200 Subject: [PATCH 04/10] Move Logos in attributions --- css/ol.css | 14 ++--- externs/olx.js | 7 ++- src/ol/control/attributioncontrol.js | 76 ++++++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/css/ol.css b/css/ol.css index 40e94c5561..937ab06219 100644 --- a/css/ol.css +++ b/css/ol.css @@ -209,10 +209,8 @@ button.ol-full-screen-true:after { .ol-attribution li:not(:last-child):after { content: " "; } -.ol-attribution-bing-tos { - /* float:right; */ - /* padding-left: .4em; */ - /* line-height: 1.5em; */ +.ol-attribution img { + max-height: 2em; } .ol-attribution ul, .ol-attribution button { display: inline-block; @@ -228,8 +226,12 @@ button.ol-full-screen-true:after { bottom: 0; right: 0; border-radius: 4px 0 0; - height: 1em; - line-height: .9em; + height: 1.1em; + line-height: 1em; +} +.ol-attribution.ol-uncollapsible img { + margin-top: -.2em; + max-height: 1.6em; } .ol-attribution.ol-uncollapsible button { display: none; diff --git a/externs/olx.js b/externs/olx.js index d3e67a1ea6..3c20d4f547 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -685,11 +685,16 @@ olx.control.AttributionOptions.prototype.tipLabel; /** - * Text label to use for the attributions button. Default is `i` + * Text label to use for the collapsed attributions button. Default is `i` * @type {string|undefined} */ olx.control.AttributionOptions.prototype.label; +/** + * Text label to use for the expanded attributions button. Default is `»` + * @type {string|undefined} + */ +olx.control.AttributionOptions.prototype.collapseLabel; /** * @typedef {{element: (Element|undefined), diff --git a/src/ol/control/attributioncontrol.js b/src/ol/control/attributioncontrol.js index bcb9f359da..9035a4ce71 100644 --- a/src/ol/control/attributioncontrol.js +++ b/src/ol/control/attributioncontrol.js @@ -38,6 +38,15 @@ ol.control.Attribution = function(opt_options) { */ this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL); + /** + * @private + * @type {Element} + */ + this.logoLi_ = goog.dom.createElement(goog.dom.TagName.LI); + + goog.dom.appendChild(this.ulElement_, this.logoLi_); + goog.style.setElementShown(this.logoLi_, false); + /** * @private * @type {boolean} @@ -56,12 +65,22 @@ ol.control.Attribution = function(opt_options) { 'role' : 'tooltip' }, tipLabel); + /** + * @private + * @type {string} + */ + this.collapseLabel_ = goog.isDef(options.collapseLabel) ? + options.collapseLabel : '\u00BB'; + /** * @private * @type {string} */ this.label_ = goog.isDef(options.label) ? options.label : 'i'; - var label = goog.dom.createDom(goog.dom.TagName.SPAN, {}, this.label_); + var label = goog.dom.createDom(goog.dom.TagName.SPAN, {}, + (collapsible && !this.collapsed_) ? + this.collapseLabel_ : this.label_); + /** * @private @@ -115,6 +134,12 @@ ol.control.Attribution = function(opt_options) { */ this.attributionElementRenderedVisible_ = {}; + /** + * @private + * @type {Object.} + */ + this.logoElements_ = {}; + }; goog.inherits(ol.control.Attribution, ol.control.Control); @@ -232,12 +257,57 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) { } var renderVisible = - !goog.object.isEmpty(this.attributionElementRenderedVisible_); + !goog.object.isEmpty(this.attributionElementRenderedVisible_) || + !goog.object.isEmpty(frameState.logos); if (this.renderedVisible_ != renderVisible) { goog.style.setElementShown(this.element, renderVisible); this.renderedVisible_ = renderVisible; } + this.insertLogos_(frameState); + +}; + + +/** + * @param {?olx.FrameState} frameState Frame state. + * @private + */ +ol.control.Attribution.prototype.insertLogos_ = function(frameState) { + + var logo; + var logos = frameState.logos; + var logoElements = this.logoElements_; + + for (logo in logoElements) { + if (!(logo in logos)) { + goog.dom.removeNode(logoElements[logo]); + delete logoElements[logo]; + } + } + + var image, logoElement, logoKey; + for (logoKey in logos) { + if (!(logoKey in logoElements)) { + image = new Image(); + image.src = logoKey; + var logoValue = logos[logoKey]; + if (logoValue === '') { + logoElement = image; + } else { + logoElement = goog.dom.createDom(goog.dom.TagName.A, { + 'href': logoValue, + 'target': '_blank' + }); + logoElement.appendChild(image); + } + goog.dom.appendChild(this.logoLi_, logoElement); + logoElements[logoKey] = logoElement; + } + } + + goog.style.setElementShown(this.logoLi_, !goog.object.isEmpty(logos)); + }; @@ -249,6 +319,6 @@ ol.control.Attribution.prototype.handleToggle_ = function(pointerEvent) { pointerEvent.browserEvent.preventDefault(); goog.dom.classes.toggle(this.element, 'ol-collapsed'); goog.dom.setTextContent(this.labelSpan_, - (this.collapsed_) ? '\u00D7' : this.label_); + (this.collapsed_) ? this.collapseLabel_ : this.label_); this.collapsed_ = !this.collapsed_; }; From d5d5f58809ae0eddd1842858183e62623a29c317 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Tue, 3 Jun 2014 15:55:56 +0200 Subject: [PATCH 05/10] Do not collapse Attributions when using OSM source --- examples/accessible.js | 6 ++++++ examples/animation.js | 6 ++++++ examples/bind-input.js | 6 ++++++ examples/canvas-tiles.js | 6 ++++++ examples/center.js | 6 ++++++ examples/custom-controls.js | 6 +++++- examples/device-orientation.js | 6 ++++++ examples/export-map.js | 6 ++++++ examples/geojson.js | 6 ++++++ examples/geolocation-orientation.js | 6 ++++++ examples/geolocation.js | 6 ++++++ examples/igc.js | 6 ++++++ examples/layer-clipping-webgl.js | 6 ++++++ examples/layer-clipping.js | 6 ++++++ examples/layer-swipe.js | 6 ++++++ examples/localized-openstreetmap.js | 6 ++++++ examples/min-max-resolution.js | 6 ++++++ examples/mouse-position.js | 6 +++++- examples/moveend.js | 6 ++++++ examples/navigation-controls.js | 6 +++++- examples/rotation.js | 6 ++++++ examples/scale-line.js | 6 +++++- examples/teleport.js | 6 ++++++ examples/vector-osm.js | 6 ++++++ examples/wmts.js | 6 ++++++ examples/xyz.js | 6 ++++++ 26 files changed, 152 insertions(+), 4 deletions(-) diff --git a/examples/accessible.js b/examples/accessible.js index 2d36f4c2f8..53a80398c1 100644 --- a/examples/accessible.js +++ b/examples/accessible.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -12,6 +13,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/animation.js b/examples/animation.js index 8965908c0c..2db3f7feab 100644 --- a/examples/animation.js +++ b/examples/animation.js @@ -1,6 +1,7 @@ goog.require('ol.Map'); goog.require('ol.View'); goog.require('ol.animation'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.OSM'); @@ -55,6 +56,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: view }); diff --git a/examples/bind-input.js b/examples/bind-input.js index 421e721156..0264930120 100644 --- a/examples/bind-input.js +++ b/examples/bind-input.js @@ -1,6 +1,7 @@ goog.require('ol.BrowserFeature'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.dom.Input'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -29,6 +30,11 @@ var map = new ol.Map({ layers: [layer], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: view }); diff --git a/examples/canvas-tiles.js b/examples/canvas-tiles.js index 120b0a4497..278fe22e31 100644 --- a/examples/canvas-tiles.js +++ b/examples/canvas-tiles.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.OSM'); @@ -23,6 +24,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: ol.proj.transform( [-0.1275, 51.507222], 'EPSG:4326', 'EPSG:3857'), diff --git a/examples/center.js b/examples/center.js index 64dd9cad97..2c63b99bf8 100644 --- a/examples/center.js +++ b/examples/center.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.geom.Point'); goog.require('ol.geom.SimpleGeometry'); goog.require('ol.layer.Tile'); @@ -50,6 +51,11 @@ var map = new ol.Map({ vectorLayer ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: view }); diff --git a/examples/custom-controls.js b/examples/custom-controls.js index ceca3ad3ba..8181ecafc2 100644 --- a/examples/custom-controls.js +++ b/examples/custom-controls.js @@ -62,7 +62,11 @@ ol.inherits(app.RotateNorthControl, ol.control.Control); var map = new ol.Map({ - controls: ol.control.defaults().extend([ + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }).extend([ new app.RotateNorthControl() ]), layers: [ diff --git a/examples/device-orientation.js b/examples/device-orientation.js index d905ec97d2..8f3569367d 100644 --- a/examples/device-orientation.js +++ b/examples/device-orientation.js @@ -1,6 +1,7 @@ goog.require('ol.DeviceOrientation'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.dom.Input'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); @@ -21,6 +22,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: view }); diff --git a/examples/export-map.js b/examples/export-map.js index 747c5dedb7..134972d1b7 100644 --- a/examples/export-map.js +++ b/examples/export-map.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -11,6 +12,11 @@ var map = new ol.Map({ }) ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/geojson.js b/examples/geojson.js index 1f1dea970b..4674cf4a33 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -1,6 +1,7 @@ goog.require('ol.Feature'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.geom.Circle'); goog.require('ol.layer.Tile'); goog.require('ol.layer.Vector'); @@ -188,6 +189,11 @@ var map = new ol.Map({ vectorLayer ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/geolocation-orientation.js b/examples/geolocation-orientation.js index 4ac409b15b..99e653fcda 100644 --- a/examples/geolocation-orientation.js +++ b/examples/geolocation-orientation.js @@ -2,6 +2,7 @@ goog.require('ol.Geolocation'); goog.require('ol.Map'); goog.require('ol.Overlay'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.geom.LineString'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); @@ -21,6 +22,11 @@ var map = new ol.Map({ }) ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: view }); diff --git a/examples/geolocation.js b/examples/geolocation.js index 3d99af6f03..af65afd0dd 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -3,6 +3,7 @@ goog.require('ol.FeatureOverlay'); goog.require('ol.Geolocation'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.dom.Input'); goog.require('ol.geom.Point'); goog.require('ol.layer.Tile'); @@ -21,6 +22,11 @@ var map = new ol.Map({ }) ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: view }); diff --git a/examples/igc.js b/examples/igc.js index 33b5924140..d3d48381bd 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -3,6 +3,7 @@ goog.require('ol.Feature'); goog.require('ol.FeatureOverlay'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.geom.LineString'); goog.require('ol.geom.Point'); goog.require('ol.layer.Tile'); @@ -83,6 +84,11 @@ var map = new ol.Map({ }) ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [703365.7089403362, 5714629.865071137], zoom: 9 diff --git a/examples/layer-clipping-webgl.js b/examples/layer-clipping-webgl.js index 4644390085..7d2a285617 100644 --- a/examples/layer-clipping-webgl.js +++ b/examples/layer-clipping-webgl.js @@ -1,6 +1,7 @@ goog.require('ol.BrowserFeature'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -20,6 +21,11 @@ if (!ol.BrowserFeature.HAS_WEBGL) { layers: [osm], renderer: 'webgl', target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/layer-clipping.js b/examples/layer-clipping.js index 5395501249..1a5fa76994 100644 --- a/examples/layer-clipping.js +++ b/examples/layer-clipping.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -10,6 +11,11 @@ var osm = new ol.layer.Tile({ var map = new ol.Map({ layers: [osm], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/layer-swipe.js b/examples/layer-swipe.js index 8b81ed6f05..c0a83fa434 100644 --- a/examples/layer-swipe.js +++ b/examples/layer-swipe.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.BingMaps'); goog.require('ol.source.OSM'); @@ -17,6 +18,11 @@ var bing = new ol.layer.Tile({ var map = new ol.Map({ layers: [osm, bing], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/localized-openstreetmap.js b/examples/localized-openstreetmap.js index 2018d609ca..4f9edd9e27 100644 --- a/examples/localized-openstreetmap.js +++ b/examples/localized-openstreetmap.js @@ -1,6 +1,7 @@ goog.require('ol.Attribution'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -42,6 +43,11 @@ var map = new ol.Map({ openSeaMapLayer ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ maxZoom: 18, center: [-244780.24508882355, 5986452.183179816], diff --git a/examples/min-max-resolution.js b/examples/min-max-resolution.js index b59a6b0836..6bfe03a9b5 100644 --- a/examples/min-max-resolution.js +++ b/examples/min-max-resolution.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); goog.require('ol.source.TileJSON'); @@ -27,6 +28,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [653600, 5723680], zoom: 5 diff --git a/examples/mouse-position.js b/examples/mouse-position.js index d451a16708..cdbf7eece1 100644 --- a/examples/mouse-position.js +++ b/examples/mouse-position.js @@ -19,7 +19,11 @@ var mousePositionControl = new ol.control.MousePosition({ }); var map = new ol.Map({ - controls: ol.control.defaults().extend([mousePositionControl]), + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }).extend([mousePositionControl]), layers: [ new ol.layer.Tile({ source: new ol.source.OSM() diff --git a/examples/moveend.js b/examples/moveend.js index 46340d3716..1f2799bfcd 100644 --- a/examples/moveend.js +++ b/examples/moveend.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.extent'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); @@ -14,6 +15,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/navigation-controls.js b/examples/navigation-controls.js index 04538f83b7..cc9034a747 100644 --- a/examples/navigation-controls.js +++ b/examples/navigation-controls.js @@ -7,7 +7,11 @@ goog.require('ol.source.OSM'); var map = new ol.Map({ - controls: ol.control.defaults().extend([ + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }).extend([ new ol.control.ZoomToExtent({ extent: [ 813079.7791264898, 5929220.284081122, diff --git a/examples/rotation.js b/examples/rotation.js index 4106e99359..4fa63b6b28 100644 --- a/examples/rotation.js +++ b/examples/rotation.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -12,6 +13,11 @@ var map = new ol.Map({ ], renderer: exampleNS.getRendererFromQueryString(), target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [-25860000, 4130000], rotation: Math.PI / 6, diff --git a/examples/scale-line.js b/examples/scale-line.js index 447b4bb842..b495fed945 100644 --- a/examples/scale-line.js +++ b/examples/scale-line.js @@ -10,7 +10,11 @@ goog.require('ol.source.OSM'); var scaleLineControl = new ol.control.ScaleLine(); var map = new ol.Map({ - controls: ol.control.defaults().extend([ + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }).extend([ scaleLineControl ]), layers: [ diff --git a/examples/teleport.js b/examples/teleport.js index 02216f275c..3aea72d6b5 100644 --- a/examples/teleport.js +++ b/examples/teleport.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); @@ -11,6 +12,11 @@ var map = new ol.Map({ }) ], renderer: exampleNS.getRendererFromQueryString(), + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [0, 0], zoom: 2 diff --git a/examples/vector-osm.js b/examples/vector-osm.js index 9faed15dc9..d724b24320 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -1,5 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.format.OSMXML'); goog.require('ol.layer.Tile'); goog.require('ol.layer.Vector'); @@ -131,6 +132,11 @@ var raster = new ol.layer.Tile({ var map = new ol.Map({ layers: [raster, vector], target: document.getElementById('map'), + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [739218, 5906096], maxZoom: 19, diff --git a/examples/wmts.js b/examples/wmts.js index 4b2de5c726..6c64105f18 100644 --- a/examples/wmts.js +++ b/examples/wmts.js @@ -1,6 +1,7 @@ goog.require('ol.Attribution'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.extent'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); @@ -53,6 +54,11 @@ var map = new ol.Map({ }) ], target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), view: new ol.View({ center: [-11158582, 4813697], zoom: 4 diff --git a/examples/xyz.js b/examples/xyz.js index 04ed95d1ef..a29ebd6092 100644 --- a/examples/xyz.js +++ b/examples/xyz.js @@ -1,6 +1,7 @@ goog.require('ol.Attribution'); goog.require('ol.Map'); goog.require('ol.View'); +goog.require('ol.control'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); goog.require('ol.source.XYZ'); @@ -13,6 +14,11 @@ var attribution = new ol.Attribution({ var map = new ol.Map({ target: 'map', + controls: ol.control.defaults({ + attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ + collapsible: false + }) + }), layers: [ new ol.layer.Tile({ source: new ol.source.OSM({ From 6744713a541b96715817eb24554e482634afd359 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Fri, 20 Jun 2014 15:24:21 +0200 Subject: [PATCH 06/10] Register button handlers the new way --- src/ol/control/attributioncontrol.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/ol/control/attributioncontrol.js b/src/ol/control/attributioncontrol.js index 9035a4ce71..1aed2ef91a 100644 --- a/src/ol/control/attributioncontrol.js +++ b/src/ol/control/attributioncontrol.js @@ -95,7 +95,9 @@ ol.control.Attribution = function(opt_options) { var buttonHandler = new ol.pointer.PointerEventHandler(button); this.registerDisposable(buttonHandler); goog.events.listen(buttonHandler, ol.pointer.EventType.POINTERUP, - this.handleToggle_, false, this); + this.handlePointerUp_, false, this); + goog.events.listen(button, goog.events.EventType.CLICK, + this.handleClick_, false, this); goog.events.listen(button, [ goog.events.EventType.MOUSEOUT, @@ -312,11 +314,31 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) { /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {goog.events.BrowserEvent} event The event to handle * @private */ -ol.control.Attribution.prototype.handleToggle_ = function(pointerEvent) { +ol.control.Attribution.prototype.handleClick_ = function(event) { + if (event.screenX !== 0 && event.screenY !== 0) { + return; + } + this.handleToggle_(); +}; + + +/** + * @param {ol.pointer.PointerEvent} pointerEvent The event to handle + * @private + */ +ol.control.Attribution.prototype.handlePointerUp_ = function(pointerEvent) { pointerEvent.browserEvent.preventDefault(); + this.handleToggle_(); +}; + + +/** + * @private + */ +ol.control.Attribution.prototype.handleToggle_ = function() { goog.dom.classes.toggle(this.element, 'ol-collapsed'); goog.dom.setTextContent(this.labelSpan_, (this.collapsed_) ? this.collapseLabel_ : this.label_); From 4f087f1b84cb8634ef926c70a85dd7c84d631423 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Mon, 23 Jun 2014 12:11:34 +0200 Subject: [PATCH 07/10] Add getter/setter for collapsed & collapsible --- src/ol/control/attributioncontrol.js | 62 ++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/src/ol/control/attributioncontrol.js b/src/ol/control/attributioncontrol.js index 1aed2ef91a..f0d4e189b9 100644 --- a/src/ol/control/attributioncontrol.js +++ b/src/ol/control/attributioncontrol.js @@ -53,9 +53,17 @@ ol.control.Attribution = function(opt_options) { */ this.collapsed_ = goog.isDef(options.collapsed) ? options.collapsed : true; - var collapsible = goog.isDef(options.collapsible) ? + /** + * @private + * @type {boolean} + */ + this.collapsible_ = goog.isDef(options.collapsible) ? options.collapsible : true; + if (!this.collapsible_) { + this.collapsed_ = false; + } + var className = goog.isDef(options.className) ? options.className : 'ol-attribution'; @@ -78,7 +86,7 @@ ol.control.Attribution = function(opt_options) { */ this.label_ = goog.isDef(options.label) ? options.label : 'i'; var label = goog.dom.createDom(goog.dom.TagName.SPAN, {}, - (collapsible && !this.collapsed_) ? + (this.collapsible_ && !this.collapsed_) ? this.collapseLabel_ : this.label_); @@ -109,8 +117,8 @@ ol.control.Attribution = function(opt_options) { var element = goog.dom.createDom(goog.dom.TagName.DIV, { 'class': className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + ol.css.CLASS_CONTROL + - (this.collapsed_ && collapsible ? ' ol-collapsed' : '') + - (collapsible ? '' : ' ol-uncollapsible') + (this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') + + (this.collapsible_ ? '' : ' ol-uncollapsible') }, this.ulElement_, button); goog.base(this, { @@ -344,3 +352,49 @@ ol.control.Attribution.prototype.handleToggle_ = function() { (this.collapsed_) ? this.collapseLabel_ : this.label_); this.collapsed_ = !this.collapsed_; }; + + +/** + * @return {boolean} True is the widget is collapsible. + * @todo api + */ +ol.control.Attribution.prototype.getCollapsible = function() { + return this.collapsible_; +}; + + +/** + * @param {boolean} collapsible True is the widget is collapsible. + * @todo api + */ +ol.control.Attribution.prototype.setCollapsible = function(collapsible) { + if (this.collapsible_ === collapsible) { + return; + } + this.collapsible_ = collapsible; + goog.dom.classes.toggle(this.element, 'ol-uncollapsible'); + if (!collapsible && this.collapsed_) { + this.handleToggle_(); + } +}; + + +/** + * @param {boolean} collapsed True is the widget is collapsed. + * @todo api + */ +ol.control.Attribution.prototype.setCollapsed = function(collapsed) { + if (!this.collapsible_ || this.collapsed_ === collapsed) { + return; + } + this.handleToggle_(); +}; + + +/** + * @return {boolean} True is the widget is collapsed. + * @todo api + */ +ol.control.Attribution.prototype.getCollapsed = function() { + return this.collapsed_; +}; From f0f929116142b4ed88d6889e1132e57869118f14 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Mon, 23 Jun 2014 12:34:37 +0200 Subject: [PATCH 08/10] Add attributions example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Showing how to dynamically change collapsed/collapsible properties for ≠ map sizes. --- examples/attributions.html | 51 ++++++++++++++++++++++++++++++++++++++ examples/attributions.js | 33 ++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 examples/attributions.html create mode 100644 examples/attributions.js diff --git a/examples/attributions.html b/examples/attributions.html new file mode 100644 index 0000000000..50da53c693 --- /dev/null +++ b/examples/attributions.html @@ -0,0 +1,51 @@ + + + + + + + + + + + Attributions example + + + + + +
+ +
+
+
+
+
+ +
+ +
+

Attributions example

+

Example of a attributions visibily change on map resize, to collapse them on small maps.

+
+

See the attributions.js source to see how this is done.

+
+
attributions, openstreetmap
+
+ +
+ +
+ + + + + + + diff --git a/examples/attributions.js b/examples/attributions.js new file mode 100644 index 0000000000..a48645f0c8 --- /dev/null +++ b/examples/attributions.js @@ -0,0 +1,33 @@ +goog.require('ol.Map'); +goog.require('ol.View'); +goog.require('ol.control'); +goog.require('ol.control.Attribution'); +goog.require('ol.layer.Tile'); +goog.require('ol.source.OSM'); + +var attribution = new ol.control.Attribution({ + collapsible: false +}); +var map = new ol.Map({ + layers: [ + new ol.layer.Tile({ + source: new ol.source.OSM() + }) + ], + controls: ol.control.defaults({ attribution: false }).extend([attribution]), + renderer: exampleNS.getRendererFromQueryString(), + target: 'map', + view: new ol.View({ + center: [0, 0], + zoom: 2 + }) +}); + +function checkSize() { + var small = map.getSize()[0] < 600; + attribution.setCollapsible(small); + attribution.setCollapsed(small); +} + +$(window).on('resize', checkSize); +checkSize(); From 1c8fc8358ae4f5c66d8151787385858ddc332ae4 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Mon, 23 Jun 2014 15:48:22 +0200 Subject: [PATCH 09/10] Remove reference to ol-logo --- css/ol.css | 14 -------------- examples/center.html | 4 ---- examples/google-map.html | 3 --- 3 files changed, 21 deletions(-) diff --git a/css/ol.css b/css/ol.css index 937ab06219..e2714500f3 100644 --- a/css/ol.css +++ b/css/ol.css @@ -237,20 +237,6 @@ button.ol-full-screen-true:after { display: none; } -.ol-logo { - bottom: 0; - left: 0; - padding: 2px; - position: absolute; -} -.ol-logo ul { - margin: 0; - padding: 0; -} -.ol-logo ul li { - display: inline; - list-style: none; -} .ol-zoomslider { position: absolute; top: 4.5em; diff --git a/examples/center.html b/examples/center.html index 20eff037c4..3dc47ea590 100644 --- a/examples/center.html +++ b/examples/center.html @@ -21,10 +21,6 @@ top: 178px; left: 158px; } - div.ol-logo { - left: 150px; - bottom: 30px; - } div.ol-attribution { bottom: 30px; right: 50px; diff --git a/examples/google-map.html b/examples/google-map.html index fd82495071..463c90834f 100644 --- a/examples/google-map.html +++ b/examples/google-map.html @@ -10,9 +10,6 @@