Remove Logo Control
This commit is contained in:
@@ -718,8 +718,6 @@ olx.control.ControlOptions.prototype.target;
|
|||||||
/**
|
/**
|
||||||
* @typedef {{attribution: (boolean|undefined),
|
* @typedef {{attribution: (boolean|undefined),
|
||||||
* attributionOptions: (olx.control.AttributionOptions|undefined),
|
* attributionOptions: (olx.control.AttributionOptions|undefined),
|
||||||
* logo: (boolean|undefined),
|
|
||||||
* logoOptions: (olx.control.LogoOptions|undefined),
|
|
||||||
* zoom: (boolean|undefined),
|
* zoom: (boolean|undefined),
|
||||||
* rotateOptions: (olx.control.RotateOptions|undefined),
|
* rotateOptions: (olx.control.RotateOptions|undefined),
|
||||||
* zoomOptions: (olx.control.ZoomOptions|undefined)}}
|
* zoomOptions: (olx.control.ZoomOptions|undefined)}}
|
||||||
@@ -742,20 +740,6 @@ olx.control.DefaultsOptions.prototype.attribution;
|
|||||||
olx.control.DefaultsOptions.prototype.attributionOptions;
|
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`.
|
* Rotate. Default is `true`.
|
||||||
* @type {boolean|undefined}
|
* @type {boolean|undefined}
|
||||||
@@ -822,28 +806,6 @@ olx.control.FullScreenOptions.prototype.keys;
|
|||||||
olx.control.FullScreenOptions.prototype.target;
|
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),
|
* @typedef {{className: (string|undefined),
|
||||||
* coordinateFormat: (ol.CoordinateFormatType|undefined),
|
* coordinateFormat: (ol.CoordinateFormatType|undefined),
|
||||||
|
|||||||
@@ -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.<string, Element>}
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user