Id like to add points to a GLMakie plot when holding down the keyboard letter “a” and then holding down the left mouse button. The docs have a good demo on how to do this with a click (Point Picking). However when I change Mouse.press
to Mouse.down
the zoom action occurs. Any idea how to turn off the zoom action?
Here is my code:
using GLMakie
positions = Observable(rand(Point2f, 10))
fig, ax, p = scatter(positions)
on(events(fig).mousebutton, priority = 2) do event
if event.button == Mouse.left && event.action == Mouse.down
if Keyboard.d in events(fig).keyboardstate
# Delete marker
plt, i = pick(fig)
if plt == p
deleteat!(positions[], i)
notify(positions)
return Consume(true)
end
elseif Keyboard.a in events(fig).keyboardstate
# Add marker
push!(positions[], mouseposition(ax))
notify(positions)
return Consume(true)
end
end
return Consume(false)
end