Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6972

Text wrapping with soft hyphens (shy) or zero-width space

$
0
0

@Jany wrote:

Hello,

I would like to display camel-case variable names in GoJS text blocks. I want to impose a fixed width to the text block, and have GoJS split the text on camel-case word boundaries. To do so, I tried to insert the dedicated Unicode characters in the text, but GoJS seems to only consider spaces for word wrap. How could I achieve this?

Here is the code I tried: I modified the TextBlock sample on wrapping. I included a drawing of the results I expect.

  diagram.add(
    $(go.Part, "Vertical",
      $(go.TextBlock, { text: "my Text Block", background: "lightgreen", margin: 2,
                        width: 50, wrap: go.TextBlock.WrapDesiredSize }),
      $(go.TextBlock, { text: "my\u200BText\u200BBlock", background: "lightgreen", margin: 2,
                        width: 50, wrap: go.TextBlock.WrapDesiredSize }),
      $(go.TextBlock, { text: "my\u00ADText\u00ADBlock", background: "lightgreen", margin: 2,
                        width: 50, wrap: go.TextBlock.WrapDesiredSize })
    ));


Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6972

Trending Articles