Norkart / Leaflet-MiniMap

A minimap control plugin for Leaflet
BSD 2-Clause "Simplified" License
395 stars 125 forks source link

Ability to specify map options for the minimap #11

Closed ttherkelsen closed 11 years ago

ttherkelsen commented 11 years ago

An internal instance of L.Map is used for the minimap, which is fine if you're going with default options.

However, it does mean that the minimap does not play well with some plugins, nor if you're using nonstandard map options for the main map (e.g., using a custom CRS).

My suggestion would be to add a mapOptions option to the minimap option list, like so:

 new L.Control.MiniMap(minimap, {
    toggleDisplay: true,
    width: 210,
    height: 210,
    mapOptions: {
        panControl: false,
        zoomsliderControl: false,
        crs: L.CRS.Simple,
    }
}).addTo(map);

Anyways, keep up the good work on this lovely Leaflet plugin :-)

robpvn commented 11 years ago

Sorry it took so long for me to respond.

PR #26 fixed the issue when one has non-standard CRSes, as for the other options I'm not really sure if it's a good idea to allow specifying other arbitrary things because some of them might conflict with the options the MiniMap needs to set in order to work properly.

snkashis commented 11 years ago

Yeah, that's exactly why I didn't do a full carry over of an options parameter.

ChALkeR commented 11 years ago

At it is now, it breaks with, for example, this plugins: https://github.com/kartena/Leaflet.zoomslider https://github.com/kartena/Leaflet.Pancontrol

ChALkeR commented 11 years ago

Of course, something like

L.Map.mergeOptions({
    panControl: false,
    zoomsliderControl: false
});

solves this, but it would be better to specify (default) options for the minimap separately.

robpvn commented 11 years ago

Ok, now we have CRS carry-over and the Zoomslider/Pancontrol widgets have changed their behaviour, so this should be all good!