forked from 1b-agent/opencadstudio-upstream
fix(rect): merge current main
Preserve both Point and Rectangle property layouts where the two pull requests changed the same section.
This commit is contained in:
commit
e74d5d78fc
98 files changed
+1167
-268
No files matched your search
@@ -201,6 +201,7 @@ impl CadCommand for AttdefCommand {
|
||||
pt + self.plane.y * d,
|
||||
];
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -181,6 +181,7 @@ impl CadCommand for MlineCommand {
|
||||
.collect();
|
||||
pts.push([pt.x, pt.y, pt.z]);
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Point tool — ribbon definition + interactive command.
|
||||
//
|
||||
// Command: POINT (PO)
|
||||
// Single click → commits EntityType::Point. Stays active for more points.
|
||||
// POINT commits one entity and exits. MULTIPOINT stays active.
|
||||
|
||||
use acadrust::types::Vector3;
|
||||
use acadrust::{EntityType, Point as CadPoint};
|
||||
@@ -22,25 +22,35 @@ pub fn tool() -> ToolDef {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PointCommand;
|
||||
pub struct PointCommand {
|
||||
multiple: bool,
|
||||
}
|
||||
|
||||
impl PointCommand {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
Self { multiple: false }
|
||||
}
|
||||
|
||||
pub fn multiple() -> Self {
|
||||
Self { multiple: true }
|
||||
}
|
||||
}
|
||||
|
||||
impl CadCommand for PointCommand {
|
||||
fn name(&self) -> &'static str {
|
||||
"POINT"
|
||||
if self.multiple { "MULTIPOINT" } else { "POINT" }
|
||||
}
|
||||
fn prompt(&self) -> String {
|
||||
crate::t!("POINT Specify point:").into_owned()
|
||||
}
|
||||
|
||||
fn options(&self) -> Vec<crate::command::CmdOption> {
|
||||
use crate::command::CmdOption;
|
||||
vec![CmdOption::enter(t!("Done").as_ref())]
|
||||
if self.multiple {
|
||||
use crate::command::CmdOption;
|
||||
vec![CmdOption::enter(t!("Done").as_ref())]
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
fn on_point(&mut self, pt: DVec3) -> CmdResult {
|
||||
@@ -48,7 +58,11 @@ impl CadCommand for PointCommand {
|
||||
location: Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64),
|
||||
..Default::default()
|
||||
};
|
||||
CmdResult::CommitEntity(EntityType::Point(p))
|
||||
if self.multiple {
|
||||
CmdResult::CommitEntity(EntityType::Point(p))
|
||||
} else {
|
||||
CmdResult::CommitAndExit(EntityType::Point(p))
|
||||
}
|
||||
}
|
||||
|
||||
fn on_enter(&mut self) -> CmdResult {
|
||||
@@ -64,7 +78,7 @@ impl CadCommand for PointCommand {
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POINT"] }); // PointCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POINT", "MULTIPOINT"] }); // PointCommand
|
||||
// Point display style system variables + dialog.
|
||||
inventory::submit!(crate::command::CommandRegistration {
|
||||
names: &["PDMODE", "PDSIZE", "DDPTYPE"]
|
||||
|
||||
@@ -123,6 +123,7 @@ impl CadCommand for ImageCommand {
|
||||
let [p0, p1, p2, p3] = corners;
|
||||
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -85,6 +85,7 @@ impl CadCommand for RayCommand {
|
||||
let dir = (pt - base).normalize_or_zero();
|
||||
let far = base + dir * DISPLAY_EXTENT;
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
@@ -187,6 +188,7 @@ impl CadCommand for XLineCommand {
|
||||
let far_pos = base + dir * DISPLAY_EXTENT;
|
||||
let far_neg = base - dir * DISPLAY_EXTENT;
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -362,6 +362,7 @@ impl CadCommand for AreaCommand {
|
||||
points.push(to_render(point));
|
||||
points.push(to_render(self.points[0]));
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -85,6 +85,7 @@ impl CadCommand for DistCommand {
|
||||
let p1 = self.first?;
|
||||
// The preview wire is purely visual, so f32 vertices are fine here.
|
||||
Some(WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -70,6 +70,7 @@ impl MeasureGeomCommand {
|
||||
/// Build a cyan preview wire connecting the picked points and the cursor.
|
||||
fn preview_wire(name: &str, pts: Vec<[f32; 3]>) -> WireModel {
|
||||
WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
@@ -3719,6 +3719,7 @@ fn collect_runs(pts: &[[f64; 2]], take: &dyn Fn([f64; 2]) -> bool, out: &mut Vec
|
||||
/// Build a preview wire from a NaN-break point list.
|
||||
fn preview_wire(points: Vec<[f32; 3]>, color: [f32; 4], name: &str) -> WireModel {
|
||||
WireModel {
|
||||
point_marker: None,
|
||||
taper_widths: Vec::new(),
|
||||
world_width: 0.0,
|
||||
depth_override: None,
|
||||
|
||||
Reference in new issue
Block a user