title | page_title |
---|---|
Layout |
API reference for Kendo UI Drawing API Layout |
Represents a group that can arrange its children within a rectangle.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [200, 200]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect);
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
var pathC = Path.fromRect(pathRect);
layout.append(pathA, pathB, pathC);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
</script>
The rectangle within which the children should be arranged
The configuration options of the layout.
Specifies the alignment of the content.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [200, 300]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect, {
alignContent: "center"
});
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
var pathC = Path.fromRect(pathRect);
layout.append(pathA, pathB, pathC);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Specifies the alignment of the items based.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [300, 300]);
var layout = new draw.Layout(rect, {
alignItems: "center"
});
var pathA = Path.fromRect(new Rect([0, 0], [100, 100]));
var pathB = Path.fromRect(new Rect([0, 0], [100, 50]));
var pathC = Path.fromRect(new Rect([0, 0], [100, 70]));
layout.append(pathA, pathB, pathC);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Specifies how should the content be justified.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [250, 300]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect, {
justifyContent: "center"
});
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
var pathC = Path.fromRect(pathRect);
layout.append(pathA, pathB, pathC);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Specifies the distance between the lines for wrapped layout.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [250, 300]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect, {
lineSpacing: 10
});
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
var pathC = Path.fromRect(pathRect);
layout.append(pathA, pathB, pathC);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Specifies the distance between the elements.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [250, 300]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect, {
spacing: 10
});
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
layout.append(pathA, pathB);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Specifies layout orientation. The supported values are:
- "horizontal" - the elements are arranged horizontally
- "vertical" - the elements are arranged vertically
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [250, 300]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect, {
orientation: "vertical"
});
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
layout.append(pathA, pathB);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Specifies the behavior when the elements size exceeds the rectangle size. If set to true, the elements will be moved to the next "line". If set to false, the layout will be scaled so that the elements fit in the rectangle.
<div id="surface" style="height: 300px;"></div>
<script>
var draw = kendo.drawing;
var Rect = kendo.geometry.Rect;
var Path = draw.Path;
var rect = new Rect([200, 0], [250, 300]);
var pathRect = new Rect([0, 0], [100, 100]);
var layout = new draw.Layout(rect, {
wrap: false
});
var pathA = Path.fromRect(pathRect);
var pathB = Path.fromRect(pathRect);
var pathC = Path.fromRect(pathRect);
layout.append(pathA, pathB, pathC);
layout.reflow();
var surface = draw.Surface.create($("#surface"));
surface.draw(layout);
surface.draw(Path.fromRect(rect));
</script>
Gets or sets the layout rectangle.
The layout rectangle.
kendo.geometry.Rect
The current rectangle.
Arranges the elements based on the current options.