mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 21:42:59 -05:00
Cursors: tool cursors keep their size under UI Scaling unless Scale Cursor Proportional to UI is on
The Scale Cursor Proportional to UI preference was never passed to the interface, so painted tool cursors always grew with UI Scaling and showed twice as large at 200%. The preference now decides it, and it is off by default.
This commit is contained in:
1 parent
84335645da
commit
0ef22709c1
2 files changed
+13
No files matched your search
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user