forked from 1b-agent/opencadstudio-upstream
feat(spline): correct property semantics
Merge PR #824 while keeping periodic and coplanarity geometry in cadkernel.
This commit is contained in:
commit
dcedf945ea
11 files changed
+208
-73
No files matched your search
@@ -121,13 +121,13 @@ impl OpenCADStudio {
|
||||
acadrust::EntityType::LwPolyline(polyline) => Some(polyline.vertices.len()),
|
||||
acadrust::EntityType::Polyline2D(polyline) => Some(polyline.vertices.len()),
|
||||
acadrust::EntityType::Leader(leader) => Some(leader.vertices.len()),
|
||||
acadrust::EntityType::Spline(spline) => Some(
|
||||
if crate::entities::spline::uses_fit_method(spline) {
|
||||
acadrust::EntityType::Spline(spline) => {
|
||||
Some(if crate::entities::spline::shows_fit_points(spline) {
|
||||
spline.fit_points.len()
|
||||
} else {
|
||||
spline.control_points.len()
|
||||
},
|
||||
),
|
||||
crate::entities::spline::control_vertex_count(spline)
|
||||
})
|
||||
}
|
||||
_ => None,
|
||||
});
|
||||
vertex_count.map_or(prop_vertex, |count| prop_vertex.min(count.saturating_sub(1)))
|
||||
|
||||
@@ -1758,7 +1758,7 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
};
|
||||
match field {
|
||||
"spline_method" => {
|
||||
value == if crate::entities::spline::uses_fit_method(spline) {
|
||||
value == if crate::entities::spline::shows_fit_points(spline) {
|
||||
"Fit"
|
||||
} else {
|
||||
"Control Vertices"
|
||||
@@ -2193,7 +2193,9 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
(
|
||||
"current_control_point",
|
||||
acadrust::EntityType::Spline(spline),
|
||||
) => Some(spline.control_points.len()),
|
||||
) => Some(
|
||||
crate::entities::spline::control_vertex_count(spline),
|
||||
),
|
||||
_ => None,
|
||||
}
|
||||
})
|
||||
|
||||
+2
-6
@@ -423,12 +423,8 @@ impl OpenCADStudio {
|
||||
.and_then(|h| {
|
||||
let indexed = match tab.scene.document.get_entity(h) {
|
||||
Some(acadrust::EntityType::LwPolyline(_))
|
||||
| Some(acadrust::EntityType::Polyline2D(_)) => true,
|
||||
Some(acadrust::EntityType::Spline(spline)) => {
|
||||
!crate::entities::spline::uses_fit_method(spline)
|
||||
|| !spline.cv_frame_visible
|
||||
|| crate::entities::curve::spline_curve(spline).is_none()
|
||||
}
|
||||
| Some(acadrust::EntityType::Polyline2D(_))
|
||||
| Some(acadrust::EntityType::Spline(_)) => true,
|
||||
_ => false,
|
||||
};
|
||||
indexed.then_some(tab.properties.prop_vertex)
|
||||
|
||||
Reference in new issue
Block a user