Add pref to hide cursor when handwriting
This commit is contained in:
@ -151,6 +151,7 @@ impl FileEditor {
|
|||||||
BufferItem::Handwriting(handwriting) => {
|
BufferItem::Handwriting(handwriting) => {
|
||||||
let style = HandwritingStyle {
|
let style = HandwritingStyle {
|
||||||
animate: preferences.animations,
|
animate: preferences.animations,
|
||||||
|
hide_cursor: preferences.hide_handwriting_cursor,
|
||||||
..HandwritingStyle::from_theme(ui.ctx().theme())
|
..HandwritingStyle::from_theme(ui.ctx().theme())
|
||||||
};
|
};
|
||||||
if handwriting.ui(&style, ui).changed {
|
if handwriting.ui(&style, ui).changed {
|
||||||
|
|||||||
@ -56,6 +56,7 @@ pub struct HandwritingStyle {
|
|||||||
pub bg_line_stroke: Stroke,
|
pub bg_line_stroke: Stroke,
|
||||||
pub bg_color: Color32,
|
pub bg_color: Color32,
|
||||||
pub animate: bool,
|
pub animate: bool,
|
||||||
|
pub hide_cursor: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize, serde::Serialize)]
|
#[derive(serde::Deserialize, serde::Serialize)]
|
||||||
@ -185,12 +186,11 @@ impl Handwriting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let desired_size = Vec2::new(ui.available_width(), self.height);
|
let desired_size = Vec2::new(ui.available_width(), self.height);
|
||||||
let (response, painter) = ui.allocate_painter(desired_size, Sense::drag());
|
let (mut response, painter) = ui.allocate_painter(desired_size, Sense::drag());
|
||||||
|
|
||||||
let mut response = response
|
if style.hide_cursor {
|
||||||
//.on_hover_cursor(CursorIcon::Crosshair)
|
response = response.on_hover_and_drag_cursor(egui::CursorIcon::None);
|
||||||
//.on_hover_and_drag_cursor(CursorIcon::None)
|
}
|
||||||
;
|
|
||||||
|
|
||||||
let size = response.rect.size();
|
let size = response.rect.size();
|
||||||
|
|
||||||
@ -711,6 +711,7 @@ impl HandwritingStyle {
|
|||||||
bg_color,
|
bg_color,
|
||||||
bg_line_stroke: Stroke::new(0.5, line_color),
|
bg_line_stroke: Stroke::new(0.5, line_color),
|
||||||
animate: true,
|
animate: true,
|
||||||
|
hide_cursor: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,9 @@ pub struct Preferences {
|
|||||||
/// Enable high-contrast theme
|
/// Enable high-contrast theme
|
||||||
pub high_contrast: bool,
|
pub high_contrast: bool,
|
||||||
|
|
||||||
|
/// Hide the cursor when handwriting
|
||||||
|
pub hide_handwriting_cursor: bool,
|
||||||
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
has_applied_theme: bool,
|
has_applied_theme: bool,
|
||||||
}
|
}
|
||||||
@ -20,6 +23,7 @@ impl Default for Preferences {
|
|||||||
animations: true,
|
animations: true,
|
||||||
high_contrast: false,
|
high_contrast: false,
|
||||||
has_applied_theme: false,
|
has_applied_theme: false,
|
||||||
|
hide_handwriting_cursor: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,6 +71,8 @@ impl Preferences {
|
|||||||
self.apply(ui.ctx());
|
self.apply(ui.ctx());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.toggle_value(&mut self.hide_handwriting_cursor, "Hide Handwriting Cursor");
|
||||||
|
|
||||||
egui::widgets::global_theme_preference_buttons(ui);
|
egui::widgets::global_theme_preference_buttons(ui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user