Relayout when `Application::scale_factor` changes

This commit is contained in:
Héctor Ramón Jiménez 2020-06-23 06:12:06 +02:00
parent eec65a055f
commit bbdf558bd7
2 changed files with 26 additions and 0 deletions

View File

@ -155,6 +155,19 @@ pub fn run<A, E, C>(
context.window().scale_factor() * new_scale_factor, context.window().scale_factor() * new_scale_factor,
); );
// We relayout the UI with the new logical size.
// The queue is empty, therefore this will never produce
// a `Command`.
//
// TODO: Properly queue `WindowResized` and `CursorMoved`
// events.
let _ = state.update(
clipboard.as_ref().map(|c| c as _),
viewport.logical_size(),
&mut renderer,
&mut debug,
);
scale_factor = new_scale_factor; scale_factor = new_scale_factor;
} }
} }

View File

@ -236,6 +236,19 @@ pub fn run<A, E, C>(
window.scale_factor() * new_scale_factor, window.scale_factor() * new_scale_factor,
); );
// We relayout the UI with the new logical size.
// The queue is empty, therefore this will never produce
// a `Command`.
//
// TODO: Properly queue `WindowResized` and `CursorMoved`
// events.
let _ = state.update(
clipboard.as_ref().map(|c| c as _),
viewport.logical_size(),
&mut renderer,
&mut debug,
);
scale_factor = new_scale_factor; scale_factor = new_scale_factor;
} }
} }