Skip to content

Commit

Permalink
fix: icon on a raised layer
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Oct 24, 2024
1 parent 371614c commit a081961
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/widgets/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ where
cursor_position: mouse::Cursor,
viewport: &Rectangle,
) {
use cosmic::iced_core::Renderer;
self.content.as_widget().draw(
&tree.children[0],
renderer,
Expand All @@ -230,16 +231,23 @@ where
viewport,
);

if let Some(icon) = self.source_icon.as_ref() {
icon.as_widget().draw(
&tree.children[1],
renderer,
theme,
renderer_style,
layout.children().nth(1).unwrap(),
cursor_position,
viewport,
);
if let Some((icon, (l, bounds))) = self.source_icon.as_ref().zip(
layout
.children()
.nth(1)
.and_then(|l| viewport.intersection(&l.bounds()).map(|b| (l, b))),
) {
renderer.with_layer(bounds, |renderer| {
icon.as_widget().draw(
&tree.children[1],
renderer,
theme,
renderer_style,
l,
cursor_position,
viewport,
)
});
}
}

Expand Down

0 comments on commit a081961

Please sign in to comment.