Closed miemo closed 9 years ago
Yesss, the actual "defaults" are a little confusing, because it seems that every options we put on that object will be passed to the map creation object, and that's not the case. Actually, only a few options are explicitly passed to the map creation object. I'm documenting the process here:
https://github.com/tombatossals/angular-leaflet-directive/blob/master/doc/defaults-attribute.md
I'm thinking about structuring the actual defaults object, making a specific section for every configuration block we need. For example, this would be the basic structure:
defaults = {
map: {
.... // Map related configuration defaults passed directly to the leaflet map
},
center: {
....
},
controls: {
....
},
markers: {
....
}
}
This would break a little the current API, but I think it would be more clear. For the moment, we could start creating the "map" block, and every option defined there will be passed to Leaflet. This would not break the current API and could ease the transition to the model proposed above. In your case, it would be something like this:
defaults = {
map: {
touchZoom: false
}
}
What do you think about it?
Closing since this is dated. Please comment to re-open.
Looks like there are some leaflet options that are NOT transmitted to leaflet.js from the defaults-object by angular-leaflet-directive.
E.g. I was trying to disable touchZoom by adding
touchZoom: false
to the defaults-object, but zooming with two fingers was still possible. I took a quick look at the code, and it seems that the options that are transmitted are hardcoded in setDefaults-function - and e.g. touchZoom is not there.I was able to disable it in the end by calling
map.touchZoom.disable();
but it took some time to figure out that was necessary.