MapCanvas

Molecule

The card-less Leaflet canvas behind MapView: it fills its parent (give the parent a height), takes markers, zones and routes, and accepts a custom tile configuration (`tiles.url` + `tiles.attribution`). `showMarkers` / `showZones` / `showRoutes` (default true) hide a layer without moving the view: a hidden layer still counts for fit-to-bounds. `image` ({ url, width, height }) draws a picture (a floor plan) instead of tiles: flat coordinates, positions as `[y, x]` pixels from its top-left, the whole picture framed; the url must be an internal path or https. Display options (kui-react parity, also on MapView): `minZoom` / `maxZoom`, `cluster` + `clusterRadius` (count bubbles in the markers' shared colour), `showLabels`, `tooltipTrigger` (`hover` / `click` / `none`), `scrollWheelZoom`, `zoomControl`, `controlsPosition`, `fitMaxZoom` (15), `fitBounds`. Markers take `color`, `shape` (`pin` / `dot` / `circle` / `icon` / `image`), `icon` (Font Awesome class), `image` (for `shape: 'image'`: an internal path or https address, anything else falls back to a dot), `size` and `draggable`; a dropped draggable marker calls `onMarkerMove` (NAME of a global function; the bubbling `kui:map-marker-move` event fires too) with `(id, position)`: `[lat, lng]`, or on an image map `[y, x]` whole pixels from the picture's top-left, kept inside the picture; tooltips take a status `color` and an internal `href` + `linkLabel`, drawn in the kit's tokens. Default tiles: keyless Esri Light Gray / Dark Gray Canvas with place names. Use it inside a dashboard tile or panel that already has its own frame; use MapView for a standalone map card.

Default tiles

Preview
Loading map…
Code
<div class="h-72">
  <%- include('modules/ui/MapView/MapCanvas', { center: [40.5, 30.5], zoom: 6, markers: markers }) %>
</div>

Marker shapes, labels, clusters and click tooltips

Preview
Loading map…
Code
<div class="h-72">
  <%- include('modules/ui/MapView/MapCanvas', {
    markers: [{ id: 'd1', position: [41.02, 28.98], color: 'var(--error)', shape: 'circle', label: 'Pump 1',
                tooltip: { title: 'Pump 1', color: 'var(--error)', description: 'Offline', href: '/devices/d1', linkLabel: 'Details' } }],
    cluster: true, showLabels: true, tooltipTrigger: 'click', controlsPosition: 'topright', fitMaxZoom: 9,
  }) %>
</div>

Custom tiles

Preview
Loading map…
Code
<div class="h-72">
  <%- include('modules/ui/MapView/MapCanvas', {
    markers: markers,
    tiles: { url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', attribution: '&copy; OpenStreetMap contributors' },
    onMarkerClick: 'onMarker',   // NAME of a global function; the 'kui:map-marker-click' event fires too
  }) %>
</div>
Source modules/ui/MapView/MapCanvas.ejs