MMapControl

The MMapControl class is a DOM shell for creating custom controls. It contains styles for a control.

Usage example

const control = new MMapControl();
class MMapSomeController extends DomEntity {
    _createDom() {
        const element = document.createElement('button');
        this._updateDom(element, this._props, true);
        return element;
    }
    _updateDom(element, props, init = false) {
        element.innerText = props.title;
    }
}
const button = new MMapSomeController({
    title: 'Click me!'
});
control.addChild(button);
map.addChild(control);
@see [[MMapControlCommonButton]]

Constructor

new MMapControl(props?, element?)

Constructor parameters

Parameter

Type

props

MMapControlProps

element?

HTMLElement

Redefines

MMapGroupEntity.constructor

Props

MMapControlProps: Object

Parameters

Parameter

Type

Description

transparent?

boolean

Makes a control transparent, removing the background color and shadows.

Methods

addChild

addChild(child, index?): MMapControl

Parameters

Parameter

Type

child

MMapEntity><unknown, {}>

index?

number

Returns

MMapControl

Inherited from

MMapGroupEntity.addChild

removeChild

removeChild(child): MMapControl

Parameters

Parameter

Type

child

MMapEntity<unknown, {}>

Returns

MMapControl

Inherited from

MMapGroupEntity.removeChild

update

update(changedProps): void

Parameters

Parameter

Type

Description

changedProps

Partial<MMapControlProps>

New props values.

Returns

void

Inherited from

MMapGroupEntity.update