Edit this page

align

Aligns drawing elements x axis position to a given rectangle.

Parameters

elements Array

An array with the drawing elements that should be aligned.

rect kendo.geometry.Rect

The rectangle in which the elements should be aligned.

alignment String

Specifies how should the elements be aligned. The supported values are:

  • "start" - the elements will be aligned to the rectangle origin.
  • "center" - the elements will be aligned to the rectangle center.
  • "end" - the elements will be aligned to the right side of the rectangle.

Example

<div id="surface"></div>
<script>
  var draw = kendo.drawing;
  var Rect = kendo.geometry.Rect;
  var rect = new Rect([200, 0], [300, 100]);
  var path = draw.Path.fromRect(new Rect([0, 0], [100, 100]));

  draw.align([path], rect, "center");

  var surface = draw.Surface.create($("#surface"));
  surface.draw(path);
  surface.draw(draw.Path.fromRect(rect));
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy