diff --git a/src/c3nav/editor/static/editor/js/editor.js b/src/c3nav/editor/static/editor/js/editor.js index d2b40d58..ed5bd19f 100644 --- a/src/c3nav/editor/static/editor/js/editor.js +++ b/src/c3nav/editor/static/editor/js/editor.js @@ -30,7 +30,7 @@ editor = { editcontrols.append( $('
').attr('name', feature_type.name).append( $('').text(feature_type.title_plural).append( - $('') + $('') ) ) ); @@ -126,7 +126,7 @@ editor = { }); editor.map.addControl(new L.DrawControl()); - $('#mapeditcontrols').on('click', 'fieldset legend .btn', function() { + $('#mapeditcontrols').on('click', '.start-drawing', function() { console.log($(this).closest('fieldset')); editor.start_drawing($(this).closest('fieldset').attr('name')); }); @@ -140,16 +140,17 @@ editor = { closeButton: false, autoClose: false, }).setContent('').setLatLng(e.layer.getCenter()).openOn(editor.map); - console.log(e.layer.toGeoJSON()); + $('.leaflet-drawbar').hide(); }).on('editable:drawing:cancel', function (e) { if (editor._drawing !== null && editor._adding === null) { e.layer.remove(); + $('.start-drawing').prop('disabled', false); } }); }, start_drawing: function(feature_type) { - console.log(feature_type); + if (editor._drawing !== null || editor._adding !== null) return; editor._drawing = feature_type; var options = editor.feature_types[feature_type]; if (options.geomtype == 'polygon') { @@ -157,16 +158,14 @@ editor = { } else if (options.geomtype == 'polyline') { editor.map.editTools.startPolyline(null, options); } - $('.leaflet-editbar').toggleClass('usable', false); - $('#drawstart').hide(); - $('#drawcancel').show(); + $('.leaflet-drawbar').show(); + $('.start-drawing').prop('disabled', true); }, cancel_drawing: function() { if (editor._drawing === null || editor._adding !== null) return; editor.map.editTools.stopDrawing(); editor._drawing = null; - $('#drawcancel').hide(); - $('#drawstart').show(); + $('.leaflet-drawbar').hide(); }, };