MMapControlButton
The MMapControlButton
class is a component for creating a button control element.
Usage example
Adding a button that moves the map center to Dubai:
const map = new MMap(element, {
location: {center: [25.229762, 55.289311], zoom: 14}
});
const controls = new MMapControls({position: 'top left'});
const button = new MMapControlButton({
text: 'Dubai',
onClick: () => {
map.setLocation({
center: [25.229762, 55.289311],
zoom: 5
});
}
});
controls.addChild(button);
map.addChild(controls);
The MMapControlButton
class is used to add a standard button and set up custom behavior for it.
Example
const button = new MMapControlButton({
text: 'Hello',
onClick: () => alert('Hello world!')
});
Constructor
new MMapControlButton(props
, options?
)
Constructor parameters
Parameter |
Type |
|
|
|
|
|
|
Inherited from
new MMapControlButton(props
, children?
, options?
)
Parameters
Parameter |
Type |
|
|
|
|
|
|
Inherited from
Props
MMapControlButtonProps: <a href="#MMapControlCommonButtonProps">MMapControlCommonButtonProps
Parameters
Parameter |
Type |
Description |
|
|
Background color. |
|
|
Text color. |
|
|
Must be disabled. |
|
HTML element. |
|
|
() => |
Onclick handler. |
|
|
Content text. |
Methods
update
update(changedProps
): void
Parameters
Parameter |
Type |
Description |
|
New props values. |
Returns
void