Fix button shadow feedback in iced_wgpu
This commit is contained in:
parent
afacb35f9b
commit
a444819799
1 changed files with 8 additions and 6 deletions
|
|
@ -30,14 +30,16 @@ impl button::Renderer for Renderer {
|
||||||
cursor_position,
|
cursor_position,
|
||||||
);
|
);
|
||||||
|
|
||||||
let is_hover = bounds.contains(cursor_position);
|
let is_mouse_over = bounds.contains(cursor_position);
|
||||||
|
|
||||||
// TODO: Render proper shadows
|
// TODO: Render proper shadows
|
||||||
// TODO: Make hovering and pressed styles configurable
|
// TODO: Make hovering and pressed styles configurable
|
||||||
let shadow_offset = if button.state.is_pressed {
|
let shadow_offset = if is_mouse_over {
|
||||||
0.0
|
if button.state.is_pressed {
|
||||||
} else if is_hover {
|
0.0
|
||||||
2.0
|
} else {
|
||||||
|
2.0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
1.0
|
1.0
|
||||||
};
|
};
|
||||||
|
|
@ -74,7 +76,7 @@ impl button::Renderer for Renderer {
|
||||||
content,
|
content,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
if is_hover {
|
if is_mouse_over {
|
||||||
MouseCursor::Pointer
|
MouseCursor::Pointer
|
||||||
} else {
|
} else {
|
||||||
MouseCursor::OutOfBounds
|
MouseCursor::OutOfBounds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue