Comments (4)
From @Martijnvl on March 29, 2014 21:11
I got that same issue, maybe someone can help use out with a working example. Much tnx
from ui-leaflet.
From @ninniuz on April 3, 2014 16:9
As a workaround I had to create a L.Control.Draw
in my controller, define options there and add a drawnItems
in my scope.
var drawnItems = new L.FeatureGroup();
var options = { edit: { featureGroup: drawnItems } };
var drawControl = new L.Control.Draw(options);
angular.extend($scope, controls: { custom: [drawControl] });
Then simply add the layer to drawnItems when you get the draw:created
event.
from ui-leaflet.
From @Martijnvl on April 7, 2014 21:11
I did they exact same thing but for some reason when I draw a circle for example I don't see it getting painted on the layer...see my ctrl code below. I placed the css files inside my index.html. I can't figure out why this isn't working. I do see that the layer gets added to drawitems but nothing shows on map. Any help would be appreciated.
var drawnItems = new L.FeatureGroup();
var options = {
edit: { featureGroup: drawnItems
},
draw: {
polygon: {
shapeOptions: {
color: 'purple'
}
},
circle: {
shapeOptions: {
stroke: true,
weight: 4,
color: 'blue',
opacity: 0.5,
fill: true,
fillColor: null, //same as color by default
fillOpacity: 0.2,
clickable: true
}
}
},
showRadius: true
};
var drawControl = new L.Control.Draw(options);
angular.extend($scope, {
defaults: {
scrollWheelZoom: false
},
london: {
lat: 51.505,
lng: -0.09,
zoom: 8
},
controls: {
custom: [drawControl]
}
});
leafletData.getMap().then(function (map) {
map.on('draw:created', function (e) {
var type = e.layerType,
layer = e.layer;
if (type === 'circle') {
console.log(JSON.stringify(layer.toGeoJSON()));
}
drawnItems.addLayer(layer);
});
});
from ui-leaflet.
From @muenchdo on April 24, 2014 13:23
@Martijnvl Is it possible that you have missed adding the drawnItems
to your map? I did it like this:
leafletData.getMap().then(function(map) {
map.addLayer(drawnItems);
});
Now I can at least add new shapes to the map. But somehow I have some strange issues with the editing functionality. Sometimes I can edit, but after adding a new shape the editing button is suddenly disabled. Then, after adding another shape, editing is suddenly possible again. I haven't been able to track down the reason for this behaviour.
EDIT: I have further investigated my issues and it seems that every time I add a new shape, the editing toolbar is toggled. Does anybody have any ideas what could be causing this?
from ui-leaflet.
Related Issues (20)
- leafletData.getDirectiveControls
- Dynamically add data to geoJSONShape HOT 1
- Migration to Angular 4 HOT 1
- Changin markers on scope, the model is different HOT 2
- Markers not showing in second (or more) maps HOT 4
- Travis CI seems to be broken HOT 1
- Add Custom Styles To Google Maps
- layercontrol - More than 1 map on the DOM
- IE 11: US Map mouse over highlighting beside state(s)
- <Security Issue> Slack token need to be encrypted
- Fitbounds and markercluster zoom issue
- Marker in not updating its position on the map, when its value is updated
- Nor working in angular 1.6.4 HOT 2
- Popup closes when changing marker icon
- ui-leaflet analog for bindLabel functionality? HOT 1
- Could anyone propagate this commit to the 2.0.x tag version?
- MBTiles
- Disable auto center adjust after change marker coordinates programmatically
- Is this project still active ?
- Issue with Clickable Marker Content
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-leaflet.