fix(input): remember "draw with the finger", on by default on Android (Issue #50)

The setting was never saved and always started off, so one finger only
moved the page after every start. On a phone without a pen nothing could
be written until it was switched on again, and an update restarts the
app. It is now saved with the other UI settings and starts on on
Android, where phones usually have no pen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haraldandClaude Opus 5.5 committed 2026-11-05 12:20:52 +01:00
1 parent 298932cb32
commit 0d9e9aa2ea
3 files changed
+28 -7

No files matched your search

+9
View File
@@ -1471,6 +1471,7 @@ pub fn run_with(
ui_state.stylus_buttons = ui_settings.stylus_buttons.clone();
ui_state.set_eraser_radius_mm(ui_settings.eraser_radius_mm);
ui_state.math.set_enabled(ui_settings.math_assist);
ui_state.touch_draw_enabled = ui_settings.touch_draw;
ui_state.select_pen(ui_settings.active_pen);
ui_state.highlighter_colors = ui_settings.highlighter_colors;
ui_state.select_highlighter_color(ui_settings.active_highlighter);
@@ -5356,6 +5357,14 @@ pub fn run_with(
&mut ui_state,
);
}
UiAction::SetTouchDraw(on) => {
ui_settings.touch_draw = on;
save_ui_settings(
&ui_settings,
ui_settings_path.as_deref(),
&mut ui_state,
);
}
UiAction::SetSidebarSide(side) => {
ui_settings.sidebar_side = side;
save_ui_settings(
+5
View File
@@ -234,6 +234,9 @@ pub struct UiSettings {
pub storage_dir: Option<PathBuf>,
/// Compute handwritten math after `=` (Issue #46)
pub math_assist: bool,
/// One finger draws instead of moving the page. On by default on Android, where phones
/// usually have no pen (Issue #50)
pub touch_draw: bool,
}
impl Default for UiSettings {
@@ -256,6 +259,7 @@ impl Default for UiSettings {
eraser_radius_mm: 3.0,
storage_dir: None,
math_assist: false,
touch_draw: cfg!(target_os = "android"),
}
}
}
@@ -354,6 +358,7 @@ mod tests {
eraser_radius_mm: 6.0,
storage_dir: Some(PathBuf::from("/home/pia/Nextcloud/ink-notes")),
math_assist: true,
touch_draw: true,
};
settings.save_to(&path).unwrap();
assert_eq!(UiSettings::load_from(&path), settings);
+14 -7
View File
@@ -319,6 +319,8 @@ pub enum UiAction {
SetSidebarSide(SidebarSide),
/// Compute handwritten math after `=` on or off (Issue #46)
SetMathAssist(bool),
/// One finger draws or moves the page (saved, Issue #50)
SetTouchDraw(bool),
/// Sprache der Oberfläche; `None` = Sprache des Systems
SetLanguage(Option<crate::i18n::Language>),
/// Papierfarbe der Anzeige und Aufhellen dunkler Tinte (wird gespeichert)
@@ -4613,13 +4615,18 @@ pub fn render_ui(
});
section(ui, t!("EINGABE"));
ui.checkbox(
&mut state.touch_draw_enabled,
t!("Mit dem Finger zeichnen"),
)
.on_hover_text(
t!("Aus: ein Finger verschiebt, zwei Finger zoomen (empfohlen mit Stift).\nAn: ein Finger zeichnet."),
);
if ui
.checkbox(
&mut state.touch_draw_enabled,
t!("Mit dem Finger zeichnen"),
)
.on_hover_text(
t!("Aus: ein Finger verschiebt, zwei Finger zoomen (empfohlen mit Stift).\nAn: ein Finger zeichnet."),
)
.changed()
{
actions.push(UiAction::SetTouchDraw(state.touch_draw_enabled));
}
let mut math = state.math.enabled;
if ui
.checkbox(&mut math, t!("Formeln nach „=“ ausrechnen"))