Giter VIP home page Giter VIP logo

Comments (3)

visr avatar visr commented on June 19, 2024

I tried to look into this a bit. Didn't get to any solution, but the additional info might be helpful.

For the case of node click handlers, nothing happens because of the last if statement below always being false. It seems that a click on a node used to give back the Scatter plot of the nodes, and now it returns a Mesh.

https://github.com/JuliaPlots/GraphMakie.jl/blob/cb19bae27141c32ded7a5ccafc6461edb69dae10/src/interaction.jl#L371-L374

In MakieOrg/Makie.jl#1658 mouse_selection was deprecated for pick, but replacing that doesn't work. Still it might be related. The new point picking docs are here: https://makie.juliaplots.org/stable/documentation/events/#point_picking

So what is this Mesh that it returns, and how do we get the Scatter plot of nodes back with pick (get_node_plot(gp::GraphPlot))?

from graphmakie.jl.

hexaeder avatar hexaeder commented on June 19, 2024

Thanks for bringing this up. I played around a bit but could not resolve it yet. Using the simple code below you can see that the interactions still work but the reportet elements are infact not the ones below the cursor but a bit offset. However both node and edge interactions work.

Maybe there is some problem with whether the mouse position is calculated with respect to the axis or the figure?

g = wheel_graph(10)
f, ax, p = graphplot(g,
                     edge_width = [2.0 for i in 1:ne(g)],
                     edge_color = [colorant"gray" for i in 1:ne(g)],
                     node_size = [10 for i in 1:nv(g)],
                     node_color = [colorant"red" for i in 1:nv(g)])
hidedecorations!(ax); hidespines!(ax)
deregister_interaction!(ax, :rectanglezoom)

function node_hover_action(state, idx, event, axis)
    p.node_size[][idx] = state ? 20 : 10
    p.node_size[] = p.node_size[] # trigger observable
end
nhover = NodeHoverHandler(node_hover_action)
register_interaction!(ax, :nhover, nhover)

function edge_hover_action(state, idx, event, axis)
    p.edge_width[][idx]= state ? 5.0 : 2.0
    p.edge_width[] = p.edge_width[] # trigger observable
end
ehover = EdgeHoverHandler(edge_hover_action)
register_interaction!(ax, :ehover, ehover)

from graphmakie.jl.

visr avatar visr commented on June 19, 2024

I checked, and this example now works well on the newly released Makie v0.17.4. Thanks for tracking the issue upstream!

from graphmakie.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.