Merge pull request #10378 from dotCooCoo/fix/cursor-scale-with-ui

Cursors: tool cursors keep their size under UI Scaling unless Scale Cursor Proportional to UI is on
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-01 07:07:04 -08:00
commit 707aa4a3b6
2 files changed
+13

No files matched your search

+2
View File
@@ -776,6 +776,8 @@ pub(crate) fn root_env(prefs: &vectorcraft_engine::Prefs, native_ppp: f32, print
let (theme, mode, accent) = theme::root_theme(prefs);
let scaling = applied_ui_scaling(prefs.ui_scaling);
let mut root = RootEnv::new().theme(theme).mode(mode).accent(accent).scale(Scale::new(scaling)).tooltips(prefs.show_tool_tips);
// Painted tool cursors grow with UI Scaling only when Scale Cursor Proportional to UI is on.
root = root.cursor_follows_zoom(prefs.scale_cursor_with_ui);
root.sizes = theme::app_sizes();
root.values.set(view::zoom_scheme(print, native_ppp));
root.values.set(if prefs.scrub_numeric_fields { ScrubDrags::LabelOnly } else { ScrubDrags::Off });
@@ -93,6 +93,17 @@ fn pixel_preview_compares_a_document_pixel_with_a_device_pixel() {
}
}
/// Painted tool cursors keep their size under UI Scaling unless Scale Cursor Proportional to UI
/// is on.
#[test]
fn tool_cursors_follow_ui_scaling_only_with_the_cursor_preference() {
let mut prefs = vectorcraft_engine::Prefs { ui_scaling: 2.0, ..vectorcraft_engine::Prefs::default() };
assert!(!prefs.scale_cursor_with_ui, "the preference starts off");
assert!(!crate::app::root_env(&prefs, 1.0, None).cursor_follows_zoom, "off: the cursor keeps its size at 200%");
prefs.scale_cursor_with_ui = true;
assert!(crate::app::root_env(&prefs, 1.0, None).cursor_follows_zoom, "on: the cursor grows with the interface");
}
#[test]
fn out_of_range_saved_ui_scaling_keeps_actual_size_correct() {
let (a, b) = (Point::new(100.0, 100.0), Point::new(228.0, 100.0));