Skip to content
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

controlling text area height dynamically based on content. #77

Closed
ghost opened this issue Aug 17, 2014 · 6 comments
Closed

controlling text area height dynamically based on content. #77

ghost opened this issue Aug 17, 2014 · 6 comments

Comments

@ghost
Copy link

ghost commented Aug 17, 2014

Hi Tomas, I was wondering if it is possible to control the hieght of the text area dynamically by its content( number of lines and sizes if characters) as well as the width of the area. In a sense, I don't want a vertical scroll bar, but rather I want the text area height to grow based on the text itself and the width of the text area.

Is there a way to do this?
Thanks
Maher

@TomasMikula
Copy link
Member

Hi Maher,
this is not possible. How would you handle large files that exceed the size of the screen?
Tomas

@ghost
Copy link
Author

ghost commented Aug 20, 2014

Hi Tomas,
I was planning to a combine a document using different text areas by
appending the styled docs from each to a new one. But I would like to allow
the user to edit the assembled view. A way to do that is to track where the
user entered text but that proved to be tricky (at least for me). So as a
work around I could move the text areas into a single scroll pane inside a
VBox. This way I can scroll the overall view. And I can keep track of where
the user edited text(which part in the assembly). But I need to allow the
text area to increase its height to expand and push down text areas that
under it in the VBox. In my case, the window width will be fixed. So text
area width is based in window width and height would be determined by the
content.

Is there a way I can determine the preferred height (which you use to
control the vertical scroll bar) from the current API? So that I always
adjust it when the text changes and eventually have the text area expanded
to the height needed?

Thanks
Maher

On Aug 20, 2014 5:50 AM, "TomasMikula" notifications@github.com wrote:

Hi Maher,
this is not possible. How would you handle large files that exceed the
size of the screen?
Tomas


Reply to this email directly or view it on GitHub.

@TomasMikula
Copy link
Member

Hi Maher,

I see what you are trying to do. Unfortunately, there is no API to get the full height of the text. In fact, the real height of the text is not even known exactly. This sounds strange, but it is for performance reasons. Paragraphs that don't fit into the viewport are not rendered at all, thus their height is not computed. Scrollbars are currently updated based on an estimate that is computed based on the height of the visible paragraphs. This saves a lot of time and memory for large files. What you are trying to do would give up all these savings. However, not even the estimate is accessible through the API.

@ghost
Copy link
Author

ghost commented Aug 20, 2014

Thanks for the update, Tomas. It makes sense.

On 20/08/2014 3:37 PM, TomasMikula wrote:

Hi Maher,

I see what you are trying to do. Unfortunately, there is no API to get
the full height of the text. In fact, the real height of the text is
not even known exactly. This sounds strange, but it is for performance
reasons. Paragraphs that don't fit into the viewport are not rendered
at all, thus their height is not computed. Scrollbars are currently
updated based on an /estimate/ that is computed based on the height of
the visible paragraphs. This saves a lot of time and memory for large
files. What you are trying to do would give up all these savings.
However, not even the estimate is accessible through the API.


Reply to this email directly or view it on GitHub
#77 (comment).

@JordanMartinez
Copy link
Contributor

This might be possible if one could determine the bounds of the visible paragraphs and adjust the area's size (up to a maximum/minimum size) whenever the visible paragraphs change.

@Jugen
Copy link
Collaborator

Jugen commented Nov 5, 2020

Closed via PR 944

@Jugen Jugen closed this as completed Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants