Skip to content

Commit

Permalink
fix canvas scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
fralonra committed Aug 10, 2023
1 parent fb5a1dc commit 563a651
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/editor/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@ impl EditorApp {
self.actions.push_back(Action::CursorMoved(None));
}

if !self.has_modal_open() && !self.has_drag_value_focused && viewport_resp.hovered()
{
let is_viewport_hovered = ui
.ctx()
.pointer_hover_pos()
.map(|pos| viewport_rect.contains(pos))
.unwrap_or_default();

if !self.has_modal_open() && !self.has_drag_value_focused && is_viewport_hovered {
ui.input(|i| {
let zoom_delta = i.zoom_delta();
if zoom_delta != 1.0 {
Expand Down

0 comments on commit 563a651

Please sign in to comment.