Widgets

PolygonMarker

PolygonMarker

PolygonMarker control. Build it with the polygon_marker helper.

Example

service_area = polygon_marker(
  coordinates: [
    [51.51, -0.12],
    [51.50, -0.06],
    [51.48, -0.09]
  ],
  color: "#3b82f633",
  border_color: :blue_600,
  border_stroke_width: 2,
  label: "Service area"
)

page.add(
  map(
    [
      tile_layer(url_template: "https://tile.openstreetmap.org/{z}/{x}/{y}.png"),
      polygon_layer([service_area])
    ],
    initial_center: [51.50, -0.09],
    initial_zoom: 12,
    expand: true
  )
)

Properties

  • border_color — Border color.
  • border_stroke_width — Border stroke width.
  • color — Foreground color.
  • coordinates — Sets the coordinates property.
  • disable_holes_border — Sets the disable holes border property.
  • label — Text label shown for the control.
  • label_text_style — Label text style.
  • rotate_label — Sets the rotate label property.
  • stroke_cap — Sets the stroke cap property.
  • stroke_join — Sets the stroke join property.

Common layout and animation properties

  • data — Arbitrary value you can attach to the control and read back in handlers.
  • key — Stable identity used to preserve state across rebuilds.

Reference

  • Family: materials
  • Widget type: polygonmarker
  • Helpers: polygon_marker, polygonmarker