-
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
Get BoundingBox of letters in StyledTextArea #150
Comments
You are correct, it would require some reflection hacks and the implementation would be similar to This is another example of a feature that is hard to support in the current unfortunate Control/Skin architecture, where the Control (i.e. the text area) is supposed to be the model in the MVC terminology and Skin is the view. Only Control (i.e. model) API is exposed to the user, so there is no direct access to the Skin. I started a discussion about this on the JavaFX mailing list, but nothing really has come out of it. My plan is to switch to not using skins in RichTextFX at all whenever I find the time to do the refactoring. Even then, though, it seems to me that what you would want is more like getting an |
This is another issue that you should be able to implement now that the skin has been removed in 3f00de3. |
Awesome, thanks, will take a look! |
This definitely helps! As Tomas noted, there are still parts that are a whole other story to get this done. I hacked away and made some changes and it partially works. If there is any interest, I can submit via a pull request (would love to get feedback and suggestions for improvement!), but here's the gist of what I hacked away. Added to my subclass of CodeArea:
|
I've only glanced through this, but I will look through it more later on. |
Ok, I see what you're doing now and why that would be useful. |
Cool, will fork and checkin maybe tomorrow. |
OK checked into here https://github.com/kushal256/RichTextFX If there is any interested I can submit this as a pull request. I'm open to any suggestions/cleanups of the code. |
Can you also write a small demo that demonstrates your feature? |
Yes, will do soon, need to cleanup my code. FYI the reason I'm trying to get a BoundingBox is so I can draw my own components on top of specific words, and these components can receive keyboard/mouse events. This way I can create custom GUI widgets that interconnect two separate chunks of text. |
Cool.
Yeah, I remember you saying something like that beforehand:
I thought it'd be interesting to see what that would look like in a program. 😄 |
Same here ;) If I had something complete enough to show, it would be public by now. Besides the bugs and working out kinks, I'm still trying to figure out what kinds of custom components to draw. My current ones need polish, and look really ugly when there are too many on the screen simultaneously. Will try to push out a proof-of-concept soon. |
@kushal256 Any updates on this? |
Closed by #455. |
Is it possible to get BoundingBox of letters within a StyledTextArea? Looks like this would require access to package private related classes like StyledTextAreaView and VirtualFlow? The implementation might be very similar to StyledTextAreaView::getSelectionBoundsOnScreen(), but not really sure?
My end goal was to build graphical connections (like arrows) between two words that each live in a different StyledTextArea's. Is something like this possible?
The text was updated successfully, but these errors were encountered: