-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to force a relayout? #854
Comments
Currently the paragraph graphic is refreshed by RichTextFX if either the paragraph index or paragraph factory changes. The graphic is also refreshed when JavaFX detects a change to the scene graph, which is basically what you are triggering. So I'm thinking of adding a method that will recreate a specific paragraph graphic, something like: What do you think ? Which method name is preferable ? |
Alternatively you could use |
Sorry for the delay, it's been a busy week. I think "recreate" would probably be better since it more closely represents the intent/purpose of the method. Also, would you be able to add a "getParagraphGraphic(int)" method that will return the current paragraph graphic for a paragraph. I currently have a convoluted mess of caching and scene watching in place to try and get the current paragraph graphic for a paragraph. My use case is that the user clicks on something outside of the editor and that will open a popup at the location of a node in the paragraph graphic. See below. In this case the user clicked on "Item 1" in the tree in the left hand pane and the editor jumps to the correct location for the item and then displays a popup next to the appropriate icon. |
Could you maybe try this out and see if it works for you ? |
Yep they both work well, thanks for adding them. |
Great, I've fixed the typos in a new PR. |
I've asked a similar question to this before: #839 but I now have a different use case that I can't get around by setting a style.
In this case I am modifying what is drawn in a paragraph graphic when the user makes a change in the text. Specifically I am drawing a line in the paragraph graphic to match where the user selected a position in the text. See the image below:
The grey area is the paragraph graphic, the blue line is the "marker" to indicate how far into the text the user has edited.
My issue is that when the user changes the "edit position" I need to also update the marker but the marker is only changed on the next layout pass. I tried calling "requestLayout" on the area and the paragraph graphic but neither caused another layout.
So any suggestions on how to force a layout?
(Note: I do have a workaround but it involves a nasty removing/adding of a component to the graphic which is FAR from ideal, I'd ideally like to have a proper way of handling this situation, especially since I have a number of use cases that have the same issue.)
The text was updated successfully, but these errors were encountered: