@@ -9,8 +9,8 @@ description: Floating canvas chrome in named regions — React, imperative, and
99Apollon renders an editor's chrome — toolbars, palettes, rails, banners — as
1010** floating controls anchored in named regions** of the canvas, not as separate
1111bars stacked around it. Host chrome and the editor's own overlays share one
12- collision-free layer, so they never overlap and the diagram knows how to make
13- room for them .
12+ measured layout layer, so bands, rails, and corner controls deconflict through the
13+ same rules and the diagram knows how to make room for reserving chrome .
1414
1515A control is positioned by ** region** (where it sits) and can optionally
1616** reserve space** so the diagram "makes way" for it. Reservation is measured, not
@@ -61,11 +61,17 @@ overlay store — only real option changes (region, inset, order, …) push an
6161update.
6262
6363``` tsx no-check
64- import { Apollon , ApollonControl , UMLDiagramType } from " @tumaet/apollon"
64+ import {
65+ Apollon ,
66+ ApollonControl ,
67+ ApollonDefaultControls ,
68+ UMLDiagramType ,
69+ } from " @tumaet/apollon"
6570
6671function Editor() {
6772 return (
6873 <Apollon defaultType = { UMLDiagramType .ClassDiagram } >
74+ <ApollonDefaultControls />
6975 <ApollonControl id = " my-app:export" region = " top-right" groupLabel = " Export" >
7076 <button type = " button" onClick = { exportDiagram } >
7177 Export
@@ -79,7 +85,10 @@ function Editor() {
7985` ApollonControlProps ` is [ ` OverlayControlOptions ` ] ( #overlaycontroloptions ) plus
8086` children: ReactNode ` . The component renders ` null ` in the host tree; the visible
8187output is the portaled ` children ` . The ` id ` must be stable — changing it
82- re-registers a fresh control.
88+ re-registers a fresh control. Supplying children to ` <Apollon> ` means you own the
89+ composition; include ` <ApollonDefaultControls /> ` (or the individual
90+ ` <Apollon.Palette /> ` , ` <Apollon.Zoom /> ` , ` <Apollon.MiniMap /> ` ) when a custom
91+ child should keep the default chrome visible.
8392
8493## The imperative way: ` addControl `
8594
@@ -127,8 +136,10 @@ reserved ids (`PALETTE_ID`, `ZOOM_ID`, `MINIMAP_ID`). You compose them the same
127136two ways.
128137
129138** React — as ` <Apollon> ` children.** Presence renders, omission hides, typed
130- props reconfigure. Passing _ any_ children opts out of the defaults, so you list
131- exactly the chrome you want (an empty composition is a bare canvas).
139+ props reconfigure. Passing _ any_ children makes the composition explicit, so you
140+ list exactly the chrome you want. Use ` <ApollonDefaultControls /> ` to keep the
141+ standard palette + zoom + minimap next to custom children; pass ` null ` or an empty
142+ fragment for a bare canvas.
132143
133144``` tsx no-check
134145import { Apollon , UMLDiagramType } from " @tumaet/apollon"
@@ -343,12 +354,12 @@ control never drags the diagram.
343354 ` region="bottom-right" ` with ` inset={{ bottom: "auto" }} ` instead: the diagram
344355 still reserves bottom room for the island, but unrelated bottom-left chrome
345356 stays flush.
346- - ** Corners clear full-width bands, not empty rail columns .** Top/bottom corner
357+ - ** Corners clear full-width bands and same-side rails .** Top/bottom corner
347358 controls sit below a header and above a footer structurally. Side rails share
348- the side track with the corner slots, so short rails leave bottom/top corners
349- flush instead of reserving an empty column. The built-in minimap uses the same
350- corner slots, so it stacks with host controls in its region instead of applying
351- its own side offsets.
359+ the side track with the corner slots and are padded by the measured same-side
360+ corner extent, so short rails leave corners flush while tall rails avoid covering
361+ them. The built-in minimap uses the same corner slots, so it stacks with host
362+ controls in its region instead of applying its own side offsets.
352363- ** Selection-anchored toolbars** — ` <Apollon.SelectionToolbar> ` (Figma/tldraw
353364 style): a screen-space, constant-size toolbar that follows the current selection.
354365 Distinct from ` on-canvas ` , which lives in diagram space and scales with zoom.
0 commit comments