@@ -291,6 +291,18 @@ where
291291
292292 let new_size_hint = self . component . size_hint ( ) ;
293293
294+ // We must invalidate application layout in 3 instances:
295+ //
296+ // 1. The size hint of the component changes. Other widgets
297+ // may change layout behavior.
298+ //
299+ // 2. The size hint of the component is shrink for any axis
300+ // and the component has changed size. The new size may
301+ // push other widgets around.
302+ //
303+ // 3. The overlay status of the component changes. The
304+ // runtime will only call `overlay` again if the layout
305+ // is invalidated.
294306 if new_size_hint != self . size_hint {
295307 self . size_hint = new_size_hint;
296308 shell. invalidate_layout ( ) ;
@@ -407,7 +419,7 @@ where
407419 layout : Layout < ' b > ,
408420 renderer : & Renderer ,
409421 viewport : & Rectangle ,
410- translation : core :: Vector ,
422+ translation : Vector ,
411423 ) -> Option < overlay:: Element < ' b , Message , Theme , Renderer > > {
412424 let overlay = self . view . as_widget_mut ( ) . overlay (
413425 & mut tree. children [ 0 ] ,
@@ -422,11 +434,9 @@ where
422434
423435 self . has_overlay = true ;
424436
425- let state = tree. state . downcast_mut ( ) ;
426-
427437 Some ( overlay:: Element :: new ( Box :: new ( Overlay {
428438 component : & mut self . component ,
429- state,
439+ state : tree . state . downcast_mut ( ) ,
430440 raw : overlay,
431441 is_outdated : & mut self . is_outdated ,
432442 } ) ) )
0 commit comments