This repository was archived by the owner on Sep 4, 2024. It is now read-only.
Fixes issue rendering when node is collapsed and text has new lines#794
Open
netonjm wants to merge 2 commits into
Open
Fixes issue rendering when node is collapsed and text has new lines#794netonjm wants to merge 2 commits into
netonjm wants to merge 2 commits into
Conversation
slluis
reviewed
Mar 6, 2018
|
|
||
| var node = store.AddNode ().SetValue (nodeField, new TextNode ("Root 1")); | ||
| var child = node.AddChild ().SetValue (nodeField, new TextNode ("Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text.")); | ||
| var child = node.AddChild ().SetValue (nodeField, new TextNode ($"Very long text with NewLines. {Environment.NewLine} Very long text with NewLines.{Environment.NewLine} Very long text. Very long text. Very long text. Very long text.")); |
Member
There was a problem hiding this comment.
Just use "\n", no need to embed a call to Environment.NewLine.
slluis
reviewed
Mar 6, 2018
| status.LastCalculatedHeight = textSize.Height; | ||
| //in cases when there are multiple lines and they don't execeed the max width we need to care height include the expand | ||
| double height = textSize.Height; | ||
| if (!status.Expanded && textSize.Height > defaultHeight) { |
Member
There was a problem hiding this comment.
This can be simplified. If there are multiple lines, just measure the height of the first line.
sevoku
reviewed
Mar 7, 2018
| public ExpandableTextCellView () | ||
| { | ||
| var defaultLayout = new TextLayout() { Text = "A" }; | ||
| defaultHeight = defaultLayout.GetSize().Height; |
Member
There was a problem hiding this comment.
This won't work correctly. Because it doesn't take all possible glyphs into account. For example the height of A is smaller than the height of Ag. It's not possible to measure the final height at this point.
Better measure the first line, as proposed here: https://github.com/mono/xwt/pull/794/files#r172651546
| // Text doesn't fit. We need to render the expand icon | ||
| if (textSize.Width > cellArea.Width || textSize.Height > cellArea.Height) { | ||
|
|
||
| if (textSize.Width > cellArea.Width || textSize.Height > cellArea.Height) { |
Author
There was a problem hiding this comment.
ups! probably do it at the end of the day could be a great reason :)
It happens when text doesn't exceed the maxwidth and we have multiple lines because the new lines
3f791fb to
e7d5a5d
Compare
Contributor
|
What should we do about this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue rendering when node is collapsed and text has new lines
It happens when text doesn't exceed the maxwidth and we have
multiple lines because the new lines