Hello, I'm using Kendo UI for JQuery Diagram in Angular and I have a problem with the size.
I want the diagram to fit to its container, and I have the container height and width set to 100%.
When first initialized, the height and width of the "k-layer" div is automatically set to always 600px which does not fit to its container.
And when I resize the window manually, this "k-layer" size changes to fit to the container size.
My question is, how can I make this diagram to fit its container when initially loaded?
I tried calling kendo.resize("wrapper") when initially loaded, but this does not work.
FYI, I initialize the diagram in ngAfterViewInit().
Please see the screenshot I attached.
This screenshot shows the initial size is 600px.
And the code below is the code I use to initialize the diagram.
init:
function
(diagramElement, designerPanelWrapperElement) {
designerPanelWrapper = designerPanelWrapperElement;
diagram = diagramElement.kendoDiagram({
theme:
"default"
,
dataSource: {
data: [{
name:
"0"
,
items: [{
name:
"0"
}]
}],
schema: {
model: {
children:
"items"
}
}
},
shapeDefaults: {
width: 120,
height: 120,
fill:
"#8ebc00"
},
layout: {
type:
"tree"
,
subtype:
"right"
},
select:
function
(e) {
}
}).getKendoDiagram();
diagramElement.kendoDropTarget({
drop:
function
(e) {
var
item, pos, transformed;
if
(e.draggable.hint) {
item = e.draggable.hint.data(
"shape"
);
pos = e.draggable.hintOffset;
pos =
new
Point(pos.left, pos.top);
var
transformed = diagram.documentToModel(pos);
item.x = transformed.x;
item.y = transformed.y;
diagram.addShape(item);
}
}
});
kendo.resize(designerPanelWrapper);
}