forked from 1b-agent/opencadstudio-upstream
feat(cursor): add crosshair options
Add persistent cursor sizing, pick aperture, color, pointer mode, isometric drafting planes, and SNAPANG-aligned grid behavior.\n\nRefs #413
This commit is contained in:
1 parent
188ac80b2e
commit
1738f9a79b
25 files changed
+989
-126
No files matched your search
+85
-1
@@ -149,6 +149,9 @@ impl OpenCADStudio {
|
||||
if self.active_modal == Some(ScaleManager) {
|
||||
self.scale_stage_discard();
|
||||
}
|
||||
if self.active_modal == Some(DraftingSettings) {
|
||||
self.snap_popup_open = false;
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
if self.active_modal == Some(FileInUse) {
|
||||
self.pending_save_failure = None;
|
||||
@@ -3014,6 +3017,43 @@ impl OpenCADStudio {
|
||||
self.sync_vport_display(self.active_tab);
|
||||
Task::none()
|
||||
}
|
||||
Message::ToggleIsometricDrafting => {
|
||||
self.isometric_drafting = !self.isometric_drafting;
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
Message::SetIsoPlane(plane) => {
|
||||
self.isometric_drafting = true;
|
||||
self.iso_plane = plane;
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
Message::CycleIsoPlane => {
|
||||
if self.isometric_drafting {
|
||||
self.iso_plane = self.iso_plane.next();
|
||||
} else {
|
||||
self.isometric_drafting = true;
|
||||
}
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"Isometric plane: {}.",
|
||||
self.iso_plane.label()
|
||||
).as_ref());
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
Message::ResetDraftingRotation => {
|
||||
self.snap_angle_deg = 0.0;
|
||||
let i = self.active_tab;
|
||||
if self.tabs[i].active_ucs.is_some() {
|
||||
self.tabs[i].active_ucs = None;
|
||||
self.commit_active_ucs_change(i, "UCS");
|
||||
self.tabs[i].scene.camera_generation += 1;
|
||||
}
|
||||
self.command_line
|
||||
.push_output(crate::t!("Drafting rotation reset to World at 0°.").as_ref());
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
Message::ToggleGrid => {
|
||||
self.show_grid ^= true;
|
||||
self.sync_vport_display(self.active_tab);
|
||||
@@ -3654,11 +3694,20 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
Message::ToggleSnapPopup => {
|
||||
self.snap_popup_open ^= true;
|
||||
if self.active_modal == Some(super::ModalKind::DraftingSettings) {
|
||||
self.close_active_modal();
|
||||
self.snap_popup_open = false;
|
||||
} else {
|
||||
self.active_modal = Some(super::ModalKind::DraftingSettings);
|
||||
self.snap_popup_open = true;
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::CloseSnapPopup => {
|
||||
self.snap_popup_open = false;
|
||||
if self.active_modal == Some(super::ModalKind::DraftingSettings) {
|
||||
self.close_active_modal();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::SnapSelectAll => {
|
||||
@@ -5149,6 +5198,41 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::OptionsTabChanged(tab) => {
|
||||
self.options_tab = tab;
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CursorSizeChanged(value) => {
|
||||
self.cursor_size = value.clamp(1, 100);
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::PickBoxChanged(value) => {
|
||||
self.pick_box = value.clamp(0, 50);
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CursorTypeChanged(value) => {
|
||||
self.cursor_type = value;
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CrosshairColorChanged(value) => {
|
||||
self.crosshair_color_input = value.clone();
|
||||
if value.trim().is_empty() {
|
||||
self.crosshair_color = None;
|
||||
self.persist_settings_if_changed();
|
||||
} else if let Some(rgb) = crate::app::config::parse_hex(&value) {
|
||||
self.crosshair_color = Some(rgb);
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::DefaultSaveFormatChanged(format) => {
|
||||
self.default_save_format =
|
||||
crate::io::canonical_save_format(&format).to_string();
|
||||
|
||||
Reference in new issue
Block a user