Skip to content

ym.modules.provider.Control

Overview

The base class for all leaflet controls. It implements the IControl interface, allowing you to add controls to the map:

control = new ym.modules.provider.Control.Zoom();
control.addTo(map);
// same as
map.addControl(control);

Initialization

Factory: ym.control(options)

  • Parameters
  • options
    • Description: The starting position of the control (one of the map corners). See control positions below.
    • Data type: string
    • Default value: topright

Methods

setPosition(position)

Defines the position of the control. See control positions below.

  • Parameter
  • position

    • Data type:
  • Return: this

getPosition()

Returns the current position of the control.

  • Return: string

addTo(map)

Adds the control to the map.

  • Parameter
  • map

    • Data type:
  • Return: this

removeFrom(map)

Removes the control from the map.

  • Parameter
  • map

    • Data type:
  • Return: this

getContainer()

Returns the HTML container of the control.

  • Return: HTML element

Control Positions

  • topleft: Upper left corner of the map.
  • topright: Upper right corner of the map.
  • bottomleft: Lower left corner of the map.
  • bottomright: Lower right corner of the map.