From fda0f2dbb936c72bda1932f1b1abf7968b404b58 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Wed, 27 May 2026 17:49:23 +0300 Subject: [PATCH] refactor(ui): remove the viewport navigation bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sağ kenardaki dikey orbit/pan/zoom/zoom-extents araç çubuğu tümüyle kaldırıldı: viewport render'ı, overlay::nav_toolbar fonksiyonu, show_navbar state + ToggleNavbar mesajı/handler'ı, NAVBAR komutu, View şeridindeki "Navigation Bar" aracı ve navbar modülü/ikonu. Aynı gezinme işlemleri komutlar (3DORBIT, PAN, ZOOM*) ve ViewCube üzerinden erişilebilir durumda. Co-Authored-By: Claude Opus 4.7 --- assets/icons/navbar.svg | 8 ----- src/app/commands.rs | 5 --- src/app/mod.rs | 5 --- src/app/update.rs | 4 --- src/app/view.rs | 18 ----------- src/modules/view/mod.rs | 2 -- src/modules/view/navbar.rs | 10 ------ src/ui/overlay.rs | 65 ++------------------------------------ 8 files changed, 3 insertions(+), 114 deletions(-) delete mode 100644 assets/icons/navbar.svg delete mode 100644 src/modules/view/navbar.rs diff --git a/assets/icons/navbar.svg b/assets/icons/navbar.svg deleted file mode 100644 index 37806166c..000000000 --- a/assets/icons/navbar.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - N - diff --git a/src/app/commands.rs b/src/app/commands.rs index 435243134..4f69b5e57 100644 --- a/src/app/commands.rs +++ b/src/app/commands.rs @@ -4756,11 +4756,6 @@ impl OpenCADStudio { return Task::done(Message::ToggleViewCube); } - // ── NAVBAR — toggle navigation toolbar visibility ──────────────────── - "NAVBAR" => { - return Task::done(Message::ToggleNavbar); - } - // ── PROPERTIES — toggle Properties panel visibility ────────────────── "PROPERTIES" | "PR" | "PROPS" => { return Task::done(Message::ToggleProperties); diff --git a/src/app/mod.rs b/src/app/mod.rs index f3f8ea0bf..318477211 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -74,8 +74,6 @@ pub(super) struct OpenCADStudio { show_ucs_icon: bool, /// Whether the ViewCube 3D gizmo is visible in model space (NAVVCUBE). show_viewcube: bool, - /// Whether the navigation toolbar is shown in the viewport (NAVBAR). - show_navbar: bool, /// Whether the Properties panel is shown on the left (PROPERTIES). show_properties: bool, /// Whether the document file tabs are shown at the top (FILETAB). @@ -408,8 +406,6 @@ pub enum Message { ToggleGridSnap, /// Toggle the ViewCube 3D gizmo visibility (NAVVCUBE). ToggleViewCube, - /// Toggle the navigation toolbar visibility (NAVBAR). - ToggleNavbar, /// Toggle the Properties panel visibility (PROPERTIES). ToggleProperties, /// Toggle the document file tabs at the top (FILETAB). @@ -746,7 +742,6 @@ impl OpenCADStudio { dyn_input: true, show_ucs_icon: true, show_viewcube: true, - show_navbar: true, show_properties: true, show_file_tabs: true, show_layout_tabs: true, diff --git a/src/app/update.rs b/src/app/update.rs index 69b319252..38eb13efc 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -2720,10 +2720,6 @@ impl OpenCADStudio { self.show_viewcube ^= true; Task::none() } - Message::ToggleNavbar => { - self.show_navbar ^= true; - Task::none() - } Message::ToggleProperties => { self.show_properties ^= true; Task::none() diff --git a/src/app/view.rs b/src/app/view.rs index 974aff97c..e8e1de2c1 100644 --- a/src/app/view.rs +++ b/src/app/view.rs @@ -529,24 +529,6 @@ impl OpenCADStudio { .height(Fill) }; - if self.show_navbar && !tab.is_start { - // Anchor the nav toolbar to the vertical centre of the - // viewport area, flush against the right edge with a small - // gutter, so it stays aligned no matter how tall the - // window is. - let nav = container(overlay::nav_toolbar()) - .align_right(Fill) - .align_y(iced::alignment::Vertical::Center) - .height(Fill) - .padding(iced::Padding { - top: 0.0, - right: 8.0, - bottom: 0.0, - left: 0.0, - }); - viewport_stack = viewport_stack.push(nav); - } - if self.show_viewcube && !is_paper && !tab.is_start { let cube_click: Element<'_, Message> = container( mouse_area(container( diff --git a/src/modules/view/mod.rs b/src/modules/view/mod.rs index 55798a208..50b9b3d17 100644 --- a/src/modules/view/mod.rs +++ b/src/modules/view/mod.rs @@ -4,7 +4,6 @@ mod cascade; mod file_tabs; mod hidden; mod layout_tabs; -mod navbar; mod orbit; mod ortho; mod pan; @@ -53,7 +52,6 @@ impl CadModule for ViewModule { tools: vec![ RibbonItem::LargeTool(ucs_icon::tool()), RibbonItem::LargeTool(viewcube::tool()), - RibbonItem::LargeTool(navbar::tool()), ], }, // ── Navigate ───────────────────────────────────────────────────── diff --git a/src/modules/view/navbar.rs b/src/modules/view/navbar.rs deleted file mode 100644 index 55a2e0a8f..000000000 --- a/src/modules/view/navbar.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::modules::{IconKind, ModuleEvent, ToolDef}; -pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/navbar.svg")); -pub fn tool() -> ToolDef { - ToolDef { - id: "NAVBAR", - label: "Navigation\nBar", - icon: ICON, - event: ModuleEvent::Command("NAVBAR".to_string()), - } -} diff --git a/src/ui/overlay.rs b/src/ui/overlay.rs index 396973171..c80a7f32c 100644 --- a/src/ui/overlay.rs +++ b/src/ui/overlay.rs @@ -1,10 +1,9 @@ -//! Viewport overlay widgets: -//! • nav_toolbar() — vertical orbit/pan/zoom buttons on the right +//! Viewport overlay widgets. use glam::{Mat4, Vec3}; use iced::mouse; -use iced::widget::{button, canvas, column, container, text}; -use iced::{Background, Border, Color, Element, Length, Point, Size, Theme}; +use iced::widget::canvas; +use iced::{Color, Element, Length, Point, Size, Theme}; use crate::app::Message; use crate::scene::object::GripShape; @@ -29,64 +28,6 @@ pub struct GripMarker { pub is_hot: bool, } -// ── Nav toolbar ─────────────────────────────────────────────────────────── - -pub fn nav_toolbar<'a>() -> Element<'a, Message> { - let b = |icon: &'a str, cmd: &'a str| -> Element<'a, Message> { - button(text(icon).size(14).color(Color::WHITE)) - .on_press(Message::Command(cmd.into())) - .style(|_: &Theme, status| button::Style { - background: Some(Background::Color(match status { - button::Status::Hovered => Color { - r: 0.32, - g: 0.32, - b: 0.32, - a: 0.95, - }, - button::Status::Pressed => Color { - r: 0.18, - g: 0.42, - b: 0.70, - a: 1.00, - }, - _ => Color { - r: 0.20, - g: 0.20, - b: 0.20, - a: 0.85, - }, - })), - border: Border { - color: Color { - r: 0.30, - g: 0.30, - b: 0.30, - a: 1.0, - }, - width: 1.0, - radius: 2.0.into(), - }, - text_color: Color::WHITE, - shadow: iced::Shadow::default(), - snap: false, - }) - .padding([6, 8]) - .into() - }; - container( - column![ - b("⟳", "3DORBIT"), - b("✥", "PAN"), - b("⊕", "ZOOMIN"), - b("⊖", "ZOOMOUT"), - b("⊡", "ZOOMEXTENTS") - ] - .spacing(2), - ) - .padding(4) - .into() -} - // ── Grid display params ─────────────────────────────────────────────────── /// Which world-space plane the grid is drawn on — switches with camera angle.