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

paragraph-box padding works incorrectly #508

Closed
AlexP11223 opened this issue May 26, 2017 · 10 comments
Closed

paragraph-box padding works incorrectly #508

AlexP11223 opened this issue May 26, 2017 · 10 comments
Labels

Comments

@AlexP11223
Copy link
Contributor

Looks like left padding of .paragraph-box adds spacing at the right, and top padding adds spacing at the bottom.

.virtualized-scroll-pane .styled-text-area .paragraph-box {
    -fx-padding: 15px 90px 60px 80px;
}

(look at horizontal scrollbar)

.virtualized-scroll-pane .styled-text-area .paragraph-box {
    -fx-padding: 15px 0 60px 80px;
}

.virtualized-scroll-pane .styled-text-area .paragraph-box {
    -fx-padding: 15px 0 60px 0;
}

.virtualized-scroll-pane .styled-text-area .paragraph-box {
    -fx-padding: 15px 0 0 0;
}

@JordanMartinez
Copy link
Contributor

Thanks. That does make things clearer now.

@JordanMartinez
Copy link
Contributor

Here's the layout code in ParagraphBox:

    @Override protected void layoutChildren() {
        Bounds bounds = getLayoutBounds();
        double w = bounds.getWidth();
        double h = bounds.getHeight();
        double graphicWidth = getGraphicPrefWidth();

        text.resizeRelocate(graphicWidth, 0, w - graphicWidth, h);

        graphic.ifPresent(g -> g.resizeRelocate(graphicOffset.get(), 0, graphicWidth, h));
    }

However, if we fix the left padding issue, there's nothing clipping the line. For example, given a padding of 30px where the mouse marks where the padding ends...

...and content is scrolled completely to the left
untitled window_006

...and content is scrolled completely to the right
untitled window_007

@JordanMartinez
Copy link
Contributor

Accounting for padding here will also affect any hit-related code

@JordanMartinez
Copy link
Contributor

@AlexP11223 Adding padding to this can be done, but do you expect the padding to cover the text when one scrolls to the right?

@AlexP11223
Copy link
Contributor Author

I don't know, I solved my original problem using different approach (adding insets handling to the pane, #507). And for that problem I actually wanted to add padding for paragraph + line numbers, not just for text.

@JordanMartinez
Copy link
Contributor

Ah... it seems I misread you then. So you want to add padding to the box itself (which currently doesn't work for top/left padding values), not necessarily the text itself, right?

@AlexP11223
Copy link
Contributor Author

Yeah. But I don't know if it would be correct behavior for this padding, and seems like my problem can be solved without it.

@JordanMartinez
Copy link
Contributor

I don't know if it would be correct behavior for this padding

What do you mean?

@AlexP11223
Copy link
Contributor Author

That I don't know how it supposed to work by design.
For my original problem pane padding is probably better solution than paragraph padding.

@JordanMartinez
Copy link
Contributor

Ok, so the original issue you raised is, you think, better resolved by the other approach, correct?

Still, I think the desired functionality here should be implemented. Someone else might want to use it for various things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants