lustre_kakaomap/custom_overlay

CustomOverlay for KakaoMap — flexible HTML-based overlay.

Types

Options for creating a custom overlay.

pub opaque type CustomOverlayOption

Values

pub fn add(
  id id: String,
  overlay_id overlay_id: String,
  options options: List(CustomOverlayOption),
) -> effect.Effect(msg)

Adds a custom overlay to the map.

pub fn clickable(enabled: Bool) -> CustomOverlayOption

Sets whether clicks prevent map events.

pub fn content(html: String) -> CustomOverlayOption

Sets the HTML content. Required.

pub fn content_element(
  el: element.Element(msg),
) -> CustomOverlayOption

Sets content from a Lustre Element (type-safe alternative to content/1).

custom_overlay.content_element(
  html.div([attribute.style("padding", "8px")], [
    element.text("Hello!"),
  ])
)
pub fn position(pos: coords.LatLng) -> CustomOverlayOption

Sets the position. Required.

pub fn remove(
  id id: String,
  overlay_id overlay_id: String,
) -> effect.Effect(msg)

Removes a custom overlay.

pub fn set_content(
  id id: String,
  overlay_id overlay_id: String,
  html html: String,
) -> effect.Effect(msg)

Updates the content.

pub fn set_position(
  id id: String,
  overlay_id overlay_id: String,
  pos pos: coords.LatLng,
) -> effect.Effect(msg)

Updates the position.

pub fn set_visible(
  id id: String,
  overlay_id overlay_id: String,
  visible visible: Bool,
) -> effect.Effect(msg)

Sets visibility.

pub fn sync(
  id id: String,
  overlays overlays: List(#(String, String, coords.LatLng)),
) -> effect.Effect(msg)

Synchronizes custom overlays on the map with a desired list. Adds new, removes missing, and updates changed content/positions.

custom_overlay.sync(id: "map", overlays: [
  #("label1", "<div>Seoul</div>", coords.seoul()),
  #("label2", "<div>Busan</div>", coords.busan()),
])
pub fn x_anchor(value: Float) -> CustomOverlayOption

Sets the x-axis anchor (0.0 to 1.0, default 0.5).

pub fn y_anchor(value: Float) -> CustomOverlayOption

Sets the y-axis anchor (0.0 to 1.0, default 0.5).

pub fn z_index(index: Int) -> CustomOverlayOption

Sets the z-index.

Search Document