@@ -96,7 +96,8 @@ ol.control.Attribution = function(opt_options) {
|
||||
*/
|
||||
this.labelSpan_ = label;
|
||||
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
|
||||
'class': 'ol-has-tooltip'
|
||||
'class': 'ol-has-tooltip',
|
||||
'type': 'button'
|
||||
}, this.labelSpan_);
|
||||
goog.dom.appendChild(button, tip);
|
||||
|
||||
@@ -272,6 +273,12 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
goog.style.setElementShown(this.element, renderVisible);
|
||||
this.renderedVisible_ = renderVisible;
|
||||
}
|
||||
if (renderVisible &&
|
||||
goog.object.isEmpty(this.attributionElementRenderedVisible_)) {
|
||||
goog.dom.classlist.add(this.element, 'ol-logo-only');
|
||||
} else {
|
||||
goog.dom.classlist.remove(this.element, 'ol-logo-only');
|
||||
}
|
||||
|
||||
this.insertLogos_(frameState);
|
||||
|
||||
@@ -354,7 +361,7 @@ ol.control.Attribution.prototype.handleToggle_ = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} True is the widget is collapsible.
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.getCollapsible = function() {
|
||||
@@ -363,7 +370,7 @@ ol.control.Attribution.prototype.getCollapsible = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {boolean} collapsible True is the widget is collapsible.
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
|
||||
@@ -379,7 +386,7 @@ ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {boolean} collapsed True is the widget is collapsed.
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
|
||||
@@ -391,7 +398,7 @@ ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} True is the widget is collapsed.
|
||||
* @return {boolean} True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.getCollapsed = function() {
|
||||
|
||||
+19
-9
@@ -172,9 +172,9 @@ ol.Map = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
* @type {Object}
|
||||
*/
|
||||
this.ol3Logo_ = optionsInternal.ol3Logo;
|
||||
this.logos_ = optionsInternal.logos;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -1209,7 +1209,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
index: this.frameIndex_++,
|
||||
layerStates: layerStates,
|
||||
layerStatesArray: layerStatesArray,
|
||||
logos: {},
|
||||
logos: this.logos_,
|
||||
pixelRatio: this.pixelRatio_,
|
||||
pixelToCoordinateMatrix: this.pixelToCoordinateMatrix_,
|
||||
postRenderFunctions: [],
|
||||
@@ -1222,9 +1222,6 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
viewHints: viewHints,
|
||||
wantedTiles: {}
|
||||
});
|
||||
if (this.ol3Logo_) {
|
||||
frameState.logos[ol.OL3_LOGO_URL] = ol.OL3_URL;
|
||||
}
|
||||
}
|
||||
|
||||
var preRenderFunctions = this.preRenderFunctions_;
|
||||
@@ -1382,7 +1379,7 @@ ol.Map.prototype.unskipFeature = function(feature) {
|
||||
* deviceOptions: olx.DeviceOptions,
|
||||
* interactions: ol.Collection,
|
||||
* keyboardEventTarget: (Element|Document),
|
||||
* ol3Logo: boolean,
|
||||
* logos: Object,
|
||||
* overlays: ol.Collection,
|
||||
* rendererConstructor:
|
||||
* function(new: ol.renderer.Map, Element, ol.Map),
|
||||
@@ -1414,7 +1411,20 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
*/
|
||||
var values = {};
|
||||
|
||||
var ol3Logo = goog.isDef(options.ol3Logo) ? options.ol3Logo : true;
|
||||
var logos = {};
|
||||
if (!goog.isDef(options.logo) ||
|
||||
(goog.isBoolean(options.logo) && options.logo)) {
|
||||
logos[ol.OL3_LOGO_URL] = ol.OL3_URL;
|
||||
} else {
|
||||
var logo = options.logo;
|
||||
if (goog.isString(logo)) {
|
||||
logos[logo] = '';
|
||||
} else if (goog.isObject(logo)) {
|
||||
goog.asserts.assertString(logo.href);
|
||||
goog.asserts.assertString(logo.src);
|
||||
logos[logo.src] = logo.href;
|
||||
}
|
||||
}
|
||||
|
||||
var layerGroup = (options.layers instanceof ol.layer.Group) ?
|
||||
options.layers : new ol.layer.Group({layers: options.layers});
|
||||
@@ -1512,7 +1522,7 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
deviceOptions: deviceOptions,
|
||||
interactions: interactions,
|
||||
keyboardEventTarget: keyboardEventTarget,
|
||||
ol3Logo: ol3Logo,
|
||||
logos: logos,
|
||||
overlays: overlays,
|
||||
rendererConstructor: rendererConstructor,
|
||||
values: values
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
goog.provide('ol.renderer.Layer');
|
||||
|
||||
goog.require('goog.Disposable');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.TileRange');
|
||||
goog.require('ol.TileState');
|
||||
@@ -160,7 +161,13 @@ ol.renderer.Layer.prototype.updateAttributions =
|
||||
ol.renderer.Layer.prototype.updateLogos = function(frameState, source) {
|
||||
var logo = source.getLogo();
|
||||
if (goog.isDef(logo)) {
|
||||
frameState.logos[logo] = '';
|
||||
if (goog.isString(logo)) {
|
||||
frameState.logos[logo] = '';
|
||||
} else if (goog.isObject(logo)) {
|
||||
goog.asserts.assertString(logo.href);
|
||||
goog.asserts.assertString(logo.src);
|
||||
frameState.logos[logo.src] = logo.href;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ goog.require('ol.source.Source');
|
||||
/**
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* extent: (null|ol.Extent|undefined),
|
||||
* logo: (string|undefined),
|
||||
* logo: (string|olx.LogoOptions|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* resolutions: (Array.<number>|undefined),
|
||||
* state: (ol.source.State|string|undefined)}}
|
||||
|
||||
@@ -23,7 +23,7 @@ ol.source.State = {
|
||||
/**
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* extent: (ol.Extent|undefined),
|
||||
* logo: (string|undefined),
|
||||
* logo: (string|olx.LogoOptions|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* state: (ol.source.State|string|undefined)}}
|
||||
*/
|
||||
@@ -69,7 +69,7 @@ ol.source.Source = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
* @type {string|olx.LogoOptions|undefined}
|
||||
*/
|
||||
this.logo_ = options.logo;
|
||||
|
||||
@@ -115,7 +115,7 @@ ol.source.Source.prototype.getExtent = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @return {string|undefined} Logo.
|
||||
* @return {string|olx.LogoOptions|undefined} Logo.
|
||||
*/
|
||||
ol.source.Source.prototype.getLogo = function() {
|
||||
return this.logo_;
|
||||
@@ -162,7 +162,7 @@ ol.source.Source.prototype.setExtent = function(extent) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {string|undefined} logo Logo.
|
||||
* @param {string|olx.LogoOptions|undefined} logo Logo.
|
||||
*/
|
||||
ol.source.Source.prototype.setLogo = function(logo) {
|
||||
this.logo_ = logo;
|
||||
|
||||
@@ -13,7 +13,7 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
/**
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* extent: (ol.Extent|undefined),
|
||||
* logo: (string|undefined),
|
||||
* logo: (string|olx.LogoOptions|undefined),
|
||||
* opaque: (boolean|undefined),
|
||||
* tilePixelRatio: (number|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
|
||||
Reference in New Issue
Block a user