Edit this page

kendo.drawing.RectInherits from kendo.drawing.Element

Draws a rectangle with set geometry, fill and stroke.

Example - creating a rect

<div id="surface"></div>
<script>
    var draw = kendo.drawing;
    var geom = kendo.geometry;

    var rectGeometry = new geom.Rect([0, 0], [100, 100]);
    var rect = new draw.Rect(rectGeometry).stroke("red", 1);

    var surface = draw.Surface.create($("#surface"));
    surface.draw(rect);
</script>

Constructor Parameters

geometry kendo.geometry.Rect

The geometric object that defines the rectangle origin and size.

options Object

The configuration options.

Configuration

clip kendo.drawing.Path

The element clipping path. Inherited from Element.clip

cursor String

The element cursor. Inherited from Element.cursor

fill kendo.drawing.FillOptions

The fill options of the shape.

opacity Number

The element opacity. Inherited from Element.opacity

stroke kendo.drawing.StrokeOptions

The stroke options of the shape.

tooltip kendo.drawing.TooltipOptions

The tooltip options of the shape.

transform kendo.geometry.Transformation

The transformation to apply to this element. Inherited from Element.transform

visible Boolean

A flag, indicating if the element is visible. Inherited from Element.visible

Methods

bbox

Returns the bounding box of the element with transformations applied. Inherited from Element.bbox

Returns

kendo.geometry.Rect The bounding box of the element with transformations applied.

clip

Gets or sets the element clipping path. Inherited from Element.clip

Parameters

clip kendo.drawing.Path

The element clipping path.

Returns

kendo.drawing.Path The current element clipping path.

clippedBBox

Returns the bounding box of the element with clipping and transformations applied. Inherited from Element.clippedBBox

Returns

kendo.geometry.Rect The bounding box of the element with clipping transformations applied.

containsPoint

Returns true if the shape contains the specified point.

Parameters

point kendo.geometry.Point

The point that should be checked.

Returns

Boolean value indicating if the shape contains the point.

geometry

Gets or sets the rectangle geometry.

Parameters

value kendo.geometry.Rect

The new geometry to use.

Returns

kendo.geometry.Rect The current rectangle geometry.

fill

Sets the shape fill.

Parameters

color String

The fill color to set.

opacity Number optional

The fill opacity to set.

Returns

kendo.drawing.Rect The current instance to allow chaining.

opacity

Gets or sets the element opacity. Inherited from Element.opacity

If set, the stroke and fill opacity will be multiplied by the element opacity.

Parameters

opacity Number

The element opacity. Ranges from 0 (completely transparent) to 1 (completely opaque).

Returns

Number The current element opacity.

stroke

Sets the shape stroke.

Parameters

color String

The stroke color to set.

width Number optional

The stroke width to set.

opacity Number optional

The stroke opacity to set.

Returns

kendo.drawing.Rect The current instance to allow chaining.

transform

Gets or sets the transformation of the element. Inherited from Element.transform

Parameters

transform kendo.geometry.Transformation

The transformation to apply to the element.

Returns

kendo.geometry.Transformation The current transformation on the element.

visible

Gets or sets the visibility of the element. Inherited from Element.visible

Parameters

visible Boolean

A flag indicating if the element should be visible.

Returns

Boolean true if the element is visible; false otherwise.

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy