Rename MouseCursor to mouse::Interaction
This commit is contained in:
parent
d4c4198f72
commit
98bc8cf2a7
35 changed files with 170 additions and 171 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{button::StyleSheet, defaults, Defaults, Primitive, Renderer};
|
||||
use iced_native::{
|
||||
Background, Color, Element, Layout, MouseCursor, Point, Rectangle, Vector,
|
||||
mouse, Background, Color, Element, Layout, Point, Rectangle, Vector,
|
||||
};
|
||||
|
||||
impl iced_native::button::Renderer for Renderer {
|
||||
|
|
@ -84,9 +84,9 @@ impl iced_native::button::Renderer for Renderer {
|
|||
content
|
||||
},
|
||||
if is_mouse_over {
|
||||
MouseCursor::Pointer
|
||||
mouse::Interaction::Pointer
|
||||
} else {
|
||||
MouseCursor::default()
|
||||
mouse::Interaction::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{checkbox::StyleSheet, Primitive, Renderer};
|
||||
use iced_native::{
|
||||
checkbox, HorizontalAlignment, MouseCursor, Rectangle, VerticalAlignment,
|
||||
checkbox, mouse, HorizontalAlignment, Rectangle, VerticalAlignment,
|
||||
};
|
||||
|
||||
impl checkbox::Renderer for Renderer {
|
||||
|
|
@ -54,9 +54,9 @@ impl checkbox::Renderer for Renderer {
|
|||
},
|
||||
},
|
||||
if is_mouse_over {
|
||||
MouseCursor::Pointer
|
||||
mouse::Interaction::Pointer
|
||||
} else {
|
||||
MouseCursor::default()
|
||||
mouse::Interaction::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{column, Element, Layout, MouseCursor, Point};
|
||||
use iced_native::{column, mouse, Element, Layout, Point};
|
||||
|
||||
impl column::Renderer for Renderer {
|
||||
fn draw<Message>(
|
||||
|
|
@ -9,7 +9,7 @@ impl column::Renderer for Renderer {
|
|||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> Self::Output {
|
||||
let mut mouse_cursor = MouseCursor::default();
|
||||
let mut mouse_interaction = mouse::Interaction::default();
|
||||
|
||||
(
|
||||
Primitive::Group {
|
||||
|
|
@ -17,18 +17,18 @@ impl column::Renderer for Renderer {
|
|||
.iter()
|
||||
.zip(layout.children())
|
||||
.map(|(child, layout)| {
|
||||
let (primitive, new_mouse_cursor) =
|
||||
let (primitive, new_mouse_interaction) =
|
||||
child.draw(self, defaults, layout, cursor_position);
|
||||
|
||||
if new_mouse_cursor > mouse_cursor {
|
||||
mouse_cursor = new_mouse_cursor;
|
||||
if new_mouse_interaction > mouse_interaction {
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
primitive
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
mouse_cursor,
|
||||
mouse_interaction,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ impl iced_native::container::Renderer for Renderer {
|
|||
},
|
||||
};
|
||||
|
||||
let (content, mouse_cursor) =
|
||||
let (content, mouse_interaction) =
|
||||
content.draw(self, &defaults, content_layout, cursor_position);
|
||||
|
||||
if style.background.is_some() || style.border_width > 0 {
|
||||
|
|
@ -39,10 +39,10 @@ impl iced_native::container::Renderer for Renderer {
|
|||
Primitive::Group {
|
||||
primitives: vec![quad, content],
|
||||
},
|
||||
mouse_cursor,
|
||||
mouse_interaction,
|
||||
)
|
||||
} else {
|
||||
(content, mouse_cursor)
|
||||
(content, mouse_interaction)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{image, Layout, MouseCursor};
|
||||
use iced_native::{image, mouse, Layout};
|
||||
|
||||
impl image::Renderer for Renderer {
|
||||
fn dimensions(&self, handle: &image::Handle) -> (u32, u32) {
|
||||
|
|
@ -16,7 +16,7 @@ impl image::Renderer for Renderer {
|
|||
handle,
|
||||
bounds: layout.bounds(),
|
||||
},
|
||||
MouseCursor::default(),
|
||||
mouse::Interaction::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{
|
||||
mouse,
|
||||
pane_grid::{self, Axis, Pane},
|
||||
Element, Layout, MouseCursor, Point, Rectangle, Vector,
|
||||
Element, Layout, Point, Rectangle, Vector,
|
||||
};
|
||||
|
||||
impl pane_grid::Renderer for Renderer {
|
||||
|
|
@ -22,7 +23,7 @@ impl pane_grid::Renderer for Renderer {
|
|||
cursor_position
|
||||
};
|
||||
|
||||
let mut mouse_cursor = MouseCursor::default();
|
||||
let mut mouse_interaction = mouse::Interaction::default();
|
||||
let mut dragged_pane = None;
|
||||
|
||||
let mut panes: Vec<_> = content
|
||||
|
|
@ -30,11 +31,11 @@ impl pane_grid::Renderer for Renderer {
|
|||
.zip(layout.children())
|
||||
.enumerate()
|
||||
.map(|(i, ((id, pane), layout))| {
|
||||
let (primitive, new_mouse_cursor) =
|
||||
let (primitive, new_mouse_interaction) =
|
||||
pane.draw(self, defaults, layout, pane_cursor_position);
|
||||
|
||||
if new_mouse_cursor > mouse_cursor {
|
||||
mouse_cursor = new_mouse_cursor;
|
||||
if new_mouse_interaction > mouse_interaction {
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
if Some(*id) == dragging {
|
||||
|
|
@ -78,14 +79,14 @@ impl pane_grid::Renderer for Renderer {
|
|||
(
|
||||
Primitive::Group { primitives },
|
||||
if dragging.is_some() {
|
||||
MouseCursor::Grabbing
|
||||
mouse::Interaction::Grabbing
|
||||
} else if let Some(axis) = resizing {
|
||||
match axis {
|
||||
Axis::Horizontal => MouseCursor::ResizingVertically,
|
||||
Axis::Vertical => MouseCursor::ResizingHorizontally,
|
||||
Axis::Horizontal => mouse::Interaction::ResizingVertically,
|
||||
Axis::Vertical => mouse::Interaction::ResizingHorizontally,
|
||||
}
|
||||
} else {
|
||||
mouse_cursor
|
||||
mouse_interaction
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{progress_bar::StyleSheet, Primitive, Renderer};
|
||||
use iced_native::{progress_bar, Color, MouseCursor, Rectangle};
|
||||
use iced_native::{mouse, progress_bar, Color, Rectangle};
|
||||
|
||||
impl progress_bar::Renderer for Renderer {
|
||||
type Style = Box<dyn StyleSheet>;
|
||||
|
|
@ -48,7 +48,7 @@ impl progress_bar::Renderer for Renderer {
|
|||
} else {
|
||||
background
|
||||
},
|
||||
MouseCursor::default(),
|
||||
mouse::Interaction::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{radio::StyleSheet, Primitive, Renderer};
|
||||
use iced_native::{radio, Background, Color, MouseCursor, Rectangle};
|
||||
use iced_native::{mouse, radio, Background, Color, Rectangle};
|
||||
|
||||
const SIZE: f32 = 28.0;
|
||||
const DOT_SIZE: f32 = SIZE / 2.0;
|
||||
|
|
@ -55,9 +55,9 @@ impl radio::Renderer for Renderer {
|
|||
},
|
||||
},
|
||||
if is_mouse_over {
|
||||
MouseCursor::Pointer
|
||||
mouse::Interaction::Pointer
|
||||
} else {
|
||||
MouseCursor::default()
|
||||
mouse::Interaction::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{row, Element, Layout, MouseCursor, Point};
|
||||
use iced_native::{mouse, row, Element, Layout, Point};
|
||||
|
||||
impl row::Renderer for Renderer {
|
||||
fn draw<Message>(
|
||||
|
|
@ -9,7 +9,7 @@ impl row::Renderer for Renderer {
|
|||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> Self::Output {
|
||||
let mut mouse_cursor = MouseCursor::default();
|
||||
let mut mouse_interaction = mouse::Interaction::default();
|
||||
|
||||
(
|
||||
Primitive::Group {
|
||||
|
|
@ -17,18 +17,18 @@ impl row::Renderer for Renderer {
|
|||
.iter()
|
||||
.zip(layout.children())
|
||||
.map(|(child, layout)| {
|
||||
let (primitive, new_mouse_cursor) =
|
||||
let (primitive, new_mouse_interaction) =
|
||||
child.draw(self, defaults, layout, cursor_position);
|
||||
|
||||
if new_mouse_cursor > mouse_cursor {
|
||||
mouse_cursor = new_mouse_cursor;
|
||||
if new_mouse_interaction > mouse_interaction {
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
primitive
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
mouse_cursor,
|
||||
mouse_interaction,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{
|
||||
scrollable, Background, Color, MouseCursor, Rectangle, Vector,
|
||||
};
|
||||
use iced_native::{mouse, scrollable, Background, Color, Rectangle, Vector};
|
||||
|
||||
const SCROLLBAR_WIDTH: u16 = 10;
|
||||
const SCROLLBAR_MARGIN: u16 = 2;
|
||||
|
|
@ -56,7 +54,7 @@ impl scrollable::Renderer for Renderer {
|
|||
scrollbar: Option<scrollable::Scrollbar>,
|
||||
offset: u32,
|
||||
style_sheet: &Self::Style,
|
||||
(content, mouse_cursor): Self::Output,
|
||||
(content, mouse_interaction): Self::Output,
|
||||
) -> Self::Output {
|
||||
(
|
||||
if let Some(scrollbar) = scrollbar {
|
||||
|
|
@ -118,9 +116,9 @@ impl scrollable::Renderer for Renderer {
|
|||
content
|
||||
},
|
||||
if is_mouse_over_scrollbar || state.is_scroller_grabbed() {
|
||||
MouseCursor::Idle
|
||||
mouse::Interaction::Idle
|
||||
} else {
|
||||
mouse_cursor
|
||||
mouse_interaction
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
slider::{HandleShape, StyleSheet},
|
||||
Primitive, Renderer,
|
||||
};
|
||||
use iced_native::{slider, Background, Color, MouseCursor, Point, Rectangle};
|
||||
use iced_native::{mouse, slider, Background, Color, Point, Rectangle};
|
||||
|
||||
const HANDLE_HEIGHT: f32 = 22.0;
|
||||
|
||||
|
|
@ -95,11 +95,11 @@ impl slider::Renderer for Renderer {
|
|||
primitives: vec![rail_top, rail_bottom, handle],
|
||||
},
|
||||
if is_dragging {
|
||||
MouseCursor::Grabbing
|
||||
mouse::Interaction::Grabbing
|
||||
} else if is_mouse_over {
|
||||
MouseCursor::Grab
|
||||
mouse::Interaction::Grab
|
||||
} else {
|
||||
MouseCursor::default()
|
||||
mouse::Interaction::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{space, MouseCursor, Rectangle};
|
||||
use iced_native::{mouse, space, Rectangle};
|
||||
|
||||
impl space::Renderer for Renderer {
|
||||
fn draw(&mut self, _bounds: Rectangle) -> Self::Output {
|
||||
(Primitive::None, MouseCursor::default())
|
||||
(Primitive::None, mouse::Interaction::default())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{svg, Layout, MouseCursor};
|
||||
use iced_native::{mouse, svg, Layout};
|
||||
|
||||
impl svg::Renderer for Renderer {
|
||||
fn dimensions(&self, handle: &svg::Handle) -> (u32, u32) {
|
||||
|
|
@ -16,7 +16,7 @@ impl svg::Renderer for Renderer {
|
|||
handle,
|
||||
bounds: layout.bounds(),
|
||||
},
|
||||
MouseCursor::default(),
|
||||
mouse::Interaction::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{
|
||||
text, Color, Font, HorizontalAlignment, MouseCursor, Rectangle, Size,
|
||||
mouse, text, Color, Font, HorizontalAlignment, Rectangle, Size,
|
||||
VerticalAlignment,
|
||||
};
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ impl text::Renderer for Renderer {
|
|||
horizontal_alignment,
|
||||
vertical_alignment,
|
||||
},
|
||||
MouseCursor::default(),
|
||||
mouse::Interaction::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use crate::{text_input::StyleSheet, Primitive, Renderer};
|
||||
|
||||
use iced_native::{
|
||||
mouse,
|
||||
text_input::{self, cursor},
|
||||
Background, Color, Font, HorizontalAlignment, MouseCursor, Point,
|
||||
Rectangle, Size, Vector, VerticalAlignment,
|
||||
Background, Color, Font, HorizontalAlignment, Point, Rectangle, Size,
|
||||
Vector, VerticalAlignment,
|
||||
};
|
||||
use std::f32;
|
||||
|
||||
|
|
@ -232,9 +233,9 @@ impl text_input::Renderer for Renderer {
|
|||
primitives: vec![input, contents],
|
||||
},
|
||||
if is_mouse_over {
|
||||
MouseCursor::Text
|
||||
mouse::Interaction::Text
|
||||
} else {
|
||||
MouseCursor::default()
|
||||
mouse::Interaction::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue