Make pencil the default tool
This commit is contained in:
@ -27,7 +27,7 @@ use zerocopy::{FromBytes, IntoBytes};
|
||||
use crate::{custom_code_block::try_from_custom_code_block, rasterizer};
|
||||
use crate::{custom_code_block::write_custom_code_block, util::random_id};
|
||||
|
||||
use self::tool::{ToolEvent, Tool};
|
||||
use self::tool::{Tool, ToolEvent};
|
||||
|
||||
const HANDWRITING_MIN_HEIGHT: f32 = 100.0;
|
||||
const HANDWRITING_BOTTOM_PADDING: f32 = 80.0;
|
||||
@ -139,7 +139,7 @@ impl Default for Ephemeral {
|
||||
Self {
|
||||
id: random_id(),
|
||||
canvas_rasterizer: Default::default(),
|
||||
tool: Tool::Eraser,
|
||||
tool: Tool::Pencil,
|
||||
tool_position: None,
|
||||
last_tool_position: None,
|
||||
current_stroke: Default::default(),
|
||||
@ -299,9 +299,7 @@ impl Handwriting {
|
||||
self.e.tool_position = tool_event.position();
|
||||
match self.e.tool {
|
||||
Tool::Pencil => {
|
||||
hw_response.changed |=
|
||||
tool::pencil::on_tool_event(self, tool_event);
|
||||
|
||||
hw_response.changed |= tool::pencil::on_tool_event(self, tool_event);
|
||||
}
|
||||
Tool::Eraser => {
|
||||
if tool::eraser::on_tool_event(self, tool_event) {
|
||||
@ -367,7 +365,9 @@ impl Handwriting {
|
||||
// Draw the texture
|
||||
self.e.canvas_rasterizer.show(ui.ctx(), &painter, mesh_rect);
|
||||
|
||||
if let Some(tool_position) = self.e.tool_position && let Tool::Eraser = self.e.tool {
|
||||
if let Some(tool_position) = self.e.tool_position
|
||||
&& let Tool::Eraser = self.e.tool
|
||||
{
|
||||
let pos = to_screen * tool_position;
|
||||
let shape = Shape::circle_stroke(pos, tool::eraser::RADIUS, style.stroke);
|
||||
painter.add(shape);
|
||||
|
||||
Reference in New Issue
Block a user