Class: ControlManager

.ALS. ControlManager


new ControlManager()

Class with abilities of automatic control management.

L.ALS.Layer and L.ALS.System extends this class. Both support automatic position, but L.ALS.Layer also implements automatic control showing and hiding when the layer is selected or deselected.

It's generally a good thing to manage all controls through this class to maintain a uniform look.

Extends

  • L.Class

Members


<protected> _controlsShown :boolean

Indicates whether controls of this layer are shown

Type:
  • boolean

Methods


addControl(control, automanagePosition, positionOnMobile)

Adds control to this object. This control will be managed automatically.

Parameters:
Name Type Description
control Control

Control to add

automanagePosition "top" | "bottom" | undefined

When toolbar is enabled, users can move menu to left or right. It's always good to make controls always visible by moving it to the different side. ALS can do it for you, just set this argument to "top" or "bottom" to display control at the top or bottom side respectively. Or leave it as undefined, and ALS will not override control's position. This argument doesn't take effect when toolbar is disabled or user's device is a phone.

positionOnMobile "topleft" | "topright" | "bottomleft" | "bottomright" | "follow-menu" | undefined

Sets control position on mobile devices, if previous argument is used. Leave it as undefined, and ALS will not override control's position on mobile devices. If "follow-menu" is used (which is recommended since both menu and controls will be at the comfortable position), control will have automanagePosition and follow the menu side. This argument doesn't take effect when toolbar is disabled or user's device is a desktop.


removeControl(control)

Removes control from this object

Parameters:
Name Type Description
control Control

Control to remove