K
K
Kirill2016-12-17 13:03:19
JavaScript
Kirill, 2016-12-17 13:03:19

How to make Raphael scale SVG?

plz tell me, I draw my map in svg and if on a scale of 1: 1 it opens normally in the browser but very rough, I save it with more detail, then everything is beautiful but I don’t understand how to make the script scale where you want to insert - viewBox = (0 0 30000 35200 )?

jQuery(function(){
  var r = Raphael('map', 300, 320)

    attributes = {
    fill: '#fff',
    stroke: '#3899E6',
    'stroke-width': 1,
    'stroke-linejoin': 'round',
    'class':''
  },
    count = 0,
    arr = new Array();
  for (var country in paths) {
    var obj = r.path(paths[country].pat);
    attributes.class = 'item-'+count;
    obj.attr(attributes);
    arr[obj.id] = country;
    ++count;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill, 2016-12-18
@KirillSPB777

poke method rules :)r.setViewBox(0, 0, 30000, 35200);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question