Solve workspace popover anchor from runtime sidebar width
DISCLOSURE_TOP_PX, DISCLOSURE_LEFT_PX, and DISCLOSURE_WIDTH_PX were three hardcoded numbers that drifted the moment anyone touched the sidebar header layout: SHELL_INSET, header padding, picker row geometry, or the workspace tile size. Replace them with WorkspaceDisclosureAnchor::solve(sidebar_width) — a pure function whose algebra is the geometric inverse of render_sidebar_header, expressed over named layout constants (HEADER_PT, PICKER_BUTTON_SIZE, etc.) the renderer already applies. Picker resize now flows: snapshot → sidebar_width → solve → anchor → render_workspace_disclosure. Three regression tests lock the default (66, 98, 180), invariance of left/top under resize, and zero-width clamp. cargo test ely_app --bin ely_app: 101 passed.
This commit is contained in:
@@ -9,7 +9,7 @@ use gpui::{
|
||||
|
||||
use super::chrome::command_match::visible_command_rows;
|
||||
use super::chrome::{
|
||||
SANS_FAMILY, panel_bg, panel_shadow, render_command_overlay,
|
||||
SANS_FAMILY, WorkspaceDisclosureAnchor, panel_bg, panel_shadow, render_command_overlay,
|
||||
render_topbar as render_topbar_chrome, render_wallpaper, render_workspace_disclosure,
|
||||
render_workspace_disclosure_backdrop,
|
||||
};
|
||||
@@ -100,8 +100,9 @@ impl ElyShell {
|
||||
.when(
|
||||
self.workspace_picker_open && !sidebar_collapsed && !sidebar_hidden,
|
||||
|el| {
|
||||
let anchor = WorkspaceDisclosureAnchor::solve(sidebar_width);
|
||||
el.child(render_workspace_disclosure_backdrop(cx))
|
||||
.child(render_workspace_disclosure(&snapshot, cx))
|
||||
.child(render_workspace_disclosure(&snapshot, anchor, cx))
|
||||
},
|
||||
)
|
||||
.children(render_command_overlay(self, &snapshot, cx))
|
||||
|
||||
Reference in New Issue
Block a user