YMapControl

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

Usage example

const control = new YMapControl();
class YMapSomeController 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 YMapSomeController({
    title: 'Click me!'
});
control.addChild(button);
map.addChild(control);
@see [[YMapControlCommonButton]]

Constructor

new YMapControl(props?, element?)

Constructor parameters

Parameter

Type

props

YMapControlProps

element?

HTMLElement

Redefines

YMapGroupEntity.constructor

Props

YMapControlProps: Object

Parameters

Parameter

Type

Description

transparent?

boolean

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

Methods

addChild

addChild(child, index?): YMapControl

Parameters

Parameter

Type

child

YMapEntity><unknown, {}>

index?

number

Returns

YMapControl

Inherited from

YMapGroupEntity.addChild

removeChild

removeChild(child): YMapControl

Parameters

Parameter

Type

child

YMapEntity<unknown, {}>

Returns

YMapControl

Inherited from

YMapGroupEntity.removeChild

update

update(changedProps): void

Parameters

Parameter

Type

Description

changedProps

Partial<YMapControlProps>

New props values.

Returns

void

Inherited from

YMapGroupEntity.update