netwulf icon indicating copy to clipboard operation
netwulf copied to clipboard

When nodes are dragged, labels stay on for that node

Open nwlandry opened this issue 5 years ago • 6 comments

Not sure if I am interacting with netwulf incorrectly, but after running the following code,

import networkx as nx
from netwulf import visualize

G = nx.barabasi_albert_graph(100,2)

visualize(G)

with "Display labels" off, when I drag a node in the visualization, the label stays on the node, even if I click it again. If I don't drag the node, then I can toggle the label on and off just fine. The only way to hide the label on that node again is to turn on the "Display labels" and then turn it off again.

Very minimal importance, but it was unexpected behavior, so I figured I would bring it up.

Great project!

nwlandry avatar Jul 24 '19 00:07 nwlandry

hi! yes, this annoys me as well. Thanks for bringing it up. We'll make sure to address this soon-ish!

benmaier avatar Jul 24 '19 08:07 benmaier

It because a drag event is unavoidably also a click event in d3. I tried fixing this a while back but dropped it because of more important issues. The easy fix is to just check if the node moved before a node gets a label, but I need to sit down and implement it in a good way. Traveling at the moment, but will see to this in a matter of weeks.

ulfaslak avatar Jul 24 '19 11:07 ulfaslak

maybe we could switch labels on and off by pressing 'L' when hovering?

benmaier avatar Jul 25 '19 15:07 benmaier

I see. You want to substitute a mouseclick for an 'L' click?

ulfaslak avatar Jul 25 '19 19:07 ulfaslak

I'll admit it's not very intuitive

benmaier avatar Jul 25 '19 19:07 benmaier

I understand why a drag event is also a click event, but my bigger question is, Why can't you toggle off the label if the node has been dragged, while you can if it's a simple click?

nwlandry avatar Jul 26 '19 15:07 nwlandry