Mouse Picking



using Makie

img = rand(100, 100)
scene = Scene(resolution = (500, 500))
heatmap!(scene, img, scale_plot = false)
clicks = Node(Point2f0[(0,0)])
on(scene.events.mousebuttons) do buttons
   if ispressed(scene, Mouse.left)
       pos = to_world(scene, Point2f0(scene.events.mouseposition[]))
       push!(clicks, push!(clicks[], pos))
   end
   return
end
scatter!(scene, clicks, color = :red, marker = '+', markersize = 10)
RecordEvents(scene, "output")