Skip to content

[EDITOR] Context menu improvements and type chips - #109

Merged
muit merged 18 commits into
feature/mir-backendfrom
feature/editor-improvements
Oct 23, 2026
Merged

muit merged 18 commits into
feature/mir-backendfrom
feature/editor-improvements

Conversation

@muit

@muit muit commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Reworks the graph context menu around a cache -> filter/score -> render pipeline, as a base for further editor improvements, along with visual and navigation improvements.

@muit
muit changed the base branch from main to feature/mir-backend October 22, 2026 18:36
muit added 4 commits October 22, 2026 23:22
Entries are cached before rendering, so filtering and scoring run as a
fast previous step over the cached entries. Search results are ranked by
match quality, and searches are standardized: names are matched
lowercase and without separators, so "Print Line" finds "PrintLine",
"print_line" or "print-line". Words of a term must all match but can
appear in any order.

- Categories with no children are not drawn
- Categories draw open by default
The first item of the menu is selected by default and follows the
filtered results. Up and down move the selection while the search input
keeps the keyboard, so the search can keep being refined. Enter applies
the selected item from a single place, which also fixes the first item
being spawned alongside the selected one.
The selected row draws as if hovered (or active while pressed) with
ImGuiSelectableFlags_Highlight, using a clearly brighter version of its
own color for colored rows. Nav focus rectangles are hidden, including
the one around the search bar.
The view follows the selection only when it moves or the results change,
so manual scrolling is left alone. The scroll rect leaves a one-line
margin so the next items stay slightly visible, and holding shift moves
the selection five items at a time.
@muit
muit force-pushed the feature/editor-improvements branch from 17ddd26 to afecb89 Compare October 22, 2026 21:27
# Conflicts:
#	Libs/Editor/Src/Utils/FunctionGraphContextMenu.cpp
@muit muit changed the title [EDITOR] Cache context menu entries and rank search results [EDITOR] Context menu rework Oct 22, 2026
@muit

muit commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

Type dropdown polish:

  • Categories hidden by default — TypeCombo now defaults to showCategories = false: all types are listed flat and sorted by name. The grouped Native / Structs / Classes view is still available by passing true.
  • Long chips no longer clip — the rows now report their chip width through ItemSize (new width parameter on UI::SelectableRow), so the combo popup uses ImGui's built-in AlwaysAutoResize auto-fit and grows to fit the widest type name. ImGuiSelectableFlags_SpanAvailWidth keeps the hover/click area spanning the full row. No manual width computation or size constraints.

Note: these type-chip commits are now on feature/editor-improvements (the separate PR #112 was closed), so a rebuild of this worktree shows them.

@muit

muit commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

More editor polish:

  • Closed type combo fits its selection — the combo now sizes itself from the selected type chip (chip + frame padding + arrow), capped at the available width. UI::DrawChip takes a maximum width and ellipsizes the name (AVeryLongCla…) instead of hard-clipping it.
  • Double-click a function reveals it — in the elements panel, double-clicking a function now opens (and focuses) the file that owns it, then clears the graph selection, selects the function node and centers it in the graph.

@muit

muit commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Chips are now real (non-interactive) items:

  • UI::Chip places a chip through ItemSize + ItemAdd(bb, 0) — proper layout geometry like any widget, but with no id, so it can't be clicked or navigated. Names are ellipsized to fit an optional maximum width.
  • Dropdown rows: the full-width selectable provides interaction; a chip item is placed on the same line for layout, so the combo popup grows through ImGui's normal content sizing (no manual width math).
  • Closed combo: the selection is drawn as a chip item inside BeginComboPreview, capped by the preview width and ellipsized.
  • Variable editor: the type column is wider now (name/type/value = 0.38/0.38/0.24 instead of 0.45/0.25/0.30).

@muit

muit commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Type combo fills its space again: the closed combo keeps the full available width (the callers' stretch width) instead of shrinking to the selected chip; only long names are ellipsized inside the frame. The dropdown keeps its content-based auto-fit.

@muit

muit commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Type combos all use chips now: the details panel combo no longer opts out — every TypeCombo shows the selected type as a chip (both call sites use the default selectedAsChip = true).

muit added 4 commits October 23, 2026 10:43
DrawChip paints a name over a rounded background of its color with an
optional icon and ellipsizes it to fit a maximum width. Chip places one
as a non-interactive item, so it takes layout space but has no id, and
SelectableRow draws a selectable row that can highlight like a hovered
item.
Type combo entries and the selected value are drawn as colored type
chips with the type icon, using the UI chip widgets. Entries report
their size to the layout so the dropdown grows to fit them, the closed
combo fills its column and ellipsizes long names, and types are listed
flat by default with an option to group them by category.
The variable editor gives types a wider column, and double clicking a
function opens its file, selects its node and centers the graph on it.
@muit
muit force-pushed the feature/editor-improvements branch from 51766f9 to 64454b7 Compare October 23, 2026 08:43
@muit muit changed the title [EDITOR] Context menu rework [EDITOR] Context menu improvements and type chips Oct 23, 2026
@muit

muit commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

History reorganized (9 commits total, was 16):

Context menu:

  1. Cache context menu entries and rank search results
  2. Add keyboard selection to the graph context menu
  3. Highlight the selected context menu item
  4. Keep the selected context menu item in view

Type chips:
5. [UI] Add chips to the UI widgets
6. [EDITOR] Draw type combos as chips
7. [EDITOR] Widen variable type columns and reveal functions
8. [EDITOR] Trim verbose context menu comments

The merge of feature/mir-backend is kept. Final tree is byte-identical to the previous tip (verified against feature/editor-improvements-backup, which is kept locally).

Comment thread Libs/Editor/Include/Utils/Widgets.h Resolved
Comment thread Libs/Editor/Src/Utils/ElementsPanel.cpp Resolved
Comment thread Libs/Editor/Src/Utils/Widgets.cpp Resolved
Comment thread Libs/Editor/Src/Utils/Widgets.cpp Resolved
Comment thread Libs/Editor/Src/Utils/Widgets.cpp Resolved
Comment thread Libs/Editor/Src/Utils/Widgets.cpp Resolved
Comment thread Libs/UI/Src/Widgets.cpp Resolved
muit added 8 commits October 23, 2026 14:24
Chip takes ChipFlags: Background paints the colored chip, None draws flat
text. It is a non-interactive item, so containers grow with it. The
separate DrawChip, DrawChipText and CalcChipWidth helpers are gone.
TypeCombo takes TypeComboFlags to draw the selected type as a chip and to
group types by category. One type list is filtered per category with the
pipe ECS helpers, and entries and the selected value are chip items, so
the dropdown grows with them. GetTypeIcon takes a scope.
Double clicking a call or picking Show function in its context menu opens
the type that owns the function and selects it there once drawn, or
selects and centers it when it belongs to the open type. The elements
panel double click no longer reopens its own type.
The drag moved nodes by indexing a selection that can change mid drag,
reading past the snapshot of origins and moving nodes that were never
dragged. The snapshot now holds the node ids with their origins.
Entry labels and keywords are views into interned names instead of
copies, and the search is parsed only when its text changes. Matching
and scoring ignore case and match through separators in place, so no
lowercased copies are needed, and the cached keyword array stays inline.
Operator entries are created through a shared helper, and their label is
formatted when drawn.
@muit
muit force-pushed the feature/editor-improvements branch from 126a34c to 3264500 Compare October 23, 2026 14:03
@muit
muit merged commit 5e8edc3 into feature/mir-backend Oct 23, 2026
11 checks passed
@muit
muit deleted the feature/editor-improvements branch October 23, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant