-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix infinite loop on drawing of large labels #3228
Conversation
Some extra infoI'm afraid that this fix is going to be pretty tough to review, if you're relying on diffing. The goal of this refactoring is to make the code for the label splitting clearer. I have added unit tests to be sure that all is working as expected. This also tests the markup and tags for when using multi-fonts. The unit tests may be expanded in the future. |
I started testing and found a problem already :( @wimrijnders |
It only happens after the zoom exceed 1.2 |
@jmvenancio What exactly is the problem? What I see is that the particular subject of this fix works as expected. Perhaps you mean the 'flash' that happens when the node height is larger than the view height? And the whole view turns the color of the node? I would call this a separate issue, and to be honest not a very critical one. But perhaps you differ in opinion of this. |
@wimrijnders you're right. It is a different issue. Although it still does not work as expected, because on that particular case the width constraint is broken. And of course that is not a critical issue, I will continue testing but I'll mention this problem on the review. Thank you for all your work!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a new issue that was generated with this fix. I could not find any infinite loops and the text is correctly disposed inside the nodes. Although I think this can be accepted!
https://i.gyazo.com/6e9c441b4045c43a780ab2861a836458.mp4
Just found another problem, I'm not sure if this is ready to be merged like this.
@jmvenancio If it really bothers you, please make a new issue out of it. As for the second issue, you mean the overflow in the big rectangle on the left, right? I have to say you're very much stress-testing this fix. I would also say that that is a good thing. |
I am not really sure it is only about the height constraint. Notice on the left green box, the "a a a" goes out of the rectangle, on the other hand on the right green box the "bolas bolas" does not go out and it has a superior height. And I set the maximum height to the height of the small rectangles so, maybe two issues should be created. In my specific case this fix isn´t enough since I really want all the nodes to have the same size. Also I think that the maximum height constraint should always be respected, much like width constraint is with this fix... And maybe this is another issue... |
@jmvenancio Could you give me the code that made the previous screen dump? I'd like to examine that in more detail. |
@wimrijnders what's the status for this PR? Can it be reviewed? |
@yotamberk Yes, it can definitely be reviewed. The core issue here is the fix on infinite loop. The discussion here is about an edge case with respect to layout. @jmvenancio Could you open a new issue, please, for the overflowing of the big labels? I think it is worthwhile to pursue this, but not in the current PR. Thanks. |
Maintainers Note: This comment and resulting discussion moved to separate issue #3464. I experienced crashes thrown from LabelAccumulator:
This is happening every time a label, or a new line of the label, starts with a blank character followed by a word too large for the label width. |
* Code cleanup, for better understanding * Further refactoring; text processing to blocks in separate method * Added unit test for labels - tests standard text and html tags * Labels added unit tests for markdown * Further refactoring; made multi and regular handling more congruent * Interim save, not there yet * Unit tests done, first working version * Added test case with two big words * Code cleanup * Break up huge words into lines. * Restore unrelated code change
via @macleodbroad-wf, @wimrijnders (almende/vis#3228, almende/vis#3470, almende/vis#3486, almende/vis#3511, almende#3520) , almende#3518, almende#3575, almende#3565, almende#3603, almende#3646)
Fix for #3171 and #3185.
This can lock up
Network
due to the infinite loop, so I feel that the PRIORITY label is in order here. You can't have that happening in cases that users would regard as 'normal usage'.The actual fix for the issue (see above) is the code in function
splitStringIntoLines()
.Changes:
LabelAccumulator
toLabel.js
. This moves away recurring actions within the main loops of the label handling.Label._processLabelText()
widthConstraint.maximum
.