HoloMap.Layer.Background (HoloMap v0.3.0)

Copy Markdown View Source

A colour or a pattern over the whole map, beneath everything else.

<HoloMap.Layer.Background id="paper" paint={%{background_color: "#f8fafc"}} />

A HoloMap.Layer locked to type: "background". A background draws no source: it fills the map, so the component has no source, source_layer or filter prop. It has no event props either: MapLibre finds no feature on a background, so it reports no layer event for one. paint, layout, min_zoom, max_zoom, before_id, visible and metadata work as on any layer, and so do the ordering rules in HoloMap.Layer.

It is how a page builds a map on a style with no layers of its own, such as %{"version" => 8, "sources" => %{}, "layers" => []}, and how one paints a colour that follows state without touching the style. Layers declared after it draw on top; put it first, or name the layer it goes beneath with before_id.

Paint properties

background_color, background_opacity, background_pattern.

background_pattern names an image, as icon_image does: one the style's sprite holds, one HoloMap.Image registers, or "<id>:<icon>" of a HoloMap.Sprite.

Layout properties

visibility.

Property names may be written as atoms in Elixir style (:background_color) or as MapLibre specification names ("background-color"); both reach MapLibre as the latter. The full reference lives in the MapLibre style specification.

Summary

Functions

Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).

Returns the list of property definitions for the compiled component.

Functions

__is_hologram_component__()

@spec __is_hologram_component__() :: boolean()

Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).

Examples

iex> __is_hologram_component__()
true

__props__()

@spec __props__() :: [{atom(), atom(), keyword()}]

Returns the list of property definitions for the compiled component.