refactor(ui): remove the viewport navigation bar
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 <noreply@anthropic.com>
This commit is contained in:
parent
6483566c5d
commit
fda0f2dbb9
8 changed files with 3 additions and 114 deletions
|
|
@ -1,8 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="64" height="64" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<circle cx="12" cy="12" r="9" stroke="#e0e0e0" stroke-width="1.5"/>
|
|
||||||
<line x1="12" y1="3" x2="12" y2="8" stroke="#e0e0e0" stroke-width="1.5"/>
|
|
||||||
<line x1="12" y1="16" x2="12" y2="21" stroke="#e0e0e0" stroke-width="1.5"/>
|
|
||||||
<line x1="3" y1="12" x2="8" y2="12" stroke="#e0e0e0" stroke-width="1.5"/>
|
|
||||||
<line x1="16" y1="12" x2="21" y2="12" stroke="#e0e0e0" stroke-width="1.5"/>
|
|
||||||
<text x="9.5" y="7" font-size="4.5" fill="#4cc9f0" stroke="none">N</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 604 B |
|
|
@ -4756,11 +4756,6 @@ impl OpenCADStudio {
|
||||||
return Task::done(Message::ToggleViewCube);
|
return Task::done(Message::ToggleViewCube);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── NAVBAR — toggle navigation toolbar visibility ────────────────────
|
|
||||||
"NAVBAR" => {
|
|
||||||
return Task::done(Message::ToggleNavbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── PROPERTIES — toggle Properties panel visibility ──────────────────
|
// ── PROPERTIES — toggle Properties panel visibility ──────────────────
|
||||||
"PROPERTIES" | "PR" | "PROPS" => {
|
"PROPERTIES" | "PR" | "PROPS" => {
|
||||||
return Task::done(Message::ToggleProperties);
|
return Task::done(Message::ToggleProperties);
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,6 @@ pub(super) struct OpenCADStudio {
|
||||||
show_ucs_icon: bool,
|
show_ucs_icon: bool,
|
||||||
/// Whether the ViewCube 3D gizmo is visible in model space (NAVVCUBE).
|
/// Whether the ViewCube 3D gizmo is visible in model space (NAVVCUBE).
|
||||||
show_viewcube: bool,
|
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).
|
/// Whether the Properties panel is shown on the left (PROPERTIES).
|
||||||
show_properties: bool,
|
show_properties: bool,
|
||||||
/// Whether the document file tabs are shown at the top (FILETAB).
|
/// Whether the document file tabs are shown at the top (FILETAB).
|
||||||
|
|
@ -408,8 +406,6 @@ pub enum Message {
|
||||||
ToggleGridSnap,
|
ToggleGridSnap,
|
||||||
/// Toggle the ViewCube 3D gizmo visibility (NAVVCUBE).
|
/// Toggle the ViewCube 3D gizmo visibility (NAVVCUBE).
|
||||||
ToggleViewCube,
|
ToggleViewCube,
|
||||||
/// Toggle the navigation toolbar visibility (NAVBAR).
|
|
||||||
ToggleNavbar,
|
|
||||||
/// Toggle the Properties panel visibility (PROPERTIES).
|
/// Toggle the Properties panel visibility (PROPERTIES).
|
||||||
ToggleProperties,
|
ToggleProperties,
|
||||||
/// Toggle the document file tabs at the top (FILETAB).
|
/// Toggle the document file tabs at the top (FILETAB).
|
||||||
|
|
@ -746,7 +742,6 @@ impl OpenCADStudio {
|
||||||
dyn_input: true,
|
dyn_input: true,
|
||||||
show_ucs_icon: true,
|
show_ucs_icon: true,
|
||||||
show_viewcube: true,
|
show_viewcube: true,
|
||||||
show_navbar: true,
|
|
||||||
show_properties: true,
|
show_properties: true,
|
||||||
show_file_tabs: true,
|
show_file_tabs: true,
|
||||||
show_layout_tabs: true,
|
show_layout_tabs: true,
|
||||||
|
|
|
||||||
|
|
@ -2720,10 +2720,6 @@ impl OpenCADStudio {
|
||||||
self.show_viewcube ^= true;
|
self.show_viewcube ^= true;
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
Message::ToggleNavbar => {
|
|
||||||
self.show_navbar ^= true;
|
|
||||||
Task::none()
|
|
||||||
}
|
|
||||||
Message::ToggleProperties => {
|
Message::ToggleProperties => {
|
||||||
self.show_properties ^= true;
|
self.show_properties ^= true;
|
||||||
Task::none()
|
Task::none()
|
||||||
|
|
|
||||||
|
|
@ -529,24 +529,6 @@ impl OpenCADStudio {
|
||||||
.height(Fill)
|
.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 {
|
if self.show_viewcube && !is_paper && !tab.is_start {
|
||||||
let cube_click: Element<'_, Message> = container(
|
let cube_click: Element<'_, Message> = container(
|
||||||
mouse_area(container(
|
mouse_area(container(
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ mod cascade;
|
||||||
mod file_tabs;
|
mod file_tabs;
|
||||||
mod hidden;
|
mod hidden;
|
||||||
mod layout_tabs;
|
mod layout_tabs;
|
||||||
mod navbar;
|
|
||||||
mod orbit;
|
mod orbit;
|
||||||
mod ortho;
|
mod ortho;
|
||||||
mod pan;
|
mod pan;
|
||||||
|
|
@ -53,7 +52,6 @@ impl CadModule for ViewModule {
|
||||||
tools: vec![
|
tools: vec![
|
||||||
RibbonItem::LargeTool(ucs_icon::tool()),
|
RibbonItem::LargeTool(ucs_icon::tool()),
|
||||||
RibbonItem::LargeTool(viewcube::tool()),
|
RibbonItem::LargeTool(viewcube::tool()),
|
||||||
RibbonItem::LargeTool(navbar::tool()),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// ── Navigate ─────────────────────────────────────────────────────
|
// ── Navigate ─────────────────────────────────────────────────────
|
||||||
|
|
|
||||||
|
|
@ -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()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
//! Viewport overlay widgets:
|
//! Viewport overlay widgets.
|
||||||
//! • nav_toolbar() — vertical orbit/pan/zoom buttons on the right
|
|
||||||
|
|
||||||
use glam::{Mat4, Vec3};
|
use glam::{Mat4, Vec3};
|
||||||
use iced::mouse;
|
use iced::mouse;
|
||||||
use iced::widget::{button, canvas, column, container, text};
|
use iced::widget::canvas;
|
||||||
use iced::{Background, Border, Color, Element, Length, Point, Size, Theme};
|
use iced::{Color, Element, Length, Point, Size, Theme};
|
||||||
|
|
||||||
use crate::app::Message;
|
use crate::app::Message;
|
||||||
use crate::scene::object::GripShape;
|
use crate::scene::object::GripShape;
|
||||||
|
|
@ -29,64 +28,6 @@ pub struct GripMarker {
|
||||||
pub is_hot: bool,
|
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 ───────────────────────────────────────────────────
|
// ── Grid display params ───────────────────────────────────────────────────
|
||||||
|
|
||||||
/// Which world-space plane the grid is drawn on — switches with camera angle.
|
/// Which world-space plane the grid is drawn on — switches with camera angle.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue