Commit Graph
68 Commits
Author SHA1 Message Date
aiongg 17744430be docking: a divider drag keeps the split's fixed or ratio size (#291) 2026-10-24 16:18:39 -04:00
aiongg 5a371c978e docking: cancel the OS close of a native window that may not close (#288) 2026-10-24 16:14:58 -04:00
aiongg a0679c1dfc docking: dock column groups give way to the filler from their default heights (DockContent::dock_heights) (#287)
* docking: default, compact and fill heights for dock column groups

DockContent::dock_heights gives a panel's body heights in a dock column while the
user has not resized its group. Groups at their default give way down to their
compact heights so the filling group gets its fill height; then every group gives
way down to its minimum. Saved heights stay. Without it, layouts are unchanged.

* docking: dock column defaults give way nearest the filler first

The group nearest the filling group shrinks to its compact height before the next
one gives way, so groups further up keep their defaults.

* docking: shared groups with different minimums split the rest evenly above their minimums

* docking: a group asking for a fill height fills the column beside groups without dock heights
2026-10-24 16:14:38 -04:00
aiongg 6680968a83 docking: DockArea::locked draws a locked workspace; a lock still records native windows 2026-10-24 13:12:58 +00:00
aiongg 1564d54959 docking: a native window moved by its only tab or group joins a body's center
Dragging a native window's only tab, or its only group, moves the
window and docks it on release. It took a frame's edges and its tab
strip but not its body's center, a rule meant for the bar, so the
center rectangle was neither a target nor filled under the pointer.
Such a move now joins the center as the tab or group drag would; the
bar still does not.
2026-10-24 04:49:32 +00:00
aiongg 3250dd2305 docking: the macOS × sits 8 pt from the corner, its hit area reaching away from it
The ×'s glyph inset, size and hit area are set in one place (MACOS_CLOSE,
OTHER_CLOSE in render/native.rs). On macOS the glyph sits where macOS puts its
close button, and the hit area reaches 10 pt toward the leading edge and down
to the bar's bottom, past AppKit's corner resize area. Elsewhere the layout is
the same as before. CRAFT_DOCK_DEBUG_CLOSE=1 outlines the hit area and AppKit's
resize areas.
2026-10-24 03:53:42 +00:00
aiongg 09e14347d3 Merge branch 'docking' into dock-windows 2026-10-24 03:44:56 +00:00
aiongg 2f90228e10 docking: a narrow group splits when its neighbours have room for both halves
A side split that leaves a half at its minimum is taken when the
dividers along that half can still travel, the groups beyond giving
way as they do for a dragged divider. An 80 pt group, whose halves
need 84, splits on all four sides and takes the rest from its
neighbour; only when the groups beyond are at their minimums too does
the drop join the group's tabs.
2026-10-24 03:41:27 +00:00
aiongg 308163bcb5 docking: macOS resizes native windows itself, bands elsewhere are 6 pt with 16 pt corners
On macOS the native window is resizable by AppKit again, with its own areas
and cursors. The bar's buttons sit 19 pt in from the trailing edge, clear of
AppKit's corner area (about 15 pt into the window, a 19 pt square measured on
macOS 26), and the window sets no cursor of its own over AppKit's areas.
Elsewhere the bands are 6 pt deep with 16 pt corner Ls, and hand the resize
to the window system; the manual resize path is gone.
2026-10-24 03:40:17 +00:00
aiongg 1c24845a17 Merge branch 'docking' into dock-windows 2026-10-24 03:13:34 +00:00
aiongg 1ccdad9512 docking: Floating::with_id for layouts built in code; debug builds warn about rebuilt layouts
Floating::new, single and stack draw a fresh id on each call, so a layout
built anew each frame opened a new OS window each frame. with_id gives such
a layout the same windows every frame. Debug builds log a warning once when
three frames running replace every native window with new ones holding the
same panels.
2026-10-24 03:09:14 +00:00
aiongg cb352b39ff docking: all four drop zones of a group share one depth
Each side zone reaches zone_depth into the body, or a quarter of the
body's smaller side when that is less. A tall narrow group's top and
bottom zones are no deeper than its left and right ones.
2026-10-24 03:06:11 +00:00
aiongg 99d8fe537e docking: a dragged divider shrinks the groups beyond it in turn
A divider dragged past the minimum of the group it shrinks moves on to
the next group along the axis, and so on until every group on that side
is at its minimum. The line follows same-axis splits up the tree and
ends at a split across the axis or beside a dock. Groups touching the
divider on the other side grow, up to their maximums, as before.

Stacked panels and the groups of a dock column cascade the same way.
2026-10-24 03:05:32 +00:00
aiongg b892ec92e2 docking: native window bar buttons win over the resize bands, corners are 4 pt Ls
The bands along a native window's edges leave out the bar's buttons, which
sit 4 pt in from the window's edge. Each corner is an L, 4 pt deep and 12 pt
along both edges. macOS windows are not resizable by AppKit, whose resize
areas reach over the ×; the bands resize them by InnerSize and OuterPosition,
since winit has no BeginResize there.
2026-10-24 03:05:03 +00:00
aiongg 0008f89212 Merge branch 'docking' into dock-windows
Native windows draw a frame's drop zones through the destination window's
painter, and the bar-docking test aims inside the 40 pt right band.
2026-10-24 00:00:43 +00:00
aiongg e6c76f5151 docking: drop zones are 40 pt bands below the tab strip, all outlined while dragging
A frame's side zones reach DockStyle::zone_depth (40 pt) into the body below
the tab strip, or a third of a smaller body, so a frame keeps its center.
drop_zone, zone_shape and resolve_drop take the depth. In the Frame style a
drag over a frame outlines every zone a drop there would change something in
and fills the one under the pointer, without the outline of the resulting rect.
2026-10-23 23:57:43 +00:00
aiongg 909410258b docking: document native window placement, moves and mixed scale factors 2026-10-23 18:06:10 +00:00
aiongg 783793cbbc docking: document where a native window's bar docks it 2026-10-23 17:31:11 +00:00
aiongg 619c93ea29 docking: document drags between OS windows 2026-10-23 17:24:25 +00:00
aiongg 99f4511e6d docking: document native windows 2026-10-23 08:27:19 +00:00
aiongg 01ce7162a4 docking: Floating::stack is public, and four-way handles take the pointer only
Floating::stack builds a window from groups stacked top to bottom, so an
app's own stacked layouts migrate without building the split chain. The
four-way handle no longer takes keyboard focus: it has no label or key
action, and the two dividers it joins take arrow keys.
2026-10-23 06:11:03 +00:00
aiongg 281ea71f5b docking: the drop preview shows the zone under the pointer
With side_edge_zones, a drop on a group fills the zone the pointer is in
(a side's trapezoid, or the center rectangle with the tab strip) and
outlines the rect the drop gives what moves. zone_shape gives a zone's
outline; DockDriver::filled_polygon checks it. The dock-and-canvas
arrangement keeps its filled half and insertion lines.
2026-10-22 20:20:26 +00:00
aiongg 809bf90936 docking: a floating window holds a tree like the docked layout
Floating::root replaces the stack of groups. A floating window takes
splits in any direction, tab groups and accordions; its groups split,
join and resize like frames, with the Sizer, four-way handles
(Divider::WindowSplit, Divider::WindowIntersection,
Action::ResizeWindowSplit) and the room check. Tabs and drag bars inside
it show the targets of every window and dock; Undock Panel Group floats
one group of a window that has several. Floating::minimized replaces
per-group minimizing in a window.

Saved layouts keep loading: a stored stack of groups becomes a vertical
split sized by the groups' heights. Placement::Group on a floating anchor
splits its group above or below. A window moved onto a dock keeps its
groups as stacked groups.
2026-10-22 20:19:09 +00:00
aiongg 5abc37e454 docking: a release over no target cancels; the title bar only moves a window
Two DockStyle settings, on by default so the dock-and-canvas arrangement
keeps its behaviour. Without float_on_empty_drop, a tab or group released
over no target inside the app window (the gap between groups, a menu bar,
a status bar) cancels the drag; Ctrl/Cmd or a release outside the window
floats it. Without title_bar_docks, dragging a floating window's title bar
only moves the window.
2026-10-22 20:08:18 +00:00
aiongg d30c207c8d docking: one model; profile differences are style data
Remove `Profile`. What it switched is now a `DockStyle` setting with the
dock-and-canvas behaviour as the default: `side_edge_zones`,
`new_dock_zones`, `maximize_item`, `close_others_item`,
`command_press_floats`, `float_hint`, and plain bools for
`wheel_selects_tabs` and `middle_click_closes_tabs`. The undock and
Close Panel Group labels go; an app sets `float_label`,
`float_group_label` and `close_group_label` instead.

Remove the size machinery that made frames stick: `DockContent::bare`,
`FixedSlot` and the split that took a parent's or sibling's half beside
a fixed-size frame, and the gap snapping to the nearest frame. A tab
group takes the largest maximum of its panels, so a panel without one
lifts the cap of the group it joins. A dragged divider stores a ratio
whatever mode it was saved with.

Sizes follow the reference rules: a divider resizes only the groups
that touch it and stops at their minimums; a four-way handle where a
divider ends on another moves both (`Divider::Intersection`); a split or
outer-edge drop that would leave a group without `min_pane` is not
offered, and a group too small to halve takes the drop as a tab.

Tests: one per rule, the stuck cases from the FilmCraft map, and a
property test over random drops checking minimums and divider travel.
2026-10-22 20:01:31 +00:00
aiongg 7d786e5108 docking: the Frame profile drop preview says which key floats
While a drag offers a docking target, a hint under the pointer reads
"Hold Ctrl to float" ("Hold ⌘ to float" on macOS), from the
localizable float_hint_label (key dock.floatHint).
2026-10-21 16:45:29 +00:00
aiongg 899807ff19 docking: a split beside a fixed-size frame keeps that frame's size
A side split replaced the anchor frame in place, so a split beside a
fixed-width frame such as a tool strip took the frame's fixed slot:
the two frames shared its width, and the parent's divider resized both.
The frame now keeps its size: on its outer side the new split wraps the
parent, on its inner side it halves the parent's other child. The drop
preview shows the half the new frame takes.
2026-10-21 16:44:06 +00:00
aiongg 40c59bb577 docking: narrow frames keep usable side drop zones, and seams split
A side zone is a quarter of the frame deep, at least 32 pt and at most
half the frame, so a 64 pt tool strip offers its left and right edges
past the outer edge band. A pointer in the gap between frames resolves
to the nearest frame's edge instead of floating.
2026-10-21 16:40:59 +00:00
aiongg 2fa4ad79d7 docking: floating windows stay inside the app's float bounds
DockArea::float_bounds sets where floating windows, flyouts and drag ghosts may go; the default is the whole viewport. An app with its own title bar under a transparent macOS title bar passes the viewport below it, so a floating window can't be dropped, dragged or restored where pressing it moves the app window.
2026-10-21 16:19:25 +00:00
aiongg a0b923ac1e docking: icon groups reserve no drag strip
An icon group's drag band covers the separator above it and the top 4 pt of its first icon, so icons are spaced only by the separators between groups.
2026-10-21 04:40:33 +00:00
aiongg 592cba1ca1 docking: drag areas draw no grip marks
The drag strip beside the tabs, the column bar, the floating title bar and the strip above an icon group stay draggable, with the grab cursor and the hover outline, but paint no grip lines.
2026-10-21 04:12:09 +00:00
aiongg 0fe98b3be9 docking: Target, Side, ResizeEdge, Profile and DockStyle are non_exhaustive
New variants and style fields can then be added without breaking apps.
DockStyle gains from_visuals and Default for building a style without a Ui.
2026-10-20 15:26:57 +00:00
aiongg bc4addb8d4 docking: opening works when locked, and hiding respects closable
OpenAt checked the opened panel's movable, so a locked workspace refused
OpenAt while Open worked. It checks movable only for a panel already
shown. Workspace::set_visible takes the app's permissions, so hiding
cannot close a protected canvas.
2026-10-20 15:21:51 +00:00
aiongg c084db9c78 docking: a pointer drag on a divider or resize grip leaves no focus behind
Keeping focus on the handle after a pointer drag broke app shortcuts
that defer to a focused widget (egui_wants_keyboard_input), and arrow
keys moved both the canvas selection and the divider. A handle focused
by the pointer gives the focus up on release; one reached with Tab or
F6 keeps it, and arrow keys resize it.
2026-10-20 15:21:46 +00:00
aiongg 41a14168ea docking: reconcile and restore keep a protected canvas shown
Restoring beside a sibling subtree needed the exact same set of panels,
so a migrated layout without the canvas put the canvas in hidden. Restore
splits the anchor alone when the subtree changed. reconcile takes the
panels' permissions and never leaves a registered panel that cannot
close in hidden: it goes back to its recorded or default place, else to
the outer edge of the docked area.
2026-10-20 15:12:06 +00:00
aiongg 4310fc72a1 docking: window.panel.dock to a side never anchors on what moves
On the first panel of the last column, the command picked that panel as
its own anchor and failed with InvalidPlacement. The anchor is a panel of
the last column outside the moving unit; when the unit already is that
column, the command does nothing.
2026-10-20 15:09:34 +00:00
aionggandfilipessmedeiros-collab 07585888d6 docking: floating windows resize from the top edge and corners
A resizable FloatingFrame keeps a 4 pt band above its contents for the
Top, TopLeft and TopRight handles, so they take no title bar moves or
button clicks. They keep the opposite edges in place, respect the size
limits and the screen, take arrow keys when focused, and have hit ids.
Moves carry the whole frame rect, band included.

Ported from #189.

Co-authored-by: filipessmedeiros-collab <343926472+filipessmedeiros-collab@users.noreply.github.com>
2026-10-20 03:51:38 +00:00
aiongg 46f2ffd654 docking: a press in a group header focuses the shown panel
Host widgets in the header, such as a menu button or the host's own tabs,
focus the panel the way a press on its tab or body does.
2026-10-20 03:47:12 +00:00
aiongg 91e8cf401e docking: chrome_has_focus recognizes every control a Hit names
It checks the same widget ids as hit_rects and hit_id, which adds icons and
icon grips.
2026-10-20 03:46:31 +00:00
aiongg ae0c19b49b docking: hidden floating windows do not cover dock targets
Dock targets check the floating windows drawn this frame instead of every
window's last egui area rect. floating_layer says that an undrawn window
keeps its last area rect.
2026-10-20 03:44:25 +00:00
aiongg ceb75f965e ui: use US spelling 2026-10-20 03:24:45 +00:00
aiongg 95c81fa6de docking: say that the drag bar's menu opens on a right click
A left click on the drag bar focuses it and opens nothing, as designed;
the Hit::DragBar docs said otherwise.
2026-10-20 01:00:30 +00:00
aiongg a76d196b80 docking: dividers and resize grips keep focus after a pointer drag
Arrow keys resize the handle right after a drag. Focus that came from
the pointer draws no highlight until a key is pressed, and hovering
still focuses nothing.
2026-10-20 01:00:22 +00:00
aiongg 877f676e19 docking: menu item labels in title case
Float Panel, Close Panel and Move Group To match the other menu items.
Control names that only screen readers announce stay in sentence case.
2026-10-20 00:59:33 +00:00
aiongg 38e2b27a30 docking: window.panel.dock with an edge zone and no anchor docks at that edge
A left, right, top or bottom zone without anchor or side maps to
Placement::Edge, anchored on any docked panel that does not move. A
hidden panel is shown and moved in one step, all or nothing.
2026-10-20 00:59:02 +00:00
aiongg 89849272a0 docking: public widget ids and floating window layers
DockArea::hit_id gives the egui id of the control a Hit names, and
DockArea::floating_layer the layer of a floating window, so apps and
their tests stop rebuilding internal ids. The divider between stacked
groups has one id in docks and floating windows.
2026-10-20 00:58:10 +00:00
aiongg 30cebdc0f2 docking: content that fills its body floats at floating_size or 320
A panel body that reaches the bottom of its rect has no height of its
own, so a floated panel or group falls back to floating_size, else 320
points, instead of the whole frame height. A body in a window fitted to
its recorded height keeps that height. Panels leaving a frame fit their
content like panels leaving a dock.
2026-10-20 00:57:14 +00:00
aiongg b94df6c8b6 docking: wheel selects tabs and middle click closes a tab
Both are on in the Frame profile and off by default in the Dock profile;
DockStyle::wheel_selects_tabs and middle_click_closes_tabs set them. A
middle click closes only a closable panel.
2026-10-20 00:55:43 +00:00
aiongg d3079230da docking: group_header_width gets the tab strip width
A header that draws its own tabs, such as a timeline's open sequences,
sizes them to the room the strip has.
2026-10-20 00:54:23 +00:00
aiongg 787b706274 docs: say when a tab is cut and that the drag bar keeps its width 2026-10-19 15:37:00 +00:00