forked from 1b-agent/opencadstudio-upstream
Add a Drafting page for the rotation angle and the polar increment
Two drafting preferences had no proper home. The Drafting Settings dialog displays the drafting rotation and offers only a Reset button — there was no way to type an angle short of `SETVAR SNAPANG`. The polar tracking increment existed in exactly one place: a pop-up hanging off the status-bar pill. The rotation is a text field over an edit buffer rather than the value itself, so clearing it to retype does not snap the crosshair to zero on the way through; the buffer is reseeded whenever the value is restored from behind it. Angles render without a trailing `.0`, matching how the polar pop-up has always shown them — same kind of number, same reader. Snap modes, grid spacing and object snap stay in Drafting Settings, where they belong; the page links to it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c3f3625da
commit
b5f4b4d1cc
6 files changed
+123
No files matched your search
@@ -452,6 +452,9 @@ impl OpenCADStudio {
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
// The Options field edits a buffer rather than the value, so it has to
|
||||
// be reseeded whenever the value is restored from behind it.
|
||||
self.snap_angle_input = crate::app::settings::format_snap_angle(self.snap_angle_deg);
|
||||
// Ortho + running OSNAP are per-drawing (adopted from the header on
|
||||
// open / tab switch), not app-global, so they are not applied here.
|
||||
self.snapper.otrack_enabled = s.otrack;
|
||||
|
||||
@@ -6266,6 +6266,27 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
// Typed into freely; only committed when it parses, so clearing
|
||||
// the field to retype does not snap the crosshair back to zero.
|
||||
Message::SnapAngleInputChanged(value) => {
|
||||
self.snap_angle_input = value;
|
||||
if let Ok(angle) = self.snap_angle_input.trim().parse::<f32>() {
|
||||
if angle.is_finite() {
|
||||
self.snap_angle_deg = angle.rem_euclid(360.0);
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::PolarIncrementChanged(deg) => {
|
||||
if deg.is_finite() && deg > 0.0 {
|
||||
self.polar_increment_deg = deg;
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::PickDragRectToggled(rectangle) => {
|
||||
self.pick_drag_rect = rectangle;
|
||||
self.persist_settings_if_changed();
|
||||
|
||||
Reference in new issue
Block a user