Skip to content

Explore embedding UnicodeMaps in a TUI (Tachikoma.jl) as a MapWidget #1

Description

@zsoerenm

Goal

Explore using UnicodeMaps inside a terminal-UI framework — concretely
Tachikoma.jl — and, if it fits,
provide a reusable map widget (a pannable/zoomable panel) rather than only
the standalone worldmap / explore entry points.

Why it should fit

render(center, zoom; size = (w, h)) is stateless and returns a w × h grid of
braille chars + 24-bit colors. That maps directly onto Tachikoma's
Model / update! / view architecture and its Buffer / set_char! model:

  • Model: lon, lat, zoom, and a reusable TileSource (for its tile cache).
  • view(model, frame): render at the widget's area size, then blit each
    cell into frame.buffer via set_char! (fg = cell color, bg = mc.background).
  • update!(model, event): arrow / + / - keys mutate lon/lat/zoom
    (reuse the existing pan/zoom math).

Standalone explore() and frame() would not be used inside Tachikoma — the
framework owns the terminal, event loop and double-buffering; only the core
render() is reused.

Known caveat

Tile fetching is synchronous over HTTP. In a 60 fps loop, the first visit to
an uncached tile stalls a frame (~100–300 ms). Cached tiles are instant, so
revisiting is smooth, but exploring new areas hitches. The clean fix is async
tile loading (fetch in a Task, redraw when ready) — which would also benefit
the standalone explore().

Tasks

  • Add a public embedding API so consumers don't reach into mc.canvas.grid
    — e.g. cells(mc) yielding (row, col, char, color, background).
  • Export the pan/zoom helpers (pan_center) for reuse in a host update!.
  • Async / background tile prefetch (fetch off the render path; redraw on arrival).
  • Prototype a MapWidget Model/update!/view against Tachikoma's real API
    and add it as an example (or an optional package extension).
  • Handle wide (CJK) label glyphs that can misalign a fixed-width cell grid.

References

  • Standalone interactive loop for comparison: src/interactive.jl (explore).
  • Renderer: src/render.jl (render, pan_center).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions