Skip to content

Commit

Permalink
fix more hidpi issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Grokmoo committed Dec 23, 2024
1 parent 702cf58 commit f2a81d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ impl<'a> WidgetBuilder<'a> {

font.layout(params, text, &mut cursor);

cursor.x
cursor.x / internal.scale_factor()
}

fn calculate_font_layout_cursor(&self, cursor: Point) -> Option<Point> {
Expand Down Expand Up @@ -1189,7 +1189,9 @@ impl<'a> WidgetBuilder<'a> {
let size = self.frame.widget(widget_index).size;
let mut adjust = self.data.align.adjust_for(size);
let pos = self.frame.widget(widget_index).pos - adjust;
let max = self.frame.context().display_size();
let mut max = self.frame.context().display_size();
max.x /= self.frame.context().scale_factor();
max.y /= self.frame.context().scale_factor();
adjust.x -= if pos.x < 0.0 { -pos.x } else if pos.x + size.x > max.x { max.x - pos.x - size.x } else { 0.0 };
adjust.y -= if pos.y < 0.0 { -pos.y } else if pos.y + size.y > max.y { max.y - pos.y - size.y } else { 0.0 };
for index in widget_index..self.frame.num_widgets() {
Expand Down

0 comments on commit f2a81d1

Please sign in to comment.