feat(ui): unified viewport control chip + per-tile grid rendering

Move grid and grid-snap toggles off the status bar (and its customization
menu) into the top-left viewport chip, now a single container holding the
horizontal/vertical split buttons, render-mode picker, and grid/snap
toggles, sized to the render-mode picker. Add grid + magnet (snap) icons.

Render the grid per model tile from each tile's own grid_on, in its own
bounds and camera, instead of a single grid in the active tile. This stops
the grid flickering on/off as the cursor crosses panes or leaves the
viewport, and lets each pane show its own grid independently.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-18 23:29:34 +03:00
1 parent d4a665a34c
commit 9eb805df23
8 files changed
+170 -133

No files matched your search

+2
View File
@@ -33,6 +33,8 @@ pub const BOLT: &[u8] = include_bytes!("../../assets/icons/ui/bolt.svg");
pub const MOVE: &[u8] = include_bytes!("../../assets/icons/ui/move.svg");
pub const SPLIT_V: &[u8] = include_bytes!("../../assets/icons/ui/split_v.svg");
pub const SPLIT_H: &[u8] = include_bytes!("../../assets/icons/ui/split_h.svg");
pub const GRID: &[u8] = include_bytes!("../../assets/icons/ui/grid.svg");
pub const SNAP: &[u8] = include_bytes!("../../assets/icons/ui/snap.svg");
pub const UP: &[u8] = include_bytes!("../../assets/icons/ui/up.svg");
pub const DOC_NEW: &[u8] = include_bytes!("../../assets/icons/ui/doc_new.svg");
pub const DOC: &[u8] = include_bytes!("../../assets/icons/ui/doc.svg");
+6 -8
View File
@@ -107,7 +107,7 @@ pub fn selection_overlay<'a>(
selection: SelectionState,
snap: Option<(Point, SnapType)>,
grips: Vec<GripMarker>,
grid: Option<GridParams>,
grid: Vec<GridParams>,
ucs_icon: Option<UcsIconParams>,
ost_points: Vec<OstTrackPoint>,
cursor_screen: Point,
@@ -134,7 +134,7 @@ struct SelectionCanvas {
selection: SelectionState,
snap: Option<(Point, SnapType)>,
grips: Vec<GripMarker>,
grid: Option<GridParams>,
grid: Vec<GridParams>,
ucs_icon: Option<UcsIconParams>,
ost_points: Vec<OstTrackPoint>,
cursor_screen: Point,
@@ -284,13 +284,11 @@ impl canvas::Program<Message> for SelectionCanvas {
}
// ── Grid display ──────────────────────────────────────────────────
if let Some(ref g) = self.grid {
// Clip to the active tile's rectangle so grid lines don't spill
// into neighbouring panes in a tiled layout.
let plane = g.plane;
let view_proj = g.view_proj;
// One entry per pane with its grid on. Each is clipped to its own tile
// rectangle so lines never spill into neighbouring panes.
for g in &self.grid {
let gb = g.bounds;
frame.with_clip(gb, |f| draw_grid(f, view_proj, plane, gb));
frame.with_clip(gb, |f| draw_grid(f, g.view_proj, g.plane, gb));
}
if let (Some(a), Some(b)) = (self.selection.box_anchor, self.selection.box_current) {
-14
View File
@@ -32,7 +32,6 @@ impl StatusBar {
ortho_mode: bool,
polar_mode: bool,
polar_increment_deg: f32,
show_grid: bool,
dyn_input: bool,
otrack: bool,
layouts: Vec<String>,
@@ -94,7 +93,6 @@ impl StatusBar {
// ── Right side ────────────────────────────────────────────────────
let osnap_active = snapper.is_active();
let snap_grid_on = snapper.is_on(crate::snap::SnapType::Grid) && snapper.snap_enabled;
let vp_label = if viewport_count > 0 {
format!("{} VP", viewport_count)
@@ -126,18 +124,6 @@ impl StatusBar {
"Cursor coordinates (X, Y, Z)",
));
}
if vis(StatusPill::Snap) {
right_status = right_status.push(tip(
toggle_pill("SNAP", snap_grid_on, Message::ToggleGridSnap),
"Snap to Grid\nF9",
));
}
if vis(StatusPill::Grid) {
right_status = right_status.push(tip(
toggle_pill("GRID", show_grid, Message::ToggleGrid),
"Show Grid\nF7",
));
}
if vis(StatusPill::Ortho) {
right_status = right_status.push(tip(
toggle_pill("ORTHO", ortho_mode, Message::ToggleOrtho),
-8
View File
@@ -12,8 +12,6 @@ use std::path::PathBuf;
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum StatusPill {
Coords,
Snap,
Grid,
Ortho,
Lwt,
Polar,
@@ -37,8 +35,6 @@ impl StatusPill {
/// the customization menu.
pub const ALL: &'static [StatusPill] = &[
StatusPill::Coords,
StatusPill::Snap,
StatusPill::Grid,
StatusPill::Ortho,
StatusPill::Lwt,
StatusPill::Polar,
@@ -61,8 +57,6 @@ impl StatusPill {
pub fn id(self) -> &'static str {
match self {
StatusPill::Coords => "coords",
StatusPill::Snap => "snap",
StatusPill::Grid => "grid",
StatusPill::Ortho => "ortho",
StatusPill::Lwt => "lwt",
StatusPill::Polar => "polar",
@@ -86,8 +80,6 @@ impl StatusPill {
pub fn label(self) -> &'static str {
match self {
StatusPill::Coords => "Coordinates",
StatusPill::Snap => "Snap Mode",
StatusPill::Grid => "Grid",
StatusPill::Ortho => "Ortho Mode",
StatusPill::Lwt => "Show Lineweight",
StatusPill::Polar => "Polar Tracking",