Permalink
Browse files

Fix mapknitter.js code so that Leaflet.Draw and Leaflet.Illustrate an…

…notations are added to the map on creation and are immediately editable.
  • Loading branch information...
justinmanley committed Aug 29, 2014
1 parent 3599cca commit e3962af4327958ec8c476f83cd21003ce1c15730
Showing with 24 additions and 15 deletions.
  1. +23 −12 app/assets/javascripts/mapknitter.js
  2. +1 −3 app/assets/javascripts/maps.js
@@ -66,18 +66,25 @@ var MapKnitter = L.Class.extend({
},
setupMap: function() {
var drawnItems = new L.FeatureGroup().addTo(this._map),
zoomControl = L.control.zoom({ position: 'topright' }).addTo(this._map),
illustrateControl = new L.Illustrate.Control({
position: 'topright',
edit: { featureGroup: drawnItems }
}).addTo(this._map),
drawControl = new L.Control.Draw({
position: 'topright',
edit: { featureGroup: drawnItems }
}).addTo(this._map);
L.tileLayer.provider('Esri.WorldImagery').addTo(this._map);
var map = this._map,
drawnItems = new L.FeatureGroup().addTo(map);
L.control.zoom({ position: 'topright' }).addTo(map);
L.tileLayer.provider('Esri.WorldImagery').addTo(map);
new L.Illustrate.Control({
position: 'topright',
edit: { featureGroup: drawnItems }
}).addTo(map);
new L.Control.Draw({
position: 'topright',
edit: { featureGroup: drawnItems }
}).addTo(map);
map.on('draw:created', function(event) {
drawnItems.addLayer(event.layer);
});
},
enableDragAndDrop: function() {
@@ -96,6 +103,10 @@ var MapKnitter = L.Class.extend({
jQuery(warpable).draggable("option", "helper", function() { return img; });
});
});
},
addMetadata: function() {
}
});
@@ -3,13 +3,11 @@
//= require knitter
//= require mapknitter
/* Move navbar links into dropdown if nav is inside the sidebar. */
jQuery(document).ready(function($) {
var sidebarNav = $(".knitter-side-pane .navbar-nav.sidebar-only");
navLinks = $(".knitter-side-pane .navbar-nav.fullscreen-only").find("li");
console.log(sidebarNav);
console.log(navLinks);
sidebarNav.find(".dropdown-menu").append(navLinks);
});

0 comments on commit e3962af

Please sign in to comment.