-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Node stops obeying widthConstraint after hover / blur #3928
Comments
Also experiencing this problem. No idea how to remedy the issue... |
I'm also running into this. Gonna take a look at the code and see if I can find the root cause... |
I'm running into this as well. Hopefully we can find a solution. @moppius did you find anything in the library? |
I did a bit of debugging and it looks like the issue is a difference between the results returned from The measurements returned for the same text string return much lower values when the node is not in hover state (only after the first hover, though - so it must be initialized correctly). This leads the LabelSplitter to think that the text is much narrower than it really is when deciding how to split up the line, so it puts line breaks in the wrong place. Context ProblemThe root of the problem is that the context's I'll keep looking to see if I can find out where the context is changing for this. UpdateA bit closer to the problem, it looks like when the mouse is over the node, the shape class's Update 2I'm starting to get a headache now, but I think the problem is in the logic of NodeBase's Update 3 - workaround/hack fixI've managed to "fix" it by making the Label's I suppose the problem might be that the Node's However, I feel like the real issue might be that any Node's Update 4 - suspicious thingsOK, a better "fix" for this issue (although probably introduces other issues elsewhere) is to remove all the calls to Deleted commitI committed a fix yesterday but it was not a good one. See newer comments for more recent fix. |
Hmm, this seems to be fundamentally complicated by the architecture of drawing Edges before drawing Nodes. I can see a few ways of fixing this:
I don't want this to become a massive re-architecture project just to fix one bug, but I will investigate each of these options more to see what makes the most sense. |
OK, I've got a slightly less invasive fix for now, that fixes all the cases I can see. I reverted my previous change since it was changing behaviour in other places, and instead I just set the font size and face in the So my new change just ensures that So yeah, this new commit should fix the issue in all known cases if anyone wants to try it out! 😅 |
This fixes labels being split along the wrong lines. It doesn't take font modifiers into account, though, so still might be wrong in some circumstances. Just less wrong than before. Fixes almende#3928 for the most part. Arrowheads on edges can still be slightly misaligned in some cases.
thanks for working on that @moppius, i'm going to try to implement your fix. i'll let you know if i have anything to add to it! |
seems to be working great, thanks again @moppius |
This looks like a duplicate of #3872 . |
I've created a small jsfiddle that shows the issue:
https://jsfiddle.net/re61t898/13/
Initially, the graph is rendered correctly. However, once you hover over the second node and then blur it, the node will lose its width constraint. Curiously enough, if you hover over it again, it will get it back, but lose it again once you blur it.
The text was updated successfully, but these errors were encountered: