HoloMap.Control (HoloMap v0.1.0)

Copy Markdown View Source

Namespace for MapLibre's built-in map controls.

<HoloMap.Map cid="explorer" style={@style}>
  <HoloMap.Control.Navigation position="top-right" />
  <HoloMap.Control.Scale unit="metric" position="bottom-left" />
</HoloMap.Map>

Every control takes a position: "top-left", "top-right", "bottom-left" or "bottom-right", defaulting to "top-right". Several controls in the same corner stack in the order they are declared.

Available controls

Attribution

MapLibre adds an attribution control on its own unless told otherwise. Adding HoloMap.Control.Attribution on top of that produces two. Set attribution_control={false} on HoloMap.Map when you want to place it yourself.

Attribution is usually a licensing obligation rather than a design choice, so removing it entirely is generally not yours to decide. Prefer compact.

Updates

Controls carry no updatable state that is worth diffing, so any prop change removes and re-adds the control. That is invisible for the built-ins here, but it does mean a control is not the place to put a rapidly changing value.

Summary

Functions

The four corners a control can be placed in.

Functions

positions()

@spec positions() :: [String.t()]

The four corners a control can be placed in.

iex> HoloMap.Control.positions()
["top-left", "top-right", "bottom-left", "bottom-right"]