4 Answers, 1 is accepted
Here is some code I have been trying,
$("#map").mousedown(mapMouseDown);
$("#map").mousemove(mapMouseMove);
$("#map").mouseup(mapMouseUp);
var _drawing = false;
var _currentShape = null;
var _shapeData = new Array(0);
var _map = $("#map").data("kendoMap");
var _shapeLayer = _map.layers[2];
var _lineShapeFactory = new LineShapeFactory();
var _polygonShapeFactory = new PolygonShapeFactory();
var _counter = 0;
function mapMouseDown(e) {
var location = _map.eventToLocation(e);
_currentShape = new _lineShapeFactory.CreateNew();
_currentShape.coordinates.push(new Array(location.lat, location.lng));
_currentShape.coordinates.push(new Array(location.lat, location.lng));
_shapeData.push(_currentShape);
_shapeLayer.datasource = _shapeData;
_drawing = true;
e.stopPropagation();
var foo = null;
}
function mapMouseMove(e) {
if (_drawing == false) {
return;
}
var location = _map.eventToLocation(e);
if (_currentShape.type == "Linestring") {
_currentShape.coordinates[1] = new Array(location.lat, location.lng);
}
var test = _shapeData;
e.stopPropagation();
if (counter == 100) {
var foo = null;
}
counter++;
}
function mapMouseUp(e) {
_drawing = false;
e.stopPropagation();
}
function LineShapeFactory() {
this.CreateNew = function () {
var newLineString = {
"type": "Linestring",
"coordinates": new Array(0)
};
return newLineString;
}
}
The map is named "map", and it has in this order a tile layer, a marker layer, and a shape layer.
Using the shape layer as a drawing surface is an interesting idea. It makes possible to persist the changes in a standard format. We'll consider it as a full-blown feature.
Please, file a request for this feature on our UserVoice portal if you have minute.
This will help us gauge the overall interest and prioritize.
Regards,
T. Tsonev
Telerik
Hello Matt,
I am afraid that such functionality is not available out of the box. Furthermore, there is no request for it in our feedback portal.
https://feedback.telerik.com/kendo-jquery-ui
If you would like to request the feature please log an item in the portal. We prioritize the requests based on the customer demand and the impact they would have for a given component.
Regards,
Viktor Tachev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.