Skip to content

Commit

Permalink
Merge pull request #75 from urholaukkarinen/72-fix-egui-gizmo-viewport
Browse files Browse the repository at this point in the history
#72 Fixed egui gizmo rendering with the default viewport
  • Loading branch information
urholaukkarinen authored Jul 27, 2024
2 parents 08e8a51 + ce0dc0a commit 5be0854
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions crates/transform-gizmo-egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ impl GizmoExt for Gizmo {
ui: &Ui,
targets: &[Transform],
) -> Option<(GizmoResult, Vec<Transform>)> {
let config = self.config();

let egui_viewport = egui::Rect {
min: Pos2::new(config.viewport.min.x, config.viewport.min.y),
max: Pos2::new(config.viewport.max.x, config.viewport.max.y),
};

let cursor_pos = ui
.input(|input| input.pointer.hover_pos())
.unwrap_or_default();
Expand All @@ -80,6 +73,11 @@ impl GizmoExt for Gizmo {
viewport = ui.clip_rect();
}

let egui_viewport = Rect {
min: Pos2::new(viewport.min.x, viewport.min.y),
max: Pos2::new(viewport.max.x, viewport.max.y),
};

self.update_config(GizmoConfig {
viewport,
pixels_per_point: ui.ctx().pixels_per_point(),
Expand Down

0 comments on commit 5be0854

Please sign in to comment.