Introduce Cursor type in canvas

This commit is contained in:
Héctor Ramón Jiménez 2020-04-29 04:25:49 +02:00
parent 5586034d66
commit dc51080328
6 changed files with 169 additions and 108 deletions

View file

@ -1,7 +1,7 @@
use iced::{
canvas::{self, Cache, Canvas, Geometry, LineCap, Path, Stroke},
canvas::{self, Cache, Canvas, Cursor, Geometry, LineCap, Path, Stroke},
executor, Application, Color, Command, Container, Element, Length, Point,
Settings, Size, Subscription, Vector,
Rectangle, Settings, Subscription, Vector,
};
pub fn main() {
@ -75,10 +75,10 @@ impl Application for Clock {
}
impl canvas::Program<Message> for Clock {
fn draw(&self, bounds: Size) -> Vec<Geometry> {
fn draw(&self, bounds: Rectangle, _cursor: Cursor) -> Vec<Geometry> {
use chrono::Timelike;
let clock = self.clock.draw(bounds, |frame| {
let clock = self.clock.draw(bounds.size(), |frame| {
let center = frame.center();
let radius = frame.width().min(frame.height()) / 2.0;