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

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

Merged
merged 1 commit into from
Dec 26, 2016

Conversation

JFormDesigner
Copy link
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
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
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
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