Skip to content

Commit

Permalink
egui_webview: fix browser position
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Sep 28, 2024
1 parent bd11422 commit 455c26d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/egui_dnd/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ impl<'a> Item<'a> {
.interactable(false)
.fixed_pos(pos)
.order(Order::Tooltip)
.constrain(false)
.show(ui.ctx(), |ui| {
ui.with_layout(layout, |ui| {
if let Some(size) = size.or(dnd_state.detection_state.dragged_item_size()) {
Expand Down
4 changes: 3 additions & 1 deletion crates/egui_webview/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,15 @@ impl EguiWebView {
});
}

let screen_rect = ui.ctx().screen_rect();
let wv_height = screen_rect.height() * ui.ctx().zoom_factor();
let wv_rect = response.rect * ui.ctx().zoom_factor();

self.view
.set_bounds(wry::Rect {
position: Position::Logical(LogicalPosition::new(
f64::from(wv_rect.min.x),
f64::from(wv_rect.min.y),
f64::from(wv_height - wv_rect.max.y),
)),
size: Size::Logical(LogicalSize::new(
f64::from(wv_rect.width()),
Expand Down

0 comments on commit 455c26d

Please sign in to comment.