Skip to content

Commit

Permalink
Fix: allow calling set_pixels_per_point before first frame
Browse files Browse the repository at this point in the history
Closes #1153
  • Loading branch information
emilk committed Feb 5, 2022
1 parent 55067f5 commit 5459ab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
* Context menus now respects the theme ([#1043](https://github.com/emilk/egui/pull/1043))
* Plot `Orientation` was not public, although fields using this type were ([#1130](https://github.com/emilk/egui/pull/1130))
* Fixed `enable_drag` for Windows ([#1108](https://github.com/emilk/egui/pull/1108)).
* Calling `Context::set_pixels_per_point` before the first frame will now work.

### Contributors 🙏
* [AlexxxRu](https://github.com/alexxxru): [#1108](https://github.com/emilk/egui/pull/1108).
Expand Down
6 changes: 3 additions & 3 deletions egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ impl ContextImpl {
fn begin_frame_mut(&mut self, new_raw_input: RawInput) {
self.memory.begin_frame(&self.input, &new_raw_input);

let mut input = std::mem::take(&mut self.input);
self.input = std::mem::take(&mut self.input).begin_frame(new_raw_input);

if let Some(new_pixels_per_point) = self.memory.new_pixels_per_point.take() {
input.pixels_per_point = new_pixels_per_point;
self.input.pixels_per_point = new_pixels_per_point;
}

self.input = input.begin_frame(new_raw_input);
self.frame_state.begin_frame(&self.input);

self.update_fonts_mut();
Expand Down

0 comments on commit 5459ab2

Please sign in to comment.