forked from 1b-agent/opencadstudio-upstream
Merge pull request #1299: Add Windows SpaceMouse navigation
This commit is contained in:
commit
af847ad92e
32 files changed
+3508
-12
No files matched your search
@@ -382,6 +382,7 @@ impl OpenCADStudio {
|
||||
/// Snapshot the persisted UI preferences from live state.
|
||||
pub(in crate::app) fn current_settings(&self) -> crate::app::settings::UserSettings {
|
||||
crate::app::settings::UserSettings {
|
||||
spacemouse: self.spacemouse_preferences,
|
||||
dyn_input: self.dyn_input,
|
||||
polar: self.polar_mode,
|
||||
polar_increment_deg: self.polar_increment_deg,
|
||||
@@ -457,6 +458,7 @@ impl OpenCADStudio {
|
||||
self.cursor_size = s.cursor_size.clamp(1, 100);
|
||||
self.pick_box = s.pick_box.clamp(0, 50);
|
||||
self.options_tab = s.options_tab;
|
||||
self.spacemouse_preferences = s.spacemouse;
|
||||
// These four drive real features with commands and status-bar pills,
|
||||
// but they lived only on the app struct: turning the ViewCube off and
|
||||
// restarting brought it straight back.
|
||||
|
||||
@@ -357,6 +357,7 @@ impl OpenCADStudio {
|
||||
self.block_palette.placing = None;
|
||||
}
|
||||
self.control_settle();
|
||||
self.sync_spacemouse();
|
||||
task
|
||||
}
|
||||
|
||||
@@ -372,6 +373,48 @@ impl OpenCADStudio {
|
||||
|
||||
fn update_inner(&mut self, msg: Message) -> Task<Message> {
|
||||
match msg {
|
||||
Message::SpaceMouseWake => self.on_spacemouse_wake(),
|
||||
Message::SpaceMouseFrame(time) => {
|
||||
self.spacemouse.frame(
|
||||
time.saturating_duration_since(self.start).as_secs_f64() * 1000.,
|
||||
);
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMouseFocus(id, focused) => {
|
||||
if Some(id) == self.main_window {
|
||||
self.spacemouse_focused = focused;
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMouseEnabled(enabled) => {
|
||||
self.spacemouse_preferences.enabled = enabled;
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMouseMode(mode) => {
|
||||
self.spacemouse_preferences.mode = mode;
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMousePanSpeed(speed) => {
|
||||
self.spacemouse_preferences.pan_speed = speed.clamp(10, 300);
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMousePanReversed(reversed) => {
|
||||
self.spacemouse_preferences.pan_reversed = reversed;
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMousePause => {
|
||||
self.spacemouse_paused = !self.spacemouse_paused;
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMousePreferences => {
|
||||
self.open_spacemouse_preferences();
|
||||
Task::none()
|
||||
}
|
||||
Message::SpaceMouseDriverSettings => self.open_spacemouse_driver_settings(),
|
||||
Message::SpaceMouseDetails => {
|
||||
self.spacemouse_details = !self.spacemouse_details;
|
||||
Task::none()
|
||||
}
|
||||
Message::ControlRequest(envelope) => {
|
||||
let (response, task) = self.control_request(envelope.request);
|
||||
envelope.reply.send(response);
|
||||
|
||||
@@ -922,7 +922,7 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
pub(super) fn on_viewport_move(&mut self, p: Point) -> Task<Message> {
|
||||
pub(in crate::app) fn on_viewport_move(&mut self, p: Point) -> Task<Message> {
|
||||
// A ribbon dropdown is open over the viewport. Its backdrop
|
||||
// cannot swallow cursor motion — in iced 0.14 mouse_area/opaque
|
||||
// capture only button presses, never CursorMoved — so the move
|
||||
@@ -5284,7 +5284,7 @@ properties={:.1}ms picked={}",
|
||||
/// model-space view moves (zoom/pan), so the selection rectangle tracks the
|
||||
/// drawing instead of staying frozen at its original pixel. No-op when no
|
||||
/// box is in progress. (#234)
|
||||
pub(super) fn reproject_box_anchor(&mut self, i: usize, vw: f32, vh: f32) {
|
||||
pub(in crate::app) fn reproject_box_anchor(&mut self, i: usize, vw: f32, vh: f32) {
|
||||
let world = self.tabs[i].scene.selection.borrow().box_anchor_world;
|
||||
let Some(world) = world else { return };
|
||||
let tile_b = self.tabs[i].scene.active_model_tile_bounds(vw, vh);
|
||||
|
||||
Reference in new issue
Block a user