Working multitouch example
This commit is contained in:
parent
4a3c3e2a18
commit
fe17641d46
4 changed files with 179 additions and 0 deletions
|
|
@ -204,6 +204,7 @@ fn view_controls<'a>(
|
|||
|
||||
mod grid {
|
||||
use crate::Preset;
|
||||
use iced::touch;
|
||||
use iced::widget::canvas;
|
||||
use iced::widget::canvas::event::{self, Event};
|
||||
use iced::widget::canvas::{
|
||||
|
|
@ -423,6 +424,22 @@ mod grid {
|
|||
};
|
||||
|
||||
match event {
|
||||
Event::Touch(touch_event) => match touch_event {
|
||||
touch::Event::FingerMoved { .. } => {
|
||||
let message = {
|
||||
*interaction = if is_populated {
|
||||
Interaction::Erasing
|
||||
} else {
|
||||
Interaction::Drawing
|
||||
};
|
||||
|
||||
populate.or(unpopulate)
|
||||
};
|
||||
|
||||
(event::Status::Captured, message)
|
||||
}
|
||||
_ => (event::Status::Ignored, None),
|
||||
},
|
||||
Event::Mouse(mouse_event) => match mouse_event {
|
||||
mouse::Event::ButtonPressed(button) => {
|
||||
let message = match button {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue