Skip to content

Fix computing hit character if padding is set on the paragraph-text#396

Merged
TomasMikula merged 1 commit intoFXMisc:masterfrom
JFormDesigner:padding-hit-fix
Dec 26, 2016
Merged

Fix computing hit character if padding is set on the paragraph-text#396
TomasMikula merged 1 commit intoFXMisc:masterfrom
JFormDesigner:padding-hit-fix

Conversation

@JFormDesigner
Copy link
Copy Markdown
Contributor

This PR fixes computing hit character (at mouse press) if padding is set on the paragraph-text.

To reproduce this, apply a large padding (as below), click at some text in the styled text area and see where the caret is positioned. Without this fix the caret is always some characters right to the click location.

.styled-text-area .paragraph-box .paragraph-text {
    -fx-padding: 0 10em 0 10em;
}
.styled-text-area .paragraph-box:first-paragraph .paragraph-text {
    -fx-padding: 10em 10em 0 10em;
}
.styled-text-area .paragraph-box:last-paragraph .paragraph-text {
    -fx-padding: 0 10em 10em 10em;
}

… paragraph-text

To reproduce this, apply a large padding (as below), click at some text in the styled text area and see where the caret is positioned. Without this fix the caret is always some characters right to the click location.

.styled-text-area .paragraph-box .paragraph-text {
    -fx-padding: 0 10em 0 10em;
}
.styled-text-area .paragraph-box:first-paragraph .paragraph-text {
    -fx-padding: 10em 10em 0 10em;
}
.styled-text-area .paragraph-box:last-paragraph .paragraph-text {
    -fx-padding: 0 10em 10em 10em;
}
JFormDesigner pushed a commit to JFormDesigner/markdown-writer-fx that referenced this pull request Nov 18, 2016
…TextFX FXMisc/RichTextFX#396

also moved :first-paragraph below :last-paragraph to fix top padding in case editor contains only one line
@TomasMikula
Copy link
Copy Markdown
Member

Sorry for late response. This looks good to me! 👍 Should also fix #285. I suggest we wait a bit for #356 to be merged, as this one should be easier to rebase.

@afester
Copy link
Copy Markdown
Collaborator

afester commented Dec 25, 2016

@JFormDesigner very cool ! I came across the same issue some days ago, and now its already fixed 👍

@TomasMikula TomasMikula merged commit e8f4107 into FXMisc:master Dec 26, 2016
@TomasMikula
Copy link
Copy Markdown
Member

No merge conflict after all :)

@JFormDesigner JFormDesigner deleted the padding-hit-fix branch January 2, 2017 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants