Edit this page

eventToView

Retrieves relative (view) coordinates that correspond to this mouse event. Layer elements positioned on these coordinates will appear under the mouse cursor.

View coordinates are no longer valid after a map reset.

Parameters

e Object |jQuery.Event

The DOM or jQuery mouse event.

Returns

kendo.geometry.Point The relative (view) coordinates that correspond to this mouse event.

Example - position elements over map on click

<style>
    .box {
        position: absolute;
        display: block;
        width: 10px;
        height: 10px;
        margin: -5px 0 0 -5px;
        background: red;
    }
</style>
<div id="map"></div>
<script>
    $("#map").kendoMap({
        layers: [{
            type: "tile",
            urlTemplate: "http://a.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png",
            attribution: "&copy; OpenStreetMap"
        }]
    });

    var map = $("#map").data("kendoMap");
    $("#map").click(function(e) {
        var view = map.eventToView(e);
        $("<span class='box'></span>")
        .css({ top: view.y, left: view.x })
        .appendTo(map.scrollElement);
    });
</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