only enable feature editing if the current form supports it

This commit is contained in:
Laura Klünder 2016-09-26 15:03:15 +02:00
parent 83ca244aed
commit ade73d19a2

View file

@ -324,8 +324,10 @@ editor = {
edit_form_loaded: function() {
$('#mapeditcontrols').addClass('detail');
$('#id_level').val(editor._level);
$('#id_geometry').val(JSON.stringify(editor._editing.toGeoJSON().geometry));
editor._editing.enableEdit();
if ($('#id_geometry').length) {
$('#id_geometry').val(JSON.stringify(editor._editing.toGeoJSON().geometry));
editor._editing.enableEdit();
}
if (editor._editing.options.geomtype == 'polygon') {
editor._editing.on('click', function (e) {
if ((e.originalEvent.ctrlKey || e.originalEvent.metaKey) && this.editEnabled()) {
@ -372,7 +374,9 @@ editor = {
if ($('<div>').append(content).find('form').length > 0) {
$('#mapeditdetail').html(content);
$('#mapeditcontrols').addClass('detail');
editor._editing.enableEdit();
if ($('#id_geometry').length) {
editor._editing.enableEdit();
}
} else {
if (editor._creating !== null) {
editor._editing.remove();