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

How to remove the rectangles around selected lines ? #738

Closed
alexdiostia opened this issue Apr 28, 2018 · 5 comments · Fixed by #873
Closed

How to remove the rectangles around selected lines ? #738

alexdiostia opened this issue Apr 28, 2018 · 5 comments · Fixed by #873

Comments

@alexdiostia
Copy link

Hello
new to RichTextFX... looks great!
Is it possible to remove the "line boxing" when selecting text over multiple lines ?
it looks weird to have each line separately surrounded by those rectangles..
thanks !
alex

@alexdiostia alexdiostia changed the title How to remove the rectangles around selected lines How to remove the rectangles around selected lines ? Apr 28, 2018
@JordanMartinez
Copy link
Contributor

Which version of RTFX are you using? Which flavor of GenericStyledArea are you using? What's your CSS for the selection style class? Can you provide a screenshot of the issue so I'm sure I'm understanding you correctly?

In short, if you change the selection's style class to something else, it should get rid of the 'line boxing' you're talking about (unless you're referring to something like #683)

@saifalmutory
Copy link

do you mean this?
1
Well I'm having the same problem.

@saifalmutory
Copy link

I think the reason is use:
getStylesheets().clear();
For this reason the style should not be cleared.

@JordanMartinez
Copy link
Contributor

When rendering elements onto the screen, they must be rendered in a specific order so that one thing appears to be laid 'on top of' another thing. In 0.9.0, this is the order of elements:

[background]
background color of area
background color of paragraph
background color of text
selection
the text itself
underline
[foreground]

Given the above, a ParagraphText is responsible for putting the selection in its children in the correct order, so that it appears underneath the text but above the text's background color. However, that comes at the cost of not being able to use one node for each selection when a selection spans multiple paragraphs. In such a case, the portion of the selection that appears in one paragraph gets rendered with one node. So, given the following text and selection, where [ and ] represent the start/end of the selection:

some [text
some text
some t]ext

three nodes are rendered to make the selection appear seamless: one for text, another for some text and one for some t.
Each portion of the selection is rendered using Path objects that all share the same style class. As a result, if one uses the following CSS, it will generate the above issue:

.styled-text-area .selection {
    /* stroke's color not defined here since it defaults to black */
    -fx-stroke-width: 2;
}

@Jugen Jugen closed this as completed May 23, 2019
@appsofteng
Copy link

This problem happens on RichTextFX 0.10.2 OpenjFX 13.0.1 OpenJDK 13.0.1. Windows 7

When a selection is started with a mouse and the mouse keeps dragging until the scrollbar moves automatically to show the next part of the document then suddenly small space appears between the lines and the selection is no longer solid but has these tiny lines.

It does not happen when you select using keys because the selection with keys is growing line by line.
With mouse the selection jumps several lines when the edge of the visible part of the document is reached.

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

Successfully merging a pull request may close this issue.

5 participants