Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration for MultiMap submaps #311

Open
cmriddell opened this issue Feb 8, 2015 · 7 comments
Open

Configuration for MultiMap submaps #311

cmriddell opened this issue Feb 8, 2015 · 7 comments

Comments

@cmriddell
Copy link

Is it possible to configure the submaps that are loaded using the MultiMap map object? It looks like the maps are added as regular map objects, but it's not clear to me how to pass configuration to those maps. Ideally, I'd like to be able to add markers, legend, etc. to the submaps, same as the main map.

@Nilson89
Copy link

Same here, could not find a way. Would be nice if submaps would a) get configuration of main map or b) have a param that can be set while initiating multiMap which gets passed through to the submaps.

@cellulosa
Copy link

For the time being I've created a quick hack by editing multimap.jswhich you can find here that allows parameters to be passed to sub-maps via subMapsOptions:

<script>
    $(function(){
        var map1,
            map2;

        new jvm.MultiMap({
            ...
            subMapsOptions: {
                regionsSelectable: true,
                onRegionClick: function (event, code) {
                    console.log(code);
                },
            },
            main: {
                ...
                regionsSelectable: true,
            }
        });
    });
</script>

@Scuzzlebut
Copy link

Hello, thanks for your "hack" it's been very handy!
I got one issue with this: after i load a submap i need to zoom to a point right away so this is my code:
subMapsOptions: {
onRegionClick: function (event, code) {
console.log(code);
},
zoomOnScroll: false,
panOnDrag : false,
focusOn: {scale: 4, x: 0.5, y:0.5},
},
It works fine, but when i go back to main map and then again to the same submap he just ignores the focusOn parameter (the others work fine). Is there some bug in the code which prevents me calling this method a second time? Can't figure out the bug.
Thanks for the help

@vistree
Copy link

vistree commented Apr 18, 2017

Hi @cellulosa ,
where can we find your hack? The github link you provide does not work any more ...
Thanx!!!

@cellulosa
Copy link

Hi @vistree,

I removed my repository because I though nobody needed it and it's a long time since I last used jvectormap. Anyway, I found my old edited file, there it is: https://github.com/bjornd/jvectormap/blob/3a3b9506f4c34aa62347e97369b83d6318df40ee/src/multimap.js

@vistree
Copy link

vistree commented Apr 27, 2017

@cellulosa : thanx!!!

@sipujena
Copy link

sipujena commented Apr 4, 2018

Great job.. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants