Can someone please show me how to get the location of a mouse left click on a Makie.jlscene ?
Here’s what I have now:
using Makie
img = rand(100,100)
scene = Scene(resolution = (100, 100))
heatmap(img)
Makie.add_mousebuttons(scene)
pos = lift_node(scene, :mouseposition) do mpos
if ispressed(scene, Mouse.left)
return mpos
end
end
I have, but I couldn’t figure out how to get the mouse position from just one click.
Also, in your example here (thank you btw), I can’t get the position without needing to move the mouse first, while holding down the mouse button. All I want is to click somewhere on the image and get the location of that click (in some variable I can access - a Signal perhaps).
what is the modern equivalent of this? I keep getting the exception **cannot resize array with shared data**
polygon = Node([ SVector(0.0,0.0),SVector(5.0,0.0),SVector(5.0,5.0) ])
poly!(ax, polygon, color=RGBA(0,1,0,0.1), strokecolor=:black)
on(scene.events.keyboardbuttons) do button
if ispressed(button, Keyboard._1)
polygon[] = append!(polygon[],[SVector(mouseevents.obs.val.data...)])
end
end