Browse Source

Do less rounding of positions to pixel boundaries

Fixes https://github.com/emilk/egui/issues/27
pull/30/head
Emil Ernerfeldt 4 years ago
parent
commit
b8642b4db4
  1. 1
      CHANGELOG.md
  2. 2
      egui/src/containers/area.rs
  3. 2
      egui/src/containers/resize.rs
  4. 3
      egui/src/ui.rs

1
CHANGELOG.md

@ -6,6 +6,7 @@
* Add ability to override text color with `visuals.override_text_color`
* Refactored the interface for `egui::app::App`
* Demo App: Add slider to scale all of Egui
* Fix a bug where some regions would slowly grow for non-integral scales (`pixels_per_point`).
## 0.2.0 - 2020-10-10

2
egui/src/containers/area.rs

@ -173,7 +173,7 @@ impl Prepared {
movable,
} = self;
state.size = (content_ui.min_rect().max - state.pos).ceil();
state.size = content_ui.min_rect().size();
let rect = Rect::from_min_size(state.pos, state.size);
let clip_rect = Rect::everything(); // TODO: get from context

2
egui/src/containers/resize.rs

@ -240,7 +240,6 @@ impl Resize {
} = prepared;
state.last_content_size = content_ui.min_size();
state.last_content_size = state.last_content_size.ceil(); // Avoid rounding errors in math
// ------------------------------
@ -249,7 +248,6 @@ impl Resize {
// so we must follow the contents:
state.desired_size = state.desired_size.max(state.last_content_size);
state.desired_size = ui.painter().round_vec_to_pixels(state.desired_size);
// We are as large as we look
ui.allocate_space(state.desired_size);

3
egui/src/ui.rs

@ -438,9 +438,6 @@ impl Ui {
///
/// You may get LESS space than you asked for if the current layout won't fit what you asked for.
pub fn allocate_space(&mut self, desired_size: Vec2) -> Rect {
let desired_size = self.painter().round_vec_to_pixels(desired_size);
self.cursor = self.painter().round_pos_to_pixels(self.cursor);
// For debug rendering
let too_wide = desired_size.x > self.available().width();
let too_high = desired_size.x > self.available().height();

Loading…
Cancel
Save