Hello,
I'm using kendo.dataviz.diagram.Layout to handle text overflow in diagram shapes, but sometimes that is not enough, and the text overflows vertically. I want to identify this problem and solve it by changing my shape's height to fit this, so I need a way to ask the Layout what is it's preferred height (or number of lines, etc).
I currently have something like this:
var
layout =
new
kendo.dataviz.diagram.Layout(
new
kendo.dataviz.diagram.Rect(shape.contentX, shape.contentY, shape.contentWidth, shape.contentHeight),
{
alignContent:
"center"
,
justifyContent:
"center"
,
spacing: 6,
lineSpacing: 5
});
var
texts = entity.name.split(
" "
);
for
(
var
i = 0; i < texts.length; i++) {
layout.append(
new
kendo.dataviz.diagram.TextBlock({
text: texts[i]
}));
}
layout.reflow();
var
path =
new
kendo.dataviz.diagram.Path({
data: shape.path,
stroke: stroke,
fill: fill,
height: Math.max(shape.contentHeight+10, layout.rect().height+10)
});
The idea being that I have the default (shape.contentHeight) height, and if the layout height exceeds it I increase the Path height, but sadly Layout.rect() always returns the initial rectangle.
Is there a way to query the layout for the actual ("preferred") rectangle size, or at least know if it exceeded the originally allocated one?
Thanks.