Skip to content

Commit

Permalink
Implemented text wrapping for Text
Browse files Browse the repository at this point in the history
  • Loading branch information
salmonb committed Oct 22, 2023
1 parent df5ee88 commit 21f3cff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public void updateTextFill(Paint textFill) {

@Override
public void updateWrapText(boolean wrapText) {
//if (doesSkinRelyOnPeerToProvideVisualContent()) { // Commented as we want the expected code below to be applied on Label (check if this test should be definitely removed)
if (doesSkinRelyOnPeerToProvideVisualContent()) { // Note: for LabeledSkinBase, the wrapping is done though its internal Text node having a wrapping width -> see HtmlTextPeer.updateWrappingWidth()
setElementStyleAttribute("white-space", wrapText ? "normal" : "nowrap");
//setElementStyleAttribute("line-height", wrapText ? "normal" : "100%"); // Commented as not sure about line-height: 100% when not wrapping text TODO: investigate the expected height in JavaFX
//}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ public void updateWrappingWidth(Double wrappingWidth) {
double width = Numbers.doubleValue(wrappingWidth);
if (width != 0)
setElementStyleAttribute("width", toPx(width));
// Setting the wrapping mode in HTML through white-space style attribute
setElementStyleAttribute("white-space", width != 0 ? "normal" : "nowrap");
clearCache();
updateYOnNextPulse();
}
Expand Down

0 comments on commit 21f3cff

Please sign in to comment.