forked from 1b-agent/opencadstudio-upstream
fix(vpclip): drop the new boundary when the clip is refused; translate prompts
Review of #1485: VPCLIP added the polygon it drew to the drawing before checking its area, so a boundary with no usable area was refused but left behind as a stray object. It is erased again. The VPCLIP prompts and messages go through t! like the rest of mview.rs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
22a5a8d16c
commit
bb390cad58
2 files changed
+21
-11
No files matched your search
@@ -74,13 +74,15 @@ impl OpenCADStudio {
|
||||
_ => false,
|
||||
});
|
||||
if !closed {
|
||||
self.command_line.push_error("Object is not a closed curve.");
|
||||
self.command_line
|
||||
.push_error(crate::t!("Object is not a closed curve.").as_ref());
|
||||
return;
|
||||
}
|
||||
}
|
||||
self.push_undo_snapshot(i, "VPCLIP");
|
||||
let old = vp.clip_boundary_handle;
|
||||
let scene = &mut self.tabs[i].scene;
|
||||
let created = boundary.is_some();
|
||||
let clip = match boundary {
|
||||
Some(entity) => scene.add_entity(entity),
|
||||
None => boundary_handle,
|
||||
@@ -93,6 +95,10 @@ impl OpenCADStudio {
|
||||
.map(|(lo, hi)| (glam::DVec2::from(lo), glam::DVec2::from(hi)))
|
||||
.unwrap_or((glam::DVec2::ZERO, glam::DVec2::ZERO));
|
||||
if hi.x - lo.x < 1e-6 || hi.y - lo.y < 1e-6 {
|
||||
// The polygon drawn for this clip must not stay behind.
|
||||
if created {
|
||||
scene.erase_entities(&[clip]);
|
||||
}
|
||||
self.command_line
|
||||
.push_error(crate::t!("MVIEW: the clipping boundary has no usable area.").as_ref());
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user