I have a left aligned TextBlock
in a vertical Panel
that’s in side a Rectangle
. On mouseEnter
of the Rectangle
, I’m shrinking the TextBlock
based on the width of the Rectangle
like so:
var textBlock = node.findObject(TEXTBLOCK_NAME);
var rectangle = node.findObject(RECTANGLE_NAME);
if (textBlock && rectangle && rectangle.measuredBounds) {
textBlock.width = rectangle.measuredBounds.width - BUFFER_SIZE;
}
where BUFFER_SIZE
is some constant width.
My expected behavior is that the TextBlock
would shrink and text like “Application Rejected” would become “Application Reje…”, but what I’m seeing is that the text only gets truncated when the word “Rejected” is cut off by half, i.e. I can only ever get “Application…” or “Application Rejected” even if there shouldn’t be room for the word “Rejected.” What am I missing here?
My TextBlock
looks like this:
$(go.TextBlock,
new go.Binding("text", "label"),
{
name: TEXTBLOCK_NAME,
margin: new go.Margin(4, 12, 0, 12),
alignment: go.Spot.Left,
overflow: go.TextBlock.OverflowEllipsis,
maxLines: 1
}
),
We are on version 2.1.56.