mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
TextEditor: Change caret positioning when clicking before text and between lines
This commit fixes an issue when using large lineSpacing, where the caret would jump to the end of the previous line when clicking between lines. With the new behaviour the line spacing is considered to belong to the previous line. The commit also changes the behaviour observed when clicking in the empty space before the first line. Until now the caret would jump into the first character position. Now it behaves as if the space before the first line would belong to the first line.
This commit is contained in:
parent
886ee724de
commit
d564e49312
1 changed files with 2 additions and 2 deletions
|
|
@ -2614,9 +2614,9 @@ int TextEditor::indexAtPosition (const float x, const float y) const
|
|||
{
|
||||
for (Iterator i (*this); i.next();)
|
||||
{
|
||||
if (y < i.lineY + i.lineHeight)
|
||||
if (y < i.lineY + (i.lineHeight * lineSpacing))
|
||||
{
|
||||
if (y < i.lineY)
|
||||
if (jmax (0.0f, y) < i.lineY)
|
||||
return jmax (0, i.indexInText - 1);
|
||||
|
||||
if (x <= i.atomX || i.atom->isNewLine())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue