Skip to content

Commit

Permalink
set all event priorities to 50 to be beneath menu a 65 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored Aug 20, 2024
1 parent b920b37 commit 0855af7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/geometry_canvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ function draw_current_point!(fig, ax::Axis, c::GeometryCanvas;
end
end
p = scatter!(ax, current_point_pos; color=:red, scatter_kw...)
translate!(p, 0, 0, 100)
translate!(p, 0, 0, 50)
end

# Point selection and movement
Expand All @@ -427,7 +427,7 @@ function add_events!(c::GeometryCanvas{<:Point};


# Mouse down event
on(events(ax.scene).mousebutton, priority=-100) do event
on(events(ax.scene).mousebutton, priority=50) do event
# If this canvas is not active dont respond to mouse events
(; geoms, points, dragging, active, section) = c
active[] || return Consume(false)
Expand Down Expand Up @@ -472,7 +472,7 @@ function add_events!(c::GeometryCanvas{<:Point};
end

# Mouse drag event
on(events(fig).mouseposition, priority=100) do event
on(events(fig).mouseposition, priority=50) do event
c.active[] || return Consume(false)
idx = c.current_point
_isvalid_current_point(idx) || return Consume(true)
Expand All @@ -498,7 +498,7 @@ function add_events!(c::GeometryCanvas{<:Point};
return Consume(false)
end

on(events(ax.scene).keyboardbutton, priority=100) do event
on(events(ax.scene).keyboardbutton, priority=50) do event
(; geoms, points, active, section) = c
active[] || return Consume(false)
(event.action in (Keyboard.press, Keyboard.repeat) && event.key == Keyboard.delete) || return Consume(false)
Expand All @@ -523,7 +523,7 @@ function add_events!(c::GeometryCanvas{T};
accuracy = _accuracy(ax, c.accuracy_scale)

# Mouse down event
on(events(ax.scene).mousebutton, priority=100) do event
on(events(ax.scene).mousebutton, priority=50) do event
(; geoms, points, dragging, active, section) = c

active[] || return Consume(false)
Expand Down Expand Up @@ -618,7 +618,7 @@ function add_events!(c::GeometryCanvas{T};
end

# Mouse drag event
on(events(fig).mouseposition, priority=100) do mp
on(events(fig).mouseposition, priority=50) do mp
c.active[] || return Consume(false)
idx = c.current_point
_isvalid_current_point(idx) || return Consume(true)
Expand Down
4 changes: 2 additions & 2 deletions src/paint_canvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ end
function add_mouse_events!(fig::Figure, ax::Axis, c::PaintCanvas)
lastpos = Observable{Any}()
(; drawing, drawbutton, active) = c
on(events(ax.scene).mousebutton, priority = 100) do event
on(events(ax.scene).mousebutton; priority=50) do event

# If this canvas is not active dont respond to mouse events
active[] || return Consume(false)
Expand Down Expand Up @@ -121,7 +121,7 @@ function add_mouse_events!(fig::Figure, ax::Axis, c::PaintCanvas)
end

# Mouse drag event
on(events(fig).mouseposition, priority = 100) do event
on(events(fig).mouseposition; priority=50) do event
active[] || return Consume(false)
if drawing[]
fig_pos = Makie.mouseposition_px(fig.scene)
Expand Down

0 comments on commit 0855af7

Please sign in to comment.