feat(f64): command layer compiles on DVec3

Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.

- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
  in full f64; others via point methods), modify, annotate, insert, view,
  inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
  wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
  non-critical, casting at the DVec3 boundary; key draw commands store f64.

Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-24 03:51:50 +03:00
1 parent 3da71698b1
commit 4f7a98a2ad
84 files changed
+358 -336

No files matched your search

+3 -3
View File
@@ -3,7 +3,7 @@
use acadrust::entities::{Dimension, DimensionAligned};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -49,7 +49,7 @@ impl CadCommand for AlignedDimensionCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match self.step {
Step::First => {
self.step = Step::Second(pt);
@@ -83,7 +83,7 @@ impl CadCommand for AlignedDimensionCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
let (p1, p2) = match self.step {
Step::First => return None,
Step::Second(p1) => (p1, pt),
+3 -3
View File
@@ -5,7 +5,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
use glam::{DVec3, Vec3};
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_angular.svg"));
@@ -56,7 +56,7 @@ impl CadCommand for AngularDimensionCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match self.step {
Step::Vertex => {
self.step = Step::FirstRay(pt);
@@ -98,7 +98,7 @@ impl CadCommand for AngularDimensionCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
match self.step {
Step::Vertex => None,
Step::FirstRay(vertex) => Some(preview_wire(vec![vertex, pt])),
+3 -3
View File
@@ -8,7 +8,7 @@
// entity it annotates.
use acadrust::Handle;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -45,7 +45,7 @@ impl CadCommand for DdeditCommand {
true
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -54,7 +54,7 @@ impl CadCommand for DdeditCommand {
CmdResult::EditTextEntity { handle }
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
CmdResult::NeedPoint
}
fn on_enter(&mut self) -> CmdResult {
+3 -3
View File
@@ -3,7 +3,7 @@
use acadrust::entities::{Dimension, DimensionDiameter};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -51,7 +51,7 @@ impl CadCommand for DiameterDimensionCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match self.step {
Step::CenterPoint => {
self.step = Step::ArcPoint(pt);
@@ -77,7 +77,7 @@ impl CadCommand for DiameterDimensionCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
match self.step {
Step::CenterPoint => None,
Step::ArcPoint(center) => Some(preview_line(center, pt)),
+3 -3
View File
@@ -9,7 +9,7 @@
use acadrust::entities::{Dimension, DimensionLinear};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -107,7 +107,7 @@ impl CadCommand for DimBaselineCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if !self.ready {
return CmdResult::Cancel;
}
@@ -136,7 +136,7 @@ impl CadCommand for DimBaselineCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if !self.ready {
return None;
}
+3 -3
View File
@@ -9,7 +9,7 @@
use acadrust::entities::{Dimension, DimensionLinear};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -87,7 +87,7 @@ impl CadCommand for DimContinueCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if !self.ready {
return CmdResult::Cancel;
}
@@ -116,7 +116,7 @@ impl CadCommand for DimContinueCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if !self.ready {
return None;
}
+3 -3
View File
@@ -10,7 +10,7 @@
// and emits a ReplaceEntity sentinel that commands.rs intercepts to apply the break.
use acadrust::Handle;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -61,7 +61,7 @@ impl CadCommand for DimBreakCommand {
true
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -81,7 +81,7 @@ impl CadCommand for DimBreakCommand {
}
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
CmdResult::NeedPoint
}
+3 -3
View File
@@ -5,7 +5,7 @@
// 2. Enter new text (blank = reset to auto-measured value, "<>" = measured value placeholder)
use acadrust::Handle;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -56,7 +56,7 @@ impl CadCommand for DimEditCommand {
matches!(self.step, Step::PickDim)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -78,7 +78,7 @@ impl CadCommand for DimEditCommand {
Some(CmdResult::DdeditEntity { handle, new_text })
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
CmdResult::NeedPoint
}
fn on_enter(&mut self) -> CmdResult {
+4 -4
View File
@@ -5,7 +5,7 @@
// 2. Click the position on the dimension line where the jog should appear
use acadrust::Handle;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -55,7 +55,7 @@ impl CadCommand for DimJogLineCommand {
matches!(self.step, Step::PickDim)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -63,7 +63,7 @@ impl CadCommand for DimJogLineCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let Step::PickJogPos { handle } = &self.step {
let h = *handle;
// Emit sentinel for commands.rs to store the jog position
@@ -79,7 +79,7 @@ impl CadCommand for DimJogLineCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if !matches!(self.step, Step::PickJogPos { .. }) {
return None;
}
+3 -3
View File
@@ -6,7 +6,7 @@
// 3. Enter spacing value (or 0 for automatic equal spacing)
use acadrust::Handle;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -60,7 +60,7 @@ impl CadCommand for DimSpaceCommand {
matches!(self.step, Step::PickBase | Step::PickOthers { .. })
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -109,7 +109,7 @@ impl CadCommand for DimSpaceCommand {
None
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
CmdResult::NeedPoint
}
+4 -4
View File
@@ -5,7 +5,7 @@
// 2. Click the new text position (entity data is injected by update.rs after pick)
use acadrust::{EntityType, Handle};
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -58,7 +58,7 @@ impl CadCommand for DimTeditCommand {
matches!(self.step, Step::PickDim)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -69,7 +69,7 @@ impl CadCommand for DimTeditCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let Step::PickTextPos { handle, entity } = &mut self.step {
let h = *handle;
if let Some(mut ent) = entity.take() {
@@ -92,7 +92,7 @@ impl CadCommand for DimTeditCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if !matches!(self.step, Step::PickTextPos { .. }) {
return None;
}
+3 -3
View File
@@ -13,7 +13,7 @@ use acadrust::entities::mtext::AttachmentPoint;
use acadrust::entities::{Leader, LeaderCreationType, MText};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::{Mat4, Vec3};
use glam::{DVec3, Mat4, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -61,7 +61,7 @@ impl CadCommand for LeaderCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
self.verts.push(pt);
CmdResult::NeedPoint
}
@@ -85,7 +85,7 @@ impl CadCommand for LeaderCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if self.verts.is_empty() {
return None;
}
+3 -3
View File
@@ -5,7 +5,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
use glam::{Mat4, Vec3};
use glam::{DVec3, Mat4, Vec3};
/// World-space measurement axis for a linear dimension between `first` and
/// `second`, chosen as the UCS X or Y axis (whichever the span is closer to).
@@ -69,7 +69,7 @@ impl CadCommand for LinearDimensionCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match self.step {
Step::FirstPoint => {
self.step = Step::SecondPoint(pt);
@@ -113,7 +113,7 @@ impl CadCommand for LinearDimensionCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
match self.step {
Step::FirstPoint => None,
Step::SecondPoint(first) => Some(preview_wire(vec![first, pt])),
+3 -3
View File
@@ -8,7 +8,7 @@
use acadrust::entities::MultiLeader;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::{Mat4, Vec3};
use glam::{DVec3, Mat4, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -56,7 +56,7 @@ impl CadCommand for MLeaderCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
self.verts.push(pt);
CmdResult::NeedPoint
}
@@ -75,7 +75,7 @@ impl CadCommand for MLeaderCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if self.verts.is_empty() {
return None;
}
+11 -11
View File
@@ -8,7 +8,7 @@
use acadrust::entities::{LeaderLine, MultiLeader};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -73,7 +73,7 @@ impl CadCommand for MLeaderAddCommand {
matches!(self.step, AddStep::PickMLeader)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -84,7 +84,7 @@ impl CadCommand for MLeaderAddCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match &mut self.step {
AddStep::PickArrowhead { handle, entity } => {
if let Some(ent) = entity.take() {
@@ -132,7 +132,7 @@ impl CadCommand for MLeaderAddCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
let existing_pts = match &self.step {
AddStep::CollectPoints { pts, .. } => pts.clone(),
_ => return None,
@@ -201,7 +201,7 @@ impl CadCommand for MLeaderRemoveCommand {
matches!(self.step, RemoveStep::PickMLeader)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -212,7 +212,7 @@ impl CadCommand for MLeaderRemoveCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let RemoveStep::PickLeaderToRemove { handle, entity } = &mut self.step {
if let Some(mut ent) = entity.take() {
let h = *handle;
@@ -247,7 +247,7 @@ impl CadCommand for MLeaderRemoveCommand {
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, _pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, _pt: DVec3) -> Option<WireModel> {
None
}
@@ -321,7 +321,7 @@ impl CadCommand for MLeaderAlignCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match &mut self.step {
AlignStep::PickDirection { handles } => {
let h = handles.clone();
@@ -359,7 +359,7 @@ impl CadCommand for MLeaderAlignCommand {
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, _pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, _pt: DVec3) -> Option<WireModel> {
None
}
}
@@ -423,7 +423,7 @@ impl CadCommand for MLeaderCollectCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let CollectStep::PickLocation { handles } = &self.step {
let h = handles.clone();
// Build a new combined multileader at the collection point, delete originals.
@@ -447,7 +447,7 @@ impl CadCommand for MLeaderCollectCommand {
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, _pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, _pt: DVec3) -> Option<WireModel> {
None
}
}
+3 -3
View File
@@ -1,7 +1,7 @@
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
use glam::DVec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mtext.svg"));
@@ -41,7 +41,7 @@ impl CadCommand for MTextCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult {
// Hand off to the in-place editor (toolbar + text area + live preview).
CmdResult::OpenMTextEditor {
pos: pt,
@@ -58,7 +58,7 @@ impl CadCommand for MTextCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, _pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, _pt: DVec3) -> Option<WireModel> {
None
}
}
+3 -3
View File
@@ -11,7 +11,7 @@
use acadrust::entities::{Dimension, DimensionOrdinate};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -55,7 +55,7 @@ impl CadCommand for OrdinateDimCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match self.step {
Step::FeaturePoint => {
self.step = Step::LeaderEndpoint { feature: pt };
@@ -78,7 +78,7 @@ impl CadCommand for OrdinateDimCommand {
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
fn on_preview_wires(&mut self, _pt: Vec3) -> Vec<WireModel> {
fn on_preview_wires(&mut self, _pt: DVec3) -> Vec<WireModel> {
vec![]
}
}
+3 -3
View File
@@ -9,7 +9,7 @@
use acadrust::entities::{Dimension, DimensionLinear};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -67,7 +67,7 @@ impl CadCommand for QdimCommand {
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let Step::PlaceLine { handles } = &self.step {
CmdResult::Relaunch(
format!("QDIM_PLACE {:.6} {:.6} {:.6}", pt.x, pt.y, pt.z),
@@ -82,7 +82,7 @@ impl CadCommand for QdimCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if !matches!(self.step, Step::PlaceLine { .. }) {
return None;
}
+3 -3
View File
@@ -5,7 +5,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
use glam::{DVec3, Vec3};
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_radius.svg"));
@@ -49,7 +49,7 @@ impl CadCommand for RadiusDimensionCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
match self.step {
Step::CenterPoint => {
self.step = Step::RadiusPoint(pt);
@@ -79,7 +79,7 @@ impl CadCommand for RadiusDimensionCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
match self.step {
Step::CenterPoint => None,
Step::RadiusPoint(center) => Some(preview_wire(vec![center, pt])),
+3 -3
View File
@@ -10,7 +10,7 @@
use acadrust::entities::TableBuilder;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -116,7 +116,7 @@ impl CadCommand for TableCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let Step::Insertion { cols, rows } = self.step {
let ins = Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64);
let table = TableBuilder::new(rows, cols)
@@ -130,7 +130,7 @@ impl CadCommand for TableCommand {
}
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if let Step::Insertion { cols, rows } = self.step {
// Preview: outline of the table bounding box.
let w = (cols as f32) * COL_WIDTH as f32;
+3 -3
View File
@@ -1,7 +1,7 @@
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
use glam::DVec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/text.svg"));
@@ -41,7 +41,7 @@ impl CadCommand for TextCommand {
}
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult {
// Hand off to the in-place plain-text editor anchored at the click.
CmdResult::OpenTextEditor {
pos: pt,
@@ -58,7 +58,7 @@ impl CadCommand for TextCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, _pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, _pt: DVec3) -> Option<WireModel> {
None
}
}
+4 -4
View File
@@ -8,7 +8,7 @@
// 4. In Single mode, editing an object exits the command immediately.
use acadrust::Handle;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
@@ -95,7 +95,7 @@ impl CadCommand for TexteditCommand {
self.step == Step::PickObject
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
@@ -160,7 +160,7 @@ impl CadCommand for TexteditCommand {
}
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
CmdResult::NeedPoint
}
@@ -248,7 +248,7 @@ impl CadCommand for TexteditmodeCommand {
}
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult {
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
CmdResult::NeedPoint
}
+3 -3
View File
@@ -7,7 +7,7 @@
use acadrust::entities::Tolerance;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::Vec3;
use glam::DVec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -64,7 +64,7 @@ impl CadCommand for ToleranceCommand {
Some(CmdResult::NeedPoint)
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult { let pt = pt.as_vec3();
if let Step::Insertion { text } = &self.step {
let ins = Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64);
let tol = Tolerance::with_text(ins, text.clone());
@@ -78,7 +78,7 @@ impl CadCommand for ToleranceCommand {
CmdResult::Cancel
}
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
fn on_mouse_move(&mut self, pt: DVec3) -> Option<WireModel> { let pt = pt.as_vec3();
if !matches!(self.step, Step::Insertion { .. }) {
return None;
}