forked from 1b-agent/opencadstudio-upstream
feat: redesign Annotate ribbon tab with proper groups and SVG icons
Added 15 SVG icons for all annotation tools (dimensions, leaders, table, wipeout, revision cloud, tolerance, ddedit). Annotate ribbon now has 6 groups matching standard CAD layout: - Text: MText (large dropdown) + Text + Edit Text - Dimensions: Linear (large dropdown with 6 types) + Continue + Baseline + Tolerance - Leaders: Multileader (large dropdown) + Leader - Tables: Table (large) - Markup: Wipeout + Rev Cloud - Annotation Scaling: Scale List, Add Scale, Scale Edit, Sync Scales Added pub tool() + ICON to all annotate tools that were missing them (aligned_dim, diameter_dim, dim_continue, dim_baseline, table_cmd, tolerance_cmd, ddedit), and to home/draw/wipeout and revcloud. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
fe4f9ca844
commit
510bcf11e5
31 files changed
+362
-16
No files matched your search
@@ -6,8 +6,20 @@ use acadrust::EntityType;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_aligned.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "DIMALIGNED",
|
||||
label: "Aligned",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("DIMALIGNED".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
enum Step {
|
||||
First,
|
||||
Second(Vec3),
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
use glam::Vec3;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Glyph("∠");
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_angular.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
|
||||
@@ -8,6 +8,18 @@ use acadrust::{EntityType, Handle};
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/ddedit.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "DDEDIT",
|
||||
label: "Edit Text",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("DDEDIT".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
enum DdeditStep {
|
||||
PickEntity,
|
||||
|
||||
@@ -6,8 +6,20 @@ use acadrust::EntityType;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_diameter.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "DIMDIAMETER",
|
||||
label: "Diameter",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("DIMDIAMETER".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
enum Step {
|
||||
CenterPoint,
|
||||
ArcPoint(Vec3),
|
||||
|
||||
@@ -12,8 +12,20 @@ use acadrust::EntityType;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_baseline.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "DIMBASELINE",
|
||||
label: "Baseline",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("DIMBASELINE".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Default stacking increment (world units) between successive baseline dimensions.
|
||||
const DIMDLI: f32 = 1.5;
|
||||
|
||||
|
||||
@@ -12,8 +12,20 @@ use acadrust::EntityType;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_continue.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "DIMCONTINUE",
|
||||
label: "Continue",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("DIMCONTINUE".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DimContinueCommand {
|
||||
/// Fixed first-extension-line origin for the current step (moves each iteration).
|
||||
chain_p1: Vec3,
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Glyph("↗");
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/leader.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
use glam::Vec3;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Glyph("⟷");
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_linear.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Glyph("↙");
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mleader.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
|
||||
+66
-10
@@ -1,4 +1,4 @@
|
||||
// Annotate module — dimension and text annotation tools.
|
||||
// Annotate module — dimension, text, leader, table, and markup tools.
|
||||
|
||||
pub mod aligned_dim;
|
||||
pub mod angular_dim;
|
||||
@@ -29,54 +29,110 @@ impl CadModule for AnnotateModule {
|
||||
}
|
||||
|
||||
fn ribbon_groups(&self) -> Vec<RibbonGroup> {
|
||||
use crate::modules::home::draw::{wipeout, revcloud};
|
||||
|
||||
vec![
|
||||
// ── Text ─────────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Text",
|
||||
tools: vec![
|
||||
RibbonItem::LargeDropdown {
|
||||
id: "ANNOTATE_TEXT",
|
||||
label: "Text",
|
||||
icon: text::ICON,
|
||||
icon: mtext::ICON,
|
||||
items: vec![
|
||||
(text::tool().id, text::tool().label, text::tool().icon),
|
||||
(mtext::tool().id, mtext::tool().label, mtext::tool().icon),
|
||||
(text::tool().id, text::tool().label, text::tool().icon),
|
||||
(ddedit::tool().id, ddedit::tool().label, ddedit::tool().icon),
|
||||
],
|
||||
default: "TEXT",
|
||||
default: "MTEXT",
|
||||
},
|
||||
],
|
||||
},
|
||||
// ── Dimensions ───────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Dimensions",
|
||||
tools: vec![
|
||||
RibbonItem::LargeDropdown {
|
||||
id: "ANNOTATE_DIM",
|
||||
label: "Dimensions",
|
||||
label: "Dimension",
|
||||
icon: linear_dim::ICON,
|
||||
items: vec![
|
||||
(linear_dim::tool().id, linear_dim::tool().label, linear_dim::tool().icon),
|
||||
(radius_dim::tool().id, radius_dim::tool().label, radius_dim::tool().icon),
|
||||
(linear_dim::tool().id, linear_dim::tool().label, linear_dim::tool().icon),
|
||||
(aligned_dim::tool().id, aligned_dim::tool().label, aligned_dim::tool().icon),
|
||||
(angular_dim::tool().id, angular_dim::tool().label, angular_dim::tool().icon),
|
||||
(radius_dim::tool().id, radius_dim::tool().label, radius_dim::tool().icon),
|
||||
(diameter_dim::tool().id, diameter_dim::tool().label, diameter_dim::tool().icon),
|
||||
(ordinate_dim::tool().id, ordinate_dim::tool().label, ordinate_dim::tool().icon),
|
||||
],
|
||||
default: "DIMLINEAR",
|
||||
},
|
||||
RibbonItem::Tool(dim_continue::tool()),
|
||||
RibbonItem::Tool(dim_baseline::tool()),
|
||||
RibbonItem::Tool(tolerance_cmd::tool()),
|
||||
],
|
||||
},
|
||||
// ── Leaders ──────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Leaders",
|
||||
tools: vec![
|
||||
RibbonItem::LargeDropdown {
|
||||
id: "ANNOTATE_LEADER",
|
||||
label: "Leader",
|
||||
icon: leader_cmd::ICON,
|
||||
label: "Multileader",
|
||||
icon: mleader_cmd::ICON,
|
||||
items: vec![
|
||||
(mleader_cmd::tool().id, mleader_cmd::tool().label, mleader_cmd::tool().icon),
|
||||
(leader_cmd::tool().id, leader_cmd::tool().label, leader_cmd::tool().icon),
|
||||
(leader_cmd::tool().id, leader_cmd::tool().label, leader_cmd::tool().icon),
|
||||
],
|
||||
default: "MLEADER",
|
||||
},
|
||||
],
|
||||
},
|
||||
// ── Tables ───────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Tables",
|
||||
tools: vec![
|
||||
RibbonItem::LargeTool(table_cmd::tool()),
|
||||
],
|
||||
},
|
||||
// ── Markup ───────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Markup",
|
||||
tools: vec![
|
||||
RibbonItem::Tool(wipeout::tool()),
|
||||
RibbonItem::Tool(revcloud::tool()),
|
||||
],
|
||||
},
|
||||
// ── Annotation Scaling ───────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Annotation Scaling",
|
||||
tools: vec![
|
||||
RibbonItem::Tool(crate::modules::ToolDef {
|
||||
id: "ANNOSCALE",
|
||||
label: "Scale List",
|
||||
icon: crate::modules::IconKind::Glyph("⬡"),
|
||||
event: crate::modules::ModuleEvent::Command("ANNOSCALE".to_string()),
|
||||
}),
|
||||
RibbonItem::Tool(crate::modules::ToolDef {
|
||||
id: "OBJECTSCALE",
|
||||
label: "Add Scale",
|
||||
icon: crate::modules::IconKind::Glyph("⊕"),
|
||||
event: crate::modules::ModuleEvent::Command("OBJECTSCALE".to_string()),
|
||||
}),
|
||||
RibbonItem::Tool(crate::modules::ToolDef {
|
||||
id: "SCALELISTEDIT",
|
||||
label: "Scale Edit",
|
||||
icon: crate::modules::IconKind::Glyph("≡"),
|
||||
event: crate::modules::ModuleEvent::Command("SCALELISTEDIT".to_string()),
|
||||
}),
|
||||
RibbonItem::Tool(crate::modules::ToolDef {
|
||||
id: "SYNCPVIEWPORTS",
|
||||
label: "Sync Scales",
|
||||
icon: crate::modules::IconKind::Glyph("⇄"),
|
||||
event: crate::modules::ModuleEvent::Command("SYNCPVIEWPORTS".to_string()),
|
||||
}),
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "DIMORDINATE",
|
||||
label: "Ordinate",
|
||||
icon: IconKind::Glyph("Φ"),
|
||||
icon: IconKind::Svg(include_bytes!("../../../assets/icons/dim_ordinate.svg")),
|
||||
event: ModuleEvent::Command("DIMORDINATE".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
use glam::Vec3;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Glyph("⌀");
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_radius.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
|
||||
@@ -13,8 +13,20 @@ use acadrust::EntityType;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/table.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "TABLE",
|
||||
label: "Table",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("TABLE".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT_COLS: usize = 3;
|
||||
const DEFAULT_ROWS: usize = 4;
|
||||
const COL_WIDTH: f64 = 2.0;
|
||||
|
||||
@@ -10,8 +10,20 @@ use acadrust::EntityType;
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
|
||||
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/tolerance.svg"));
|
||||
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "TOLERANCE",
|
||||
label: "Tolerance",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("TOLERANCE".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
enum Step {
|
||||
Text,
|
||||
Insertion { text: String },
|
||||
|
||||
Reference in new issue
Block a user