diff --git a/rnote-engine/src/pens/penholder.rs b/rnote-engine/src/pens/penholder.rs index e10da1a71f..54aa44b110 100644 --- a/rnote-engine/src/pens/penholder.rs +++ b/rnote-engine/src/pens/penholder.rs @@ -17,7 +17,7 @@ use crate::widgetflags::WidgetFlags; use crate::DrawOnDocBehaviour; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -pub enum BackLogPolicy { +pub enum BacklogPolicy { NoLimit, Limit(Duration), DisableBacklog, @@ -34,7 +34,7 @@ pub struct PenHolder { pub pen_mode_state: PenModeState, /// Indicates the policy for the retrieval of the event backlog #[serde(skip)] - pub backlog_policy: BackLogPolicy, + pub backlog_policy: BacklogPolicy, #[serde(skip)] pub(super) current_pen: Pen, @@ -51,7 +51,7 @@ impl Default for PenHolder { Self { shortcuts: Shortcuts::default(), pen_mode_state: PenModeState::default(), - backlog_policy: BackLogPolicy::NoLimit, + backlog_policy: BacklogPolicy::NoLimit, current_pen: Pen::default(), pen_progress: PenProgress::Idle, @@ -265,12 +265,12 @@ impl PenHolder { let current_style = self.pen_mode_state.current_style_w_override(); self.backlog_policy = match current_style { - PenStyle::Brush => BackLogPolicy::NoLimit, - PenStyle::Shaper => BackLogPolicy::Limit(Duration::from_millis(16)), - PenStyle::Typewriter => BackLogPolicy::Limit(Duration::from_millis(16)), - PenStyle::Eraser => BackLogPolicy::Limit(Duration::from_millis(16)), - PenStyle::Selector => BackLogPolicy::Limit(Duration::from_millis(16)), - PenStyle::Tools => BackLogPolicy::Limit(Duration::from_millis(16)), + PenStyle::Brush => BacklogPolicy::NoLimit, + PenStyle::Shaper => BacklogPolicy::Limit(Duration::from_millis(16)), + PenStyle::Typewriter => BacklogPolicy::Limit(Duration::from_millis(33)), + PenStyle::Eraser => BacklogPolicy::Limit(Duration::from_millis(33)), + PenStyle::Selector => BacklogPolicy::Limit(Duration::from_millis(33)), + PenStyle::Tools => BacklogPolicy::DisableBacklog, }; // Enable text preprocessing for typewriter diff --git a/rnote-ui/src/canvas/input.rs b/rnote-ui/src/canvas/input.rs index a27d073bf4..b22b72aa0f 100644 --- a/rnote-ui/src/canvas/input.rs +++ b/rnote-ui/src/canvas/input.rs @@ -3,7 +3,7 @@ use rnote_compose::penevents::ShortcutKey; use rnote_compose::penevents::{KeyboardKey, PenState}; use rnote_compose::penevents::{ModifierKey, PenEvent}; use rnote_compose::penpath::Element; -use rnote_engine::pens::penholder::BackLogPolicy; +use rnote_engine::pens::penholder::BacklogPolicy; use rnote_engine::pens::PenMode; use rnote_engine::WidgetFlags; use std::time::{Duration, Instant}; @@ -288,7 +288,7 @@ fn retrieve_pointer_elements( canvas: &RnCanvas, now: Instant, event: &gdk::Event, - backlog_policy: BackLogPolicy, + backlog_policy: BacklogPolicy, ) -> Option> { let root = canvas.root().unwrap(); let (surface_trans_x, surface_trans_y) = root.surface_transform(); @@ -311,7 +311,7 @@ fn retrieve_pointer_elements( }; if event.event_type() == gdk::EventType::MotionNotify - && backlog_policy != BackLogPolicy::DisableBacklog + && backlog_policy != BacklogPolicy::DisableBacklog { let mut prev_delta = Duration::ZERO; @@ -327,7 +327,7 @@ fn retrieve_pointer_elements( let entry_delta = Duration::from_millis(event_time.saturating_sub(entry.time()) as u64); let Some(entry_time) = now.checked_sub(entry_delta) else {continue;}; - if let BackLogPolicy::Limit(delta_limit) = backlog_policy { + if let BacklogPolicy::Limit(delta_limit) = backlog_policy { // We go back in time, so `entry_delta` will increase // // If the backlog input rate is higher than the limit, filter it out