containsPoint

Returns true if the shape contains the specified point.

Example - checking if point is contained in multi-path

<div id="surface" style="width: 250px; height: 250px;"></div>
<script>
    var draw = kendo.drawing;
    var geom = kendo.geometry;

    var multiPath = new draw.MultiPath()
        .moveTo(50, 50).lineTo(150, 50).lineTo(100, 100).close()
        .moveTo(100, 150).lineTo(200, 150).lineTo(150, 200).close();

    multiPath.fill("lightblue");

    var testPoint1 = new geom.Point(75, 65);  // Inside first triangle
    var testPoint2 = new geom.Point(125, 125); // Outside both triangles
    var testPoint3 = new geom.Point(150, 175); // Inside second triangle

    console.log("Point (75, 65) contained: " + multiPath.containsPoint(testPoint1));
    console.log("Point (125, 125) contained: " + multiPath.containsPoint(testPoint2));
    console.log("Point (150, 175) contained: " + multiPath.containsPoint(testPoint3));

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

Parameters

point kendo.geometry.Point

The point that should be checked.

Returns

Boolean value indicating if the shape contains the point.

In this article
containsPoint
Not finding the help you need?
Contact Support