-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Network: nodes.widthConstraint: similar min/max values cause infinite loading loop #3171
Comments
Got a fix on the infinite loop. It's in In a nutshell: while (w < words.length) {
...
if ((measure.width > this.fontOptions.maxWdt) && (lastMeasure.width != 0)) {
// Do things here, variables in if() don't change
// w not incremented!
} else {
// Do other things here
w++;
}
} A situation occurs that the if-condition always holds and thus is always entered. Variable @cityy Great catch, and thanks for supplying instructions to reproduce. Here, have a virtual beer on me 🍺. |
@wimrijnders My pleasure! |
I also fond similar behavior.
same thing is happening |
|
Letting you know that I'm working on this. It's a really tough issue to solve, even though the problem appears simple when asked. The thing is, it's pretty convoluted code, and I find myself cleaning it up and refactoring just to understand it. I also intend to add some unit tests to be sure that all is working as expected. So please bear with me; this is one that I can not fix trivially. |
In the original test case, the problem is with the text 'big triangleDown'. In
What to do about this: I think the best strategy here is, if a single-word line is already too big, add it anyway. This is in effect @satyajitsinh's observation 1., but for multiple-word labels. It does mean that the max width can be broken. Feel free to add feedback for this! |
Just thinking about alternatives, maybe one would be this: Trimming words like 'triangleD..' and overgo max width when the node is selected so it displays the full word only when the node is selected. For example: I'm rendering a |
It sounds very sensible, although the example is not fully clear to me. Would you care to make it more specific? I can image alternative approaches to label handling to be options. So, the current label drawing is the default, but what you describe can be selected if required. |
This is to notify you I have a fix ready for this issue. However, due to its extensive changes, I am going to publish it in a PR after the upcoming next release, which is planned for june 24th '17. This is to not unnecessarily burden the maintainers making the release. I hope you have understanding for this. Update 2017-07-03: The new version |
@wimrijnders thanks for your great support. |
@satyajitsinh thank you for your support! I should mention that, after giving it thought, I came to the conclusion that words larger than max width should be broken into multiple lines. Please see the discussion in #3185. Breaking up the big words is going to be part of the PR that fixes this issue. Options for label handling will be something for the future; I haven't changed my mind about that, I just want to get this and other essential stuff done first. |
Sorry for the late reply, I was a bit occupied with other things. Maybe the particular example is not so important. I generally find it inconsistent that the way to control the size of nodes depends on what shape the node has. IMO; it would be more elegant to have size management standardized and offer options like "inherit from label size". |
@cityy OK, so let's enumerate the options here. This is what I can think of now and which looks useful:
Feel free to make your own suggestions.
I think you mean that e.g. option |
That's the behaviour I am referring to. Size should set the size, no matter what shape, for the sake of consistency. That way widthConstraint would become obsolete (there could still be something like min/max-size if required). Inheriting size from Label should be an option that can be true by default and considers min- / max-size. |
@cityy I find that a very reasonable question; would you mind making an issue for that? It's a bit out of the scope of current issue. Please refer to this issue. |
Is there any way to know when will be released new version with this fix? |
@AndrewMut Next release is in about two weeks time; but please don't take that literally, the dates are flexible and depend on the availability of the releasers. |
Creating a network with similar minimum/maximum values for nodes.widthConstraint causes an infinite loading loop. I stumbled across the issue trying to set circle shape nodes to all have the same size.
The following fails to load:
I've been able to reproduce the issue by simply modifying the Network Node Shapes example: http://visjs.org/examples/network/nodeStyles/shapes.html
It's really weirdly breaking if min/max values get too close to each other:
Update: Just a note. The exact values that cause it to fail differ between my current project and the node shapes example.
The text was updated successfully, but these errors were encountered: