editor: Center on object after loading new coords

This commit is contained in:
Markus Koch 2020-04-19 22:26:35 +02:00
parent ba466fe474
commit 94c05d5358

View File

@ -76,6 +76,13 @@ if (editor_mode) {
polyline = L.polyline(coords).addTo(mymap); polyline = L.polyline(coords).addTo(mymap);
// polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below // polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below
polyline.enableEdit(); polyline.enableEdit();
if (interactive) {
console.log(coords);
latlng = L.latLng(coords[0][0] + (coords[coords.length - 1][0] - coords[0][0]) / 2,
coords[0][1] + (coords[coords.length - 1][1] - coords[0][1]) / 2);
console.log("NEW=" + latlng);
jump_to(latlng, 8);
}
} }
} }