Hakushi.Issho.Place (Hakushi v0.6.0)

Copy Markdown View Source

A place on a Hakushi canvas, in the canvas's own terms (never screen pixels, as each person has their own pan and zoom): where a person's pointer is, where an agent goes (Issho.Motion), what an app keeps of them. Its format is part of Hakushi's public API, and only grows.

%{"point" => [x, y]}          # a point, in the canvas's coordinates
%{"node" => node_id}          # a node
%{"nodes" => [node_id, ...]}  # nodes (the first is where it is drawn)

In the room, it is the "at" of a place of the canvas's document: %{"doc" => "board:42", "at" => %{"point" => [120, 80]}}.

label/3 says a place in words, for a thread of comments on it.

Summary

Functions

A place of the canvas in words, from its graph: for a thread of comments on the canvas (Issho.Components.comments/1's :place slot), or wherever your app says where something is.

Functions

label(place, graph, opts \\ [])

@spec label(map() | nil, Hakushi.Graph.t() | nil, keyword()) :: String.t() | nil

A place of the canvas in words, from its graph: for a thread of comments on the canvas (Issho.Components.comments/1's :place slot), or wherever your app says where something is.

<.comments id="comments" room="schema:42">
  <:place :let={%{place: place, default: default}}>
    {Hakushi.Issho.Place.label(place, @graph, document: "schema:42") || default}
  </:place>
</.comments>

It gives The node “customers” (the node's name, as the canvas says it to a screen reader), The node “customers” and 2 more, or A point on the canvas; and nil for a place of another document, or of nodes that are gone, for your own words.

place is a place of the room (%{"doc" => doc, "at" => at}), or its at. Options: :document, the canvas's (a place of another document is nil); :locale and :messages, as the canvas's; and :kits and :node_label, as the canvas's, for the names of its nodes.

@graph is the graph as it is now: a LiveView keeps it with the canvas's events (see "Events" in Hakushi.Issho), or reads it with Hakushi.Issho.graph/2.