04-08-2019 18:56
04-08-2019 18:56
I know I can decide how a textarea object is displayed if the amount of text (with a given font/line height) overruns the screen area (the text can either be truncated, or an ellipsis can be displayed).
I want to provide a way for the user to tap the screen if there is an overrun to see more of the text, but if there is no overrun, I don't want the tap option available.
Is there any way to programmatically detect when this happens? It will take me a very, very long time to check every text value to be sure it fits on both Versa and Ionic, and record that in a data field for each text value to then know if I need to offer the tap option.
Thanks!
Answered! Go to the Best Answer.
04-08-2019 19:04
04-08-2019 19:04
See what you can do with textOverflowing.
Failing that, you could do something clever with getBBox().
04-08-2019 19:04
04-08-2019 19:04
See what you can do with textOverflowing.
Failing that, you could do something clever with getBBox().
04-08-2019 23:31
04-08-2019 23:31
readonly textOverflowing
I think I read that part of the docs 4 or 5 times and I just didn't see it. Thanks!!
04-09-2019 23:30
04-09-2019 23:30
What I have noticed, however, is that sometimes it overruns but doesn't register an overrun. By that I mean, I see the ellipsis, and text is being cut-off, but textOverflowing is still false.
I'll have to experiment. I'm seeing some patterns with the wrapping... if there are large gaps that are left when words wrap this tends to happen more often.
If I find more about its behavior I'll come back and report.
04-10-2019 11:59 - edited 04-10-2019 11:59
04-10-2019 11:59 - edited 04-10-2019 11:59
More discoveries:
For textarea objects when you're trying to find out if the text has over-run it, it seems that the textOverflowing value doesn't always jump to true every time you see the ellipsis, or when text is truncated (depending on your textOverflow setting is).
Except, it seems to work if the size of the textarea is 100% by 100%. Then the textOverflow works perfectly.
04-10-2019 13:07
04-10-2019 13:07
Interesting.
I wonder if it would work if you set the size to 100%, but constrained it within a <section>.