node-based graph editor
git clone https://git.lucas.co/cce-graph.git
fix(controls): menubar dropdowns and vault band at the toolkit's heights
The classic menubar's File/Edit/View dropdowns sat at a hand-set y=8
that only centred a 26px control, with a 26px fallback; the vault band's
chips were a literal 24 and its filter box 28. They now ask cce-ui
(dropdown_height, button_height, textbox_height), each centred in its bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/main.rs | 17 ++++++++++-------
src/vault.rs | 15 +++++++++------
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 82b9bdc..0c5260e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -895,9 +895,11 @@ impl Application for GraphApp {
app.menu_bar.set_rect(0.0, 0.0, 1024.0, 42.0);
- app.dropdown_file.set_rect(10.0, 8.0, 70.0, 26.0);
- app.dropdown_edit.set_rect(90.0, 8.0, 70.0, 26.0);
- app.dropdown_view.set_rect(170.0, 8.0, 70.0, 26.0);
+ let dd_h = cce_ui::layout::dropdown_height();
+ let dd_y = (42.0 - dd_h) / 2.0;
+ app.dropdown_file.set_rect(10.0, dd_y, 70.0, dd_h);
+ app.dropdown_edit.set_rect(90.0, dd_y, 70.0, dd_h);
+ app.dropdown_view.set_rect(170.0, dd_y, 70.0, dd_h);
app.graph.set_rect(0.0, 42.0, 1024.0, 768.0 - 42.0);
let args: Vec<String> = std::env::args().collect();
@@ -1191,8 +1193,9 @@ impl Application for GraphApp {
self.menu_bar.set_rect(0.0, 0.0, size.width, 42.0);
// The File/Edit/View dropdown row, laid out directly (the transparent layout
- // Plate is DISSOLVED): a row at x=10/y=8 with 10px gaps, each dropdown sized
- // to its label via measure (the same intrinsic sizes the scene solver used).
+ // Plate is DISSOLVED): a row from x=10 with 10px gaps, centred in the 42px
+ // bar, each dropdown sized to its label via measure (the same intrinsic
+ // sizes the scene solver used).
{
let mut x = 10.0;
let self_ptr = self as *mut Self;
@@ -1203,8 +1206,8 @@ impl Application for GraphApp {
// Same sizing rule the retired scene bridge used: the dropdown's intrinsic
// size (widest option x configured dropdown height).
let sz = dd.intrinsic_size()
- .unwrap_or(cce_ui::scene::layout::Size::new(70.0, 26.0));
- dd.set_rect(x, 8.0, sz.width, sz.height);
+ .unwrap_or(cce_ui::scene::layout::Size::new(70.0, cce_ui::layout::dropdown_height()));
+ dd.set_rect(x, (42.0 - sz.height) / 2.0, sz.width, sz.height);
x += sz.width + 10.0;
}
}
diff --git a/src/vault.rs b/src/vault.rs
index d8ea816..eadc220 100644
--- a/src/vault.rs
+++ b/src/vault.rs
@@ -31,7 +31,6 @@ use crate::linkgraph::{Filter, LinkGraph};
const BAND_H: f32 = 40.0;
const STATUS_H: f32 = 26.0;
-const CHIP_H: f32 = 24.0;
const FILTER_W: f32 = 240.0;
const LABEL_SIZE: f32 = 11.0;
const MIN_ZOOM: f32 = 0.05;
@@ -209,12 +208,16 @@ impl VaultApp {
fn metrics(&self) -> Metrics {
let (w, h) = (self.width as f32, self.height as f32);
let inset = cce_ui::layout::root_plate_inset();
- let y = (BAND_H - CHIP_H) / 2.0;
+ // The chips and filter box at the toolkit's control heights, each
+ // centred in the band.
+ let chip_h = cce_ui::layout::button_height();
+ let filter_h = cce_ui::layout::textbox_height();
+ let y = (BAND_H - chip_h) / 2.0;
let filter_w = FILTER_W.min(w * 0.35);
- let filter = Rect { x: w - inset - filter_w, y: y - 2.0, width: filter_w, height: CHIP_H + 4.0 };
- let depth_chip = Rect { x: filter.x - 12.0 - 76.0, y, width: 76.0, height: CHIP_H };
- let local_chip = Rect { x: depth_chip.x - 8.0 - 64.0, y, width: 64.0, height: CHIP_H };
- let global_chip = Rect { x: local_chip.x - 64.0, y, width: 64.0, height: CHIP_H };
+ let filter = Rect { x: w - inset - filter_w, y: (BAND_H - filter_h) / 2.0, width: filter_w, height: filter_h };
+ let depth_chip = Rect { x: filter.x - 12.0 - 76.0, y, width: 76.0, height: chip_h };
+ let local_chip = Rect { x: depth_chip.x - 8.0 - 64.0, y, width: 64.0, height: chip_h };
+ let global_chip = Rect { x: local_chip.x - 64.0, y, width: 64.0, height: chip_h };
Metrics {
area: Rect { x: 0.0, y: BAND_H, width: w, height: (h - BAND_H - STATUS_H).max(0.0) },
global_chip,