Comments (11)
Implemented in 0.2. Can do:
drawControl.setDrawingOptions(
polyline: {
icon: new L.DivIcon({
iconSize: new L.Point(10, 10),
className: 'leaflet-div-icon leaflet-editing-icon my-own-class'
})
}
);
Will add to README.
from leaflet.draw.
This worked:
L.Edit.Poly = L.Edit.Poly.extend({
options : {
icon: new L.DivIcon({
iconSize: new L.Point(20, 20),
className: 'leaflet-div-icon leaflet-editing-icon my-own-icon'
})
}
});
from leaflet.draw.
Also something as simple as overrite the classes, to for example, change to circles:
.leaflet-div-icon {
background-color: #f4f4f4;
border: 1px solid #666;
border-radius: 50%;
display: inline-block;
}
.leaflet-editing-icon {
background-color: #f4f4f4;
border: 1px solid #666;
border-radius: 50%;
display: inline-block;
}
from leaflet.draw.
@jacobtoye and @Starefossen, I'm wondering if either of you can help me.
When instantiating the drawControl I have:
scope.drawOptions = {
position: 'topright',
draw: {
polyline: false,
polygon: {
icon: new L.DivIcon({
iconSize: new L.Point(16, 16),
className: 'leaflet-div-icon leaflet-editing-icon my-own-class'
}),
allowIntersection: false,
drawError: {
color: '#5878B8',
message: '<strong>Oh snap!<strong> you can\'t draw that!'
},
shapeOptions: shapeOptions
},
circle: false, // Turns off this drawing tool
rectangle: false,
marker: false
},
edit: {
featureGroup: self.featureGroup
}
};
scope.drawControl = new L.Control.Draw(scope.drawOptions);
map.addControl(scope.drawControl);
But as @Starefossen mentioned above, the style reverts back to the "default" when entering edit mode. I tried to combat this with:
map.on('draw:editstart', function(e) {
scope.drawControl.setDrawingOptions({
polygon: {
icon: new L.DivIcon({
iconSize: new L.Point(16, 16),
className: 'leaflet-div-icon leaflet-editing-icon my-own-class'
})
},
})
});
But that didn't help. Any suggestions?
from leaflet.draw.
Note -- if you're not using the Draw toolbar you can update the vertices for drawing by extending L.Edit.PolyVerticesEdit
similarly to L.Edit.Poly
above.
from leaflet.draw.
@8volution23 If you really need to do it, just use width and height property with !important.
.leaflet-editing-icon { width: 10px !important; height: 10px !important; border-radius: 20px; }
from leaflet.draw.
You are right. 0.2 is a WIP, I wouldn't advise using it beyond dev at the moment. However this is still a bug. I'll look into fixing it.
from leaflet.draw.
Ahh.. Great! I'm currently testing out 0.2 to see if I can find any bugs, and if there are anything I can help out with. Still learning the ways of the Leaflet core, so yet a still learning to do. I'll send you a link to a project I'm working on when it's stable enough to be demoed :)
from leaflet.draw.
This is just perfect. You rock @jacobtoye!
from leaflet.draw.
I see no CSS styling for leaflet-editing-icon
in either Leaflet or Leaflet Draw -- looks like the intent is to allow styling vertex icons using that class, so could omit my-own-icon
.
from leaflet.draw.
Sorry to revive this thread again, but how would you change the vertices shape to circles instead of squares? I tried this so far: .leaflet-editing-icon{ border-radius: 20px; }
which rounds the squares, but I couldn't make them smaller.
@RickMohr , I've seen you did something similar here, but not sure how to apply it to Leaflet.draw
from leaflet.draw.
Related Issues (20)
- Leaflet.js Polyline from an array of LatLng points - remove/hide part of points connection based on distance
- Use of ._flat rather than isFlat HOT 1
- Use the saved circle from the db and make it editable HOT 1
- Resizing in active edit mode
- Edit.Poly middle marker custom icon
- Rectangle and circle options documentation typo
- Using the Delete tool, the drawn layer cannot be deleted after the layer is overlaid
- Couldn't draw polygons/polylines using leaflet, leaflet.draw HOT 1
- TypeError: can't access property "falseFn", L.Util is undefined
- Add drawing markers to custom pane
- Cannot read properties of undefined (reading 'Poly') HOT 1
- Right click triggers `draw:drawvertex` event
- can't have delete without edit HOT 1
- Create polyline with some points non editable
- tooltips option on enableDraw() not working? HOT 1
- Programmatically set drawing mode / external toolbar
- εΎε±θ¦η HOT 1
- Impossible de modifier le cercle Leaflet
- Tool enabling disables text selection on the entire document HOT 1
- Drawing a rectangle using leaflet.draw library doesn't work (it throws error in console). HOT 1
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 leaflet.draw.