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