Implement basic cursor availability

This commit is contained in:
Héctor Ramón Jiménez 2023-06-08 20:11:59 +02:00
parent c15f1b5f65
commit 34451bff18
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
55 changed files with 731 additions and 886 deletions

View file

@ -61,9 +61,7 @@ impl Sandbox for Example {
mod bezier {
use iced::mouse;
use iced::widget::canvas::event::{self, Event};
use iced::widget::canvas::{
self, Canvas, Cursor, Frame, Geometry, Path, Stroke,
};
use iced::widget::canvas::{self, Canvas, Frame, Geometry, Path, Stroke};
use iced::{Element, Length, Point, Rectangle, Renderer, Theme};
#[derive(Default)]
@ -100,7 +98,7 @@ mod bezier {
state: &mut Self::State,
event: Event,
bounds: Rectangle,
cursor: Cursor,
cursor: mouse::Cursor,
) -> (event::Status, Option<Curve>) {
let cursor_position =
if let Some(position) = cursor.position_in(&bounds) {
@ -155,7 +153,7 @@ mod bezier {
renderer: &Renderer,
_theme: &Theme,
bounds: Rectangle,
cursor: Cursor,
cursor: mouse::Cursor,
) -> Vec<Geometry> {
let content = self.state.cache.draw(
renderer,
@ -183,7 +181,7 @@ mod bezier {
&self,
_state: &Self::State,
bounds: Rectangle,
cursor: Cursor,
cursor: mouse::Cursor,
) -> mouse::Interaction {
if cursor.is_over(&bounds) {
mouse::Interaction::Crosshair
@ -224,7 +222,7 @@ mod bezier {
&self,
renderer: &Renderer,
bounds: Rectangle,
cursor: Cursor,
cursor: mouse::Cursor,
) -> Geometry {
let mut frame = Frame::new(renderer, bounds.size());