refactor(modules): rename home module to draw, restore first-tab order

The Home tab was already titled "Draw"; rename the module to match:
folder modules/home → modules/draw, HomeModule → DrawModule, id "home"
→ "draw". The inner draw/ command folder is kept (modules::draw::draw).

Update build.rs PRIORITY ("home" → "draw") so the tab returns to the
front of the ribbon; registry.rs regenerates accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 11:49:14 +03:00
1 parent c6152ef705
commit 3666c7fa69
85 files changed
+141 -141

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
// Group tool — ribbon definition + CadCommand implementation.
use crate::modules::{IconKind, ModuleEvent, ToolDef};
pub fn tool() -> ToolDef {
ToolDef {
id: "GROUP",
label: "Group",
icon: IconKind::Svg(include_bytes!("../../../../assets/icons/group.svg")),
event: ModuleEvent::Command("GROUP".to_string()),
}
}
// ── CadCommand implementation ─────────────────────────────────────────────
use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
pub struct GroupCommand {
handles: Vec<Handle>,
/// Auto-generated fallback name shown in the prompt.
auto_name: String,
}
impl GroupCommand {
pub fn new(handles: Vec<Handle>, auto_name: String) -> Self {
Self { handles, auto_name }
}
}
impl CadCommand for GroupCommand {
fn name(&self) -> &'static str {
"GROUP"
}
fn prompt(&self) -> String {
format!("GROUP Enter group name [{}]:", self.auto_name)
}
fn wants_text_input(&self) -> bool {
true
}
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
let name = if text.trim().is_empty() {
std::mem::take(&mut self.auto_name)
} else {
text.trim().to_string()
};
Some(CmdResult::CreateGroup {
handles: std::mem::take(&mut self.handles),
name,
})
}
fn on_enter(&mut self) -> CmdResult {
// Enter with no typed name uses the auto-generated name.
CmdResult::CreateGroup {
handles: std::mem::take(&mut self.handles),
name: std::mem::take(&mut self.auto_name),
}
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
CmdResult::NeedPoint
}
fn on_hover_entity(&mut self, _handle: Handle, _pt: Vec3) -> Vec<WireModel> {
vec![]
}
}
+2
View File
@@ -0,0 +1,2 @@
pub mod group;
pub mod ungroup;
+65
View File
@@ -0,0 +1,65 @@
// Ungroup tool — ribbon definition + CadCommand implementation.
use crate::modules::{IconKind, ModuleEvent, ToolDef};
pub fn tool() -> ToolDef {
ToolDef {
id: "UNGROUP",
label: "Ungroup",
icon: IconKind::Svg(include_bytes!("../../../../assets/icons/ungroup.svg")),
event: ModuleEvent::Command("UNGROUP".to_string()),
}
}
// ── CadCommand implementation ─────────────────────────────────────────────
use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
pub struct UngroupCommand;
impl UngroupCommand {
pub fn new() -> Self {
Self
}
}
impl CadCommand for UngroupCommand {
fn name(&self) -> &'static str {
"UNGROUP"
}
fn prompt(&self) -> String {
"UNGROUP Select grouped objects:".into()
}
fn is_selection_gathering(&self) -> bool {
true
}
fn on_selection_complete(&mut self, handles: Vec<Handle>) -> CmdResult {
if handles.is_empty() {
return CmdResult::NeedPoint;
}
CmdResult::DeleteGroups { handles }
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
CmdResult::NeedPoint
}
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
fn on_hover_entity(&mut self, _handle: Handle, _pt: Vec3) -> Vec<WireModel> {
vec![]
}
}
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["UG", "UNGROUP"] }); // UngroupCommand