Base class for buttons

Use the Button class as base class or create a fully configurable instance directly.

A button is an OpenLayer control with a default layout. You can change some style classes, tooltips etc. with the ButtonOptions

Some buttons extend OpenLayer controls with its features, but most of them are just a shell for further implementations

You can set the icon font of the button with the unicode number or the iconClassName option.

A Button dispatches the CLICK event so that you can listen to it with the on OpenLayer method Example:

const printCtrl = new Print({ preventDefault: true });
printCtrl.on(EventType.CLICK, this.handlePrint);

Alternatively you can override the handleEvent method

Remark

As a button is also a CompositeControl it can have child controls. E.g. it's used with the ToggleButton

Hierarchy

Events

Properties

button: HTMLButtonElement

The HTML element of the button *

childControls: Control[]

The child controls

iconClassName: null | string

The icons css class name *

on: ButtonOnSignature<EventsKey>
unicode: null | number

The unicode for the font icon *

Methods

  • This is the default click handler of a button

    Override it for your benefit or disable execution with options.preventDefault

    Parameters

    • event: BaseEvent

    Returns boolean

  • A setter to change the icon class name for the button. Resets the unicode for the button icon.

    Parameters

    • iconClassName: string

    Returns void

  • A setter to change the unicode for the button font icon. Removes the icon tag for the button icon.

    Parameters

    • unicode: number

    Returns void

  • Protected

    Get an icon element for the given css class name

    Parameters

    • iconClassName: string

    Returns HTMLElement

  • Protected

    Get an icon element for the given unicode font

    Parameters

    • unicode: number

    Returns HTMLElement

Generated using TypeDoc