Do less rounding of positions to pixel boundaries
Fixes https://github.com/emilk/egui/issues/27
This commit is contained in:
parent
a4e19d7207
commit
b8642b4db4
4 changed files with 2 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
||||||
* Add ability to override text color with `visuals.override_text_color`
|
* Add ability to override text color with `visuals.override_text_color`
|
||||||
* Refactored the interface for `egui::app::App`
|
* Refactored the interface for `egui::app::App`
|
||||||
* Demo App: Add slider to scale all of Egui
|
* 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
|
## 0.2.0 - 2020-10-10
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ impl Prepared {
|
||||||
movable,
|
movable,
|
||||||
} = self;
|
} = 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 rect = Rect::from_min_size(state.pos, state.size);
|
||||||
let clip_rect = Rect::everything(); // TODO: get from context
|
let clip_rect = Rect::everything(); // TODO: get from context
|
||||||
|
|
|
@ -240,7 +240,6 @@ impl Resize {
|
||||||
} = prepared;
|
} = prepared;
|
||||||
|
|
||||||
state.last_content_size = content_ui.min_size();
|
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:
|
// so we must follow the contents:
|
||||||
|
|
||||||
state.desired_size = state.desired_size.max(state.last_content_size);
|
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
|
// We are as large as we look
|
||||||
ui.allocate_space(state.desired_size);
|
ui.allocate_space(state.desired_size);
|
||||||
|
|
|
@ -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.
|
/// 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 {
|
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
|
// For debug rendering
|
||||||
let too_wide = desired_size.x > self.available().width();
|
let too_wide = desired_size.x > self.available().width();
|
||||||
let too_high = desired_size.x > self.available().height();
|
let too_high = desired_size.x > self.available().height();
|
||||||
|
|
Loading…
Reference in a new issue