What is Want is Text to be fully visible inside a node and node should not be able to shrink beyond the area of textblock such that whole text is fully visible inside node.
Original Image:
After Resizing (Text gets cut):
Desired (Full text is visible):
Here is the current Code:
public static getTemplate(
diagram: go.Diagram,
contextMenu: go.Adornment | go.HTMLInfo
): go.Node {
const $ = go.GraphObject.make;
return $(
go.Node,
"Spot",
{
contextMenu,
resizable: true,
resizeObjectName: "BODY",
selectionObjectName: "BODY",
},
new go.Binding("location", "position", parseNodeLocation).makeTwoWay(
convertNodeLocationPoint
),
new go.Binding("isSelected", "isSelected").makeTwoWay(),
$(
go.Panel,
"Spot",
$(
go.Panel,
"Auto",
{
name: "BODY",
minSize: new go.Size(160, 55),
desiredSize: new go.Size(160, 55),
},
new go.Binding("desiredSize", "size", parseEntitySize).makeTwoWay(
parseShapeSize
),
$(
go.Shape,
"RoundedRectangle",
{
fill: GRAPH_CONFIG.SHAPE_COLORS.whiteColor,
stretch: go.GraphObject.Fill,
stroke: null,
strokeWidth: 1,
shadowVisible: true,
},
new go.Binding("figure", "shape"),
),
$(
go.TextBlock,
{
alignment: go.Spot.Left,
margin: new go.Margin(10),
stroke: "#060322",
shadowVisible: false,
font: "normal 12px sans-serif",
editable: true,
overflow: go.TextBlock.UniformToFill,
isMultiline: false,
textValidation: GRAPH_CONFIG.TEXT_VALIDATIONS.TEXT_ANNOTATION,
textEdited: GRAPH_CONFIG.TEXT_EDITED.TEXT_ANNOTATION,
},
new go.Binding("text", "textAnnotation").makeTwoWay()
)
),
$(
go.Shape,
"LeftCShape", // A left bracket shape
{
alignment: go.Spot.Left,
alignmentFocus: go.Spot.Left,
stretch: go.GraphObject.Vertical,
cursor: "pointer",
strokeWidth: 2,
stroke: "#4F5590",
fill: "transparent",
}
)
),
);
}
NOTE: I have looked into the lineCount property for textblock node resizing, but not sure how to use it. Link : TextBlock | GoJS API