diff options
Diffstat (limited to 'examples/multitouch')
-rw-r--r-- | examples/multitouch/src/main.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/multitouch/src/main.rs b/examples/multitouch/src/main.rs index f5faae0f..2830b78d 100644 --- a/examples/multitouch/src/main.rs +++ b/examples/multitouch/src/main.rs @@ -1,12 +1,13 @@ //! This example shows how to use touch events in `Canvas` to draw //! a circle around each fingertip. This only works on touch-enabled //! computers like Microsoft Surface. +use iced::mouse; use iced::widget::canvas::event; use iced::widget::canvas::stroke::{self, Stroke}; -use iced::widget::canvas::{self, Canvas, Cursor, Geometry}; +use iced::widget::canvas::{self, Canvas, Geometry}; use iced::{ executor, touch, window, Application, Color, Command, Element, Length, - Point, Rectangle, Settings, Subscription, Theme, + Point, Rectangle, Renderer, Settings, Subscription, Theme, }; use std::collections::HashMap; @@ -95,7 +96,7 @@ impl Application for Multitouch { } } -impl canvas::Program<Message> for State { +impl canvas::Program<Message, Renderer> for State { type State = (); fn update( @@ -103,7 +104,7 @@ impl canvas::Program<Message> for State { _state: &mut Self::State, event: event::Event, _bounds: Rectangle, - _cursor: Cursor, + _cursor: mouse::Cursor, ) -> (event::Status, Option<Message>) { match event { event::Event::Touch(touch_event) => match touch_event { @@ -125,11 +126,12 @@ impl canvas::Program<Message> for State { fn draw( &self, _state: &Self::State, + renderer: &Renderer, _theme: &Theme, bounds: Rectangle, - _cursor: Cursor, + _cursor: mouse::Cursor, ) -> Vec<Geometry> { - let fingerweb = self.cache.draw(bounds.size(), |frame| { + let fingerweb = self.cache.draw(renderer, bounds.size(), |frame| { if self.fingers.len() < 2 { return; } |