ol
Version:
OpenLayers mapping library
180 lines • 5.45 kB
TypeScript
/**
* Update the attribution element.
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {Attribution}
*/
export function render(mapEvent: import("../MapEvent.js").default): void;
export default Attribution;
export type Options = {
/**
* CSS class name.
*/
className?: string;
/**
* Specify a target if you
* want the control to be rendered outside of the map's
* viewport.
*/
target?: string | HTMLElement;
/**
* Specify if attributions can
* be collapsed. If not specified, sources control this behavior with their
* `attributionsCollapsible` setting.
*/
collapsible?: boolean;
/**
* Specify if attributions should
* be collapsed at startup.
*/
collapsed?: boolean;
/**
* Text label to use for the button tip.
*/
tipLabel?: string;
/**
* Text label to use for the
* collapsed attributions button.
* Instead of text, also an element (e.g. a `span` element) can be used.
*/
label?: string;
/**
* Text label to use
* for the expanded attributions button.
* Instead of text, also an element (e.g. a `span` element) can be used.
*/
collapseLabel?: string | HTMLElement;
/**
* Function called when
* the control should be re-rendered. This is called in a `requestAnimationFrame`
* callback.
*/
render?: (arg0: import("../MapEvent.js").default) => any;
};
/**
* @typedef {Object} Options
* @property {string} [className='ol-attribution'] CSS class name.
* @property {HTMLElement|string} [target] Specify a target if you
* want the control to be rendered outside of the map's
* viewport.
* @property {boolean} [collapsible] Specify if attributions can
* be collapsed. If not specified, sources control this behavior with their
* `attributionsCollapsible` setting.
* @property {boolean} [collapsed=true] Specify if attributions should
* be collapsed at startup.
* @property {string} [tipLabel='Attributions'] Text label to use for the button tip.
* @property {string} [label='i'] Text label to use for the
* collapsed attributions button.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|HTMLElement} [collapseLabel='»'] Text label to use
* for the expanded attributions button.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {function(import("../MapEvent.js").default)} [render] Function called when
* the control should be re-rendered. This is called in a `requestAnimationFrame`
* callback.
*/
/**
* @classdesc
* Control to show all the attributions associated with the layer sources
* in the map. This control is one of the default controls included in maps.
* By default it will show in the bottom right portion of the map, but this can
* be changed by using a css selector for `.ol-attribution`.
*
* @api
*/
declare class Attribution extends Control {
/**
* @param {Options=} opt_options Attribution options.
*/
constructor(opt_options?: Options);
/**
* @private
* @type {HTMLElement}
*/
private ulElement_;
/**
* @private
* @type {boolean}
*/
private collapsed_;
/**
* @private
* @type {boolean}
*/
private overrideCollapsible_;
/**
* @private
* @type {boolean}
*/
private collapsible_;
/**
* @private
* @type {HTMLElement}
*/
private collapseLabel_;
/**
* @private
* @type {HTMLElement}
*/
private label_;
/**
* A list of currently rendered resolutions.
* @type {Array<string>}
* @private
*/
private renderedAttributions_;
/**
* @private
* @type {boolean}
*/
private renderedVisible_;
/**
* Collect a list of visible attributions and set the collapsible state.
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
* @return {Array<string>} Attributions.
* @private
*/
private collectSourceAttributions_;
/**
* @private
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
*/
private updateElement_;
/**
* @param {MouseEvent} event The event to handle
* @private
*/
private handleClick_;
/**
* @private
*/
private handleToggle_;
/**
* Return `true` if the attribution is collapsible, `false` otherwise.
* @return {boolean} True if the widget is collapsible.
* @api
*/
getCollapsible(): boolean;
/**
* Set whether the attribution should be collapsible.
* @param {boolean} collapsible True if the widget is collapsible.
* @api
*/
setCollapsible(collapsible: boolean): void;
/**
* Collapse or expand the attribution according to the passed parameter. Will
* not do anything if the attribution isn't collapsible or if the current
* collapsed state is already the one requested.
* @param {boolean} collapsed True if the widget is collapsed.
* @api
*/
setCollapsed(collapsed: boolean): void;
/**
* Return `true` when the attribution is currently collapsed or `false`
* otherwise.
* @return {boolean} True if the widget is collapsed.
* @api
*/
getCollapsed(): boolean;
}
import Control from "./Control.js";
//# sourceMappingURL=Attribution.d.ts.map