neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 195 forks source link

how to keep plots size unchanged when zoom in? #219

Closed scil closed 8 years ago

scil commented 8 years ago

i set plot size is 10,
but when zoom in, the plot will grow larger . is there any way to make sure it not grow ?

neveldo commented 8 years ago

Hello,

Indeed this is the normal behaviour. If you want to update the plot size at zoom, you will need to play with the 'update' event. Here is a similar thread : https://github.com/neveldo/jQuery-Mapael/issues/16 in which you can find this example that works with mapael 1.1.0 : http://jsfiddle.net/neveldo/WRGsD/ . It's a good starting point but I think the formula is wrong as the size of the circle change a bit when zooming.

scil commented 8 years ago

Thank you! I use the default zoom step , and i try following formula and i think it works for me

        $('.map').on('afterZoom', function () {
            var size = defaultPlotSize * Math.pow(0.95, $(this).data("zoomLevel"));
            $(this).trigger('update', [{
                map: {
                    defaultPlot: { size: size, }
                }
            }])
        })
piyusha7 commented 3 years ago

hello, Is there any function for zoom out to change size of plots?

neveldo commented 3 years ago

Hello @piyusha7 ,

There is a work in progress available in this PR from @Indigo744 : https://github.com/neveldo/jQuery-Mapael/pull/352 (original issue : https://github.com/neveldo/jQuery-Mapael/issues/253). However, there are still some bug to be fixed in order to ble able to merge the PR into the master branch. maybe you can take a look to this similar issue too : https://github.com/neveldo/jQuery-Mapael/issues/253 , in which some solutions have been provided (some JSFiddle examples may be broken but the code is still readable).