From the tutorial
Interactive data visualizations with Makie.jl | Simon Danisch & Julius Krumbiegel | JuliaCon 2022 - YouTube
I learned that the package Makie.jl is very nice and powerful. It can quickly update the plot when the mouse drags a vertex to a new location.
My question is that how I can get the new coordinates of the vertex when I release the left button of the mouse to use in another step of calculation?
After studying the code of the tutorial
JuliaCon2022Makie/graph-app.jl at master · jkrumbiegel/JuliaCon2022Makie · GitHub
I found the solution for my problem. Thinking that it might be helpful for other people, I would like to post it here. The answer was already in the code
points = [Point2f(sin(r), cos(r)) for r in LinRange(0, 2pi - (pi/5), 10)]
connections = [(i, mod1(i + 1, 10)) for i in 1:10]
fig, ax, pl = graphplot(points, connections, axis=(aspect=DataAspect(),))
The new coordinates of the vertex are stored in the variable
The situation becomes more difficult for me if the variable
points is fed to a function. For example
modified_coords = 2points
When I drag a vertex to another position, its coordinates are updated immediately in the
points, but not in
modified_coords. How can I update interactively the variable
modified_coords whenever I drag a vertex to new position?