File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ where
220
220
cursor_position : mouse:: Cursor ,
221
221
viewport : & Rectangle ,
222
222
) {
223
+ use cosmic:: iced_core:: Renderer ;
223
224
self . content . as_widget ( ) . draw (
224
225
& tree. children [ 0 ] ,
225
226
renderer,
@@ -230,16 +231,23 @@ where
230
231
viewport,
231
232
) ;
232
233
233
- if let Some ( icon) = self . source_icon . as_ref ( ) {
234
- icon. as_widget ( ) . draw (
235
- & tree. children [ 1 ] ,
236
- renderer,
237
- theme,
238
- renderer_style,
239
- layout. children ( ) . nth ( 1 ) . unwrap ( ) ,
240
- cursor_position,
241
- viewport,
242
- ) ;
234
+ if let Some ( ( icon, ( l, bounds) ) ) = self . source_icon . as_ref ( ) . zip (
235
+ layout
236
+ . children ( )
237
+ . nth ( 1 )
238
+ . and_then ( |l| viewport. intersection ( & l. bounds ( ) ) . map ( |b| ( l, b) ) ) ,
239
+ ) {
240
+ renderer. with_layer ( bounds, |renderer| {
241
+ icon. as_widget ( ) . draw (
242
+ & tree. children [ 1 ] ,
243
+ renderer,
244
+ theme,
245
+ renderer_style,
246
+ l,
247
+ cursor_position,
248
+ viewport,
249
+ )
250
+ } ) ;
243
251
}
244
252
}
245
253
You can’t perform that action at this time.
0 commit comments