File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,7 @@ impl ContextImpl {
492
492
pixels_per_point,
493
493
self . memory . options . input_options ,
494
494
) ;
495
+ let repaint_after = viewport. input . wants_repaint_after ( ) ;
495
496
496
497
let screen_rect = viewport. input . screen_rect ;
497
498
@@ -553,6 +554,10 @@ impl ContextImpl {
553
554
}
554
555
555
556
self . update_fonts_mut ( ) ;
557
+
558
+ if let Some ( delay) = repaint_after {
559
+ self . request_repaint_after ( delay, viewport_id, RepaintCause :: new ( ) ) ;
560
+ }
556
561
}
557
562
558
563
/// Load fonts unless already loaded.
@@ -2398,10 +2403,7 @@ impl ContextImpl {
2398
2403
2399
2404
if repaint_needed {
2400
2405
self . request_repaint ( ended_viewport_id, RepaintCause :: new ( ) ) ;
2401
- } else if let Some ( delay) = viewport. input . wants_repaint_after ( ) {
2402
- self . request_repaint_after ( delay, ended_viewport_id, RepaintCause :: new ( ) ) ;
2403
2406
}
2404
-
2405
2407
// -------------------
2406
2408
2407
2409
let all_viewport_ids = self . all_viewport_ids ( ) ;
Original file line number Diff line number Diff line change @@ -597,10 +597,14 @@ impl InputState {
597
597
( self . time - self . last_scroll_time ) as f32
598
598
}
599
599
600
- /// The [`crate::Context`] will call this at the end of each frame to see if we need a repaint.
600
+ /// The [`crate::Context`] will call this at the beginning of each frame to see if we need a repaint.
601
601
///
602
602
/// Returns how long to wait for a repaint.
603
- pub fn wants_repaint_after ( & self ) -> Option < Duration > {
603
+ ///
604
+ /// NOTE: It's important to call this immediately after [`Self::begin_pass`] since calls to
605
+ /// [`Self::consume_key`] will remove events from the vec, meaning those key presses wouldn't
606
+ /// cause a repaint.
607
+ pub ( crate ) fn wants_repaint_after ( & self ) -> Option < Duration > {
604
608
if self . pointer . wants_repaint ( )
605
609
|| self . unprocessed_scroll_delta . abs ( ) . max_elem ( ) > 0.2
606
610
|| self . unprocessed_scroll_delta_for_zoom . abs ( ) > 0.2
You can’t perform that action at this time.
0 commit comments