fix(host): fill-picker dismiss runs before VariablesPanel dispatch

Codex stop-gate on the previous reorder (96cf753b): putting
`dispatch_variables_panel_press` at the absolute top of the cascade
meant a Variables-row click while the PropertyPanel's fill-type
picker was open returned true and left `fill_type_picker_open=true`.
The fill picker would float over the chrome until the next
unrelated click happened to land outside its rect.

Cascade order now:
  0c0. Fill-type picker outside-click dismiss
       (must run first when open — any click anywhere closes the
        picker, then swallows or routes to a SetFillType /
        ToggleFillTypePicker action).
  0b1. VariablesPanel hit dispatch
       (BEFORE PropertyPanel so the bottom-anchored Variables rect
        wins for clicks in its z-order overlap with the rail).
  0c.  PropertyPanel input + action hit-tests.

The fill-picker block already swallows every click when open, so
reaching the Variables dispatcher requires the picker to be
closed — which means the existing dismiss path runs unconditionally
before any Variables click can fire. 295 shell-core + 20 shell-
native tests still pass.

press.rs: 832 → 836 (the dismiss comment + restored ordering adds
4 lines). Still over the 800 cap as pre-existing tech debt; my
session has added +11 lines total to this file (825 → 836), which
is small and bounded.
This commit is contained in:
Kayshen-X 2026-05-14 19:22:20 +08:00
parent 1714b6dd5b
commit 5d2a691438

View file

@ -283,14 +283,11 @@ impl WidgetHostNative {
return rename_committed || text_edit_committed;
}
// 0b1. VariablesPanel — tested before PropertyPanel so the
// bottom-anchored Variables rect wins clicks (paint
// stack: PropertyPanel under, Variables over).
if self.dispatch_variables_panel_press(x, y, viewport_width, viewport_height) {
return true;
}
// 0c0. Fill-type picker — outside-click dismiss.
// 0c0. Fill-type picker — outside-click dismiss. Must run
// BEFORE the VariablesPanel dispatch so an open picker
// gets dismissed by every click, even ones landing on
// a Variables row (codex stop-gate: the previous order
// left fill_type_picker_open=true after a vars click).
if self.document.ui.fill_type_picker_open {
if let Some(panel) = PropertyPanel::for_selection(&self.document) {
let property_rect = Rect {
@ -319,6 +316,13 @@ impl WidgetHostNative {
return true;
}
// 0b1. VariablesPanel — tested before PropertyPanel so the
// bottom-anchored Variables rect wins (paint stack:
// PropertyPanel under, Variables over).
if self.dispatch_variables_panel_press(x, y, viewport_width, viewport_height) {
return true;
}
// 0c. PropertyPanel input row — focus the row + seed the
// edit draft from the snapshot value. Any other click
// (canvas, chat, toolbar, layer panel) commits + clears