Merge pull request #1131 from ramox81/codex/thicken-surface-grips

This commit is contained in:
Hakan Seven committed 2026-09-10 17:05:43 +03:00
commit 4201b0a031
18 files changed
+536 -67

No files matched your search

+42 -1
View File
@@ -2003,7 +2003,48 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
}
self.push_undo_snapshot(i, "CHPROP");
if crate::scene::model::solid_history::is_loft_geometry_choice(field) {
if crate::scene::model::solid_history::is_surface_property_choice(field) {
use crate::scene::model::solid_history::{
PROP_SURFACE_MAINTAIN_ASSOCIATIVITY, PROP_SURFACE_SHOW_ASSOCIATIVITY,
PROP_SURFACE_WIREFRAME_TYPE,
};
for &handle in &handles {
if self.tabs[i].scene.is_layer_locked(handle) {
continue;
}
let Some(mut state) = self.tabs[i]
.scene
.document
.get_entity(handle)
.and_then(|entity| match entity {
acadrust::EntityType::Surface(surface) => Some(
crate::entities::solid3d::surface_property_state(surface),
),
_ => None,
})
else {
continue;
};
match field {
PROP_SURFACE_WIREFRAME_TYPE => {
state.isolines = !value.eq_ignore_ascii_case("Isoparms")
}
PROP_SURFACE_MAINTAIN_ASSOCIATIVITY => {
state.maintain_associativity = value.eq_ignore_ascii_case("Yes")
}
PROP_SURFACE_SHOW_ASSOCIATIVITY => {
state.show_associativity = value.eq_ignore_ascii_case("Yes")
}
_ => continue,
}
crate::scene::view::dispatch::set_entity_xdata(
&mut self.tabs[i].scene.document,
handle,
crate::entities::solid3d::SURFACE_PROPERTIES_APP,
Some(crate::entities::solid3d::surface_property_xdata_values(state)),
);
}
} else if crate::scene::model::solid_history::is_loft_geometry_choice(field) {
// These choices change the generated body, not just history
// flags. Use the same transactional rebuild as numeric edits.
for &handle in &handles {
+44 -9
View File
@@ -1535,15 +1535,30 @@ impl OpenCADStudio {
}
if let Some(axis) = grip.axis {
snapped = cursor_on_projected_axis(
p,
bounds,
view_rot,
eye,
grip.origin_world,
axis,
)
.unwrap_or(snapped);
let acquired_point = otrack_hit.is_some()
|| snap_hit.is_some_and(|hit| {
hit.snap_type != crate::snap::SnapType::Grid
});
if acquired_point {
if let Some(axis) = axis.try_normalize() {
// An axis grip still moves on its construction axis, but
// an acquired object point supplies the exact coordinate
// along that axis. This lets height and draft arrows seat
// back onto existing surface/solid geometry.
snapped = grip.origin_world
+ axis * (snapped - grip.origin_world).dot(axis);
}
} else {
snapped = cursor_on_projected_axis(
p,
bounds,
view_rot,
eye,
grip.origin_world,
axis,
)
.unwrap_or(snapped);
}
}
let snap_ms = snap_started.elapsed().as_secs_f64() * 1000.0;
@@ -1751,6 +1766,26 @@ impl OpenCADStudio {
let preview_ms = preview_started.elapsed().as_secs_f64() * 1000.0;
let geometry_ms = grip_started.elapsed().as_secs_f64() * 1000.0;
self.refresh_selected_grips();
// A history rebuild can clamp a requested value or move a derived
// construction handle non-linearly. Rebase each active target onto
// the freshly rebuilt grip so the hot arrow remains attached to the
// live surface and reverses immediately from a geometric limit.
let refreshed_targets: Vec<_> = self.tabs[i]
.selected_grip_handles
.iter()
.copied()
.zip(self.tabs[i].selected_grips.iter())
.map(|(handle, grip)| ((handle, grip.id), grip.world))
.collect();
if let Some(active) = self.tabs[i].active_grip.as_mut() {
for target in &mut active.targets {
if let Some((_, world)) = refreshed_targets.iter().find(|((handle, id), _)| {
*handle == target.handle && *id == target.grip_id
}) {
target.last_world = *world;
}
}
}
let grips_ms = grip_started.elapsed().as_secs_f64() * 1000.0 - geometry_ms;
// Properties are refreshed when the grip is committed or cancelled.
// Rebuilding the inspector on every pointer event adds no drawing