forked from 1b-agent/opencadstudio-upstream
fix: open-issue sweep — drawing, plot, snap, layout and UI fixes
Fixes: - Font prompt no longer lists bundled ltypeshp/qcadshp shape files (#1626) - Wide polylines step at a discontinuous segment width; PEDIT marks the current vertex; keyword steps refresh the command preview (#1628) - Radius-0 fillet drops the zero-length segment it left, so the corner fillets again (#1422) - FILLET Trim / No trim option (#1558) - True-colour wires plot in their own colour; colour picker stores the value it shows (#1621) - Model tab keeps its page setup; "Save changes to layout" in Model (#1620) - QNEW default template in Options > Files; .dwt in the open dialog (#1134, #1113) - GRIDUNIT / GRIDMODE / PERSPECTIVE variables (#1618, #1524) - PTYPE (#1433) - ZOOM nX / nXP (#1465) - CHSPACE between model and paper space through a viewport (#1428) - Moving a dimension keeps its automatic text placement - Shell icon; "&&" button labels (#1554) - LINETYPE Load from a .lin file (#1588) - XLINE / RAY hide the crosshair arms (#1437) - Dynamic-input boxes keep clear of the crosshair and each other (#1546) - Snap marker colour setting, dark default on light canvases (#1497, #1229, #1128) - Dimension style precision as a 0.00 pattern dropdown (#1426) - Node graph nodes left of the origin no longer clip away (#1592) - Collapse button in the command history header (#1094) - Freeze-in-current-viewport toggle in the ribbon layer list (#1466) - Geometric Center object snap for closed polylines (#1369) New strings translated in all 21 locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abf302eba5
commit
178c7dff41
70 files changed
+1227
-145
No files matched your search
@@ -180,6 +180,21 @@ pub(crate) fn text_contrast_background(
|
||||
/// Split each absolute f64 source point into double-single (high, low) f32
|
||||
/// buffers in one pass — the relative-to-eye residual the GPU/CPU reconstruct
|
||||
/// to f64 precision at UTM-scale coordinates.
|
||||
/// Area centroid of a closed polyline, for the Geometric Center snap.
|
||||
fn geometric_center(entity: &EntityType) -> Option<glam::DVec3> {
|
||||
let closed = match entity {
|
||||
EntityType::LwPolyline(p) => p.is_closed && p.vertices.len() >= 3,
|
||||
EntityType::Polyline2D(p) => p.is_closed() && p.vertices.len() >= 3,
|
||||
_ => false,
|
||||
};
|
||||
if !closed {
|
||||
return None;
|
||||
}
|
||||
let planar = crate::entities::curve::entity_curve(entity)?;
|
||||
let center = planar.curve.enclosed_centroid()?;
|
||||
Some(glam::DVec3::from_array(planar.plane.point_at(center)))
|
||||
}
|
||||
|
||||
pub(crate) fn points_to_ds(
|
||||
src: impl IntoIterator<Item = [f64; 3]>,
|
||||
) -> (Vec<[f32; 3]>, Vec<[f32; 3]>) {
|
||||
@@ -1102,7 +1117,10 @@ pub fn tessellate(
|
||||
)),
|
||||
_ => convert(entity, document),
|
||||
});
|
||||
if let Some(te) = te {
|
||||
if let Some(mut te) = te {
|
||||
if let Some(center) = geometric_center(entity) {
|
||||
te.snap_pts.push((center, SnapHint::GeometricCenter));
|
||||
}
|
||||
match te.object {
|
||||
// ── Text / MText: pre-tessellated glyph strokes ───────────────
|
||||
//
|
||||
|
||||
@@ -54,7 +54,7 @@ pub(crate) fn osnap_type_for(snap: crate::snap::SnapType) -> u8 {
|
||||
S::Nearest | S::Extension => osnap::NEAR,
|
||||
S::ApparentIntersection => osnap::APPARENT_INT,
|
||||
S::Parallel => osnap::PARA,
|
||||
S::Grid | S::ObjectPick | S::Vertex | S::EdgeMidpoint | S::FaceCenter | S::Knot | S::FacePerpendicular | S::NearestFace => {
|
||||
S::GeometricCenter | S::Grid | S::ObjectPick | S::Vertex | S::EdgeMidpoint | S::FaceCenter | S::Knot | S::FacePerpendicular | S::NearestFace => {
|
||||
osnap::NONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6300,6 +6300,39 @@ impl Scene {
|
||||
Some(scale_handle)
|
||||
}
|
||||
|
||||
/// Scale the active viewport to `factor` paper units per model unit
|
||||
/// (ZOOM nXP). A named scale of that factor is linked as its annotation
|
||||
/// scale; otherwise the viewport keeps a custom scale.
|
||||
pub fn set_viewport_scale_factor(&mut self, factor: f64) -> bool {
|
||||
let Some(viewport) = self.explicit_viewport_handle() else {
|
||||
return false;
|
||||
};
|
||||
let unit_factor = self.annotation_scale_unit_factor();
|
||||
let named = self.document.objects.values().find_map(|object| match object {
|
||||
ObjectType::Scale(scale)
|
||||
if !scale.is_temporary
|
||||
&& (scale.factor() * unit_factor - factor).abs() <= 1.0e-9 * factor.max(1.0) =>
|
||||
{
|
||||
Some(scale.name.clone())
|
||||
}
|
||||
_ => None,
|
||||
});
|
||||
if let Some(name) = named {
|
||||
return self.set_viewport_scale_named_for(viewport, &name).is_some();
|
||||
}
|
||||
match self.document.get_entity_mut(viewport) {
|
||||
Some(EntityType::Viewport(vp)) if !vp.status.locked && factor > 1.0e-9 => {
|
||||
vp.custom_scale = factor;
|
||||
vp.view_height = vp.height / factor;
|
||||
}
|
||||
_ => return false,
|
||||
}
|
||||
self.notify_viewport_changed(viewport);
|
||||
self.resident_wire_sets.borrow_mut().clear();
|
||||
self.bump_geometry();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn viewport_annotation_scale_synced(&self) -> Option<bool> {
|
||||
let viewport = self.explicit_viewport_handle()?;
|
||||
let EntityType::Viewport(vp) = self.document.get_entity(viewport)? else {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
pub enum SnapHint {
|
||||
/// Geometric center of a circle, arc, or ellipse.
|
||||
Center,
|
||||
/// Area centroid of a closed polyline.
|
||||
GeometricCenter,
|
||||
/// Point entity location.
|
||||
Node,
|
||||
/// 0 / 90 / 180 / 270 ° point on a circle/arc (within arc span).
|
||||
|
||||
Reference in new issue
Block a user