Skip to content Skip to sidebar Skip to footer

Scaling Multiple Paths With Raphael

I'm trying to use Raphael to create a map tool similar to this example in the webpage. I have an svg file of the map I want to use, and the provinces are all separate paths in the

Solution 1:

scale can accept four parameters:

scale(x, y, cx, cy);

where cx and cy are coordinates of the centre of scaling. By default it is in the middle of the shape. So, to scale two shapes you need to scale then relative to the same centre.

Solution 2:

You could join your 2 path like this :

province.a=paper.path("M1195.23,2765.051176.44,2753.81182.93,2743.861198.21,2745.131201.92,2738.141239.79,2738.321263.62,2752.621284.76,2743.951317.8,2750.741367.35,2746.421392.66,2715.111400.21,2696.41414.4,2707.231451.71,27071456.53,2690.061486.98,2691.431517.68,2681.61536.64,2650.121560.81,2641.941566.44,2625.911655.76,2577.951652.86,2580.911640.92,2614.691610.92,2642.311590.74,2684.671565.32,2702.681559.58,2720.441521.84,2784.071477.67,2814.721461.87,2821.151442.9,2853.641440.5,2874.941420.09,2879.491381.85,2912.961374.51,2932.581336.52,2969.111318.56,2959.931310.72,2940.641294.49,2938.231287.2,2923.451265.55,2923.981246.43,2913.81239.54,2901.71213.98,2894.241206.33,2881.171214.32,2876.41199.89,2858.791204.99,2841.581220.87,2835.671210.72,2812.631232.15,2807.481225.15,2793.261231.23,2781.471213.41,2762.41195.23,2765.05M1050.73,2867.781046.35,2845.331040.53,2832.741044.23,2819.351066.03,2819.421087.07,2805.181094.97,2784.451104.23,2779.311115.05,2774.951131.12,2800.441146.19,2792.661146.45,2777.11166.57,2777.521166.63,2804.271194.54,2818.111210.74,2812.671220.87,2835.671204.99,2841.581199.89,2858.791214.32,2876.41206.33,2881.171213.98,2894.241239.54,2901.71246.43,2913.81265.55,2923.981287.2,2923.451294.49,2938.231310.72,2940.641318.56,2959.931336.52,2969.111320.71,2984.321320.22,2994.451309.88,3001.291297.83,2993.41293.02,2997.091289.27,3013.921283.96,3022.61275.93,3022.851266.2,3024.261259.83,3020.741253.98,3024.671246.93,3031.31237.88,3017.881214.41,3015.121185.95,3005.821174.43,3017.41174.77,3035.971170.62,3043.421158.95,3043.061145.56,3029.71137.74,3036.821127.73,3037.171121.47,3030.561114.84,3035.161101.49,3035.031102.89,3011.961123.59,2990.261137.04,2989.941130.85,2973.551120.31,2972.881114.08,2984.931100.47,2983.631095.19,2970.611085.65,2970.311077.68,2950.181061.43,2942.381057.59,2940.541055.36,2924.831041.79,2915.841041.19,2898.891048.93,2884.21032.89,2877.321038.29,2867.021050.73,2867.78z");

But then you'll have only one province...

Post a Comment for "Scaling Multiple Paths With Raphael"