Z
Z
z_n_r2014-07-26 13:59:45
Raphael
z_n_r, 2014-07-26 13:59:45

How to make rubber raphael js? scale it?

var rsr = Raphael('coop1', '1024', '768'); 
var floors = [] ;
var path_a = rsr.path("M 478.7 178.3 L 795.7 106.3 L 894 243.3 L 894 351.7 L 795 316 L 478.7 335.3 L 478.7 178.3"); path_a.attr({opacity: '0.57',fill: '#51B3B8',stroke: '#000000',"stroke-miterlimit": '10','stroke-width': '0','stroke-opacity': '1'}).data('id', 'path_a'); floors.push(path_a);
var path_b = rsr.path("M 478.7 335.3 L 795 316 L 894 351.7 L 892.3 446.7 L 794.3 502.3 L 478.7 473.7 L 478.7 335.3"); path_b.attr({opacity: '0.43',fill: '#5BAE62',stroke: '#000000',"stroke-miterlimit": '10','stroke-width': '0','stroke-opacity': '1'}).data('id', 'path_b'); floors.push(path_b);
var path_c = rsr.path("M 478.7 473.7 L 794.3 502.3 L 892.3 446.7 L 892.3 546.7 L 793.3 691.3 L 761.3 684 L 760.9 681.3 L 587.9 639 L 584 640.1 L 561.6 635 L 561.5 633.3 L 478.7 611 L 478.7 473.7"); path_c.attr({opacity: '0.53',fill: '#C583B6',stroke: '#000000',"stroke-miterlimit": '10','stroke-width': '0','stroke-opacity': '1'}).data('id', 'path_c');floors.push(path_c); 
var path_d = rsr.path("M 377.3 202 L 378 341.3 L 235.7 349.3 L 236.3 304 L 245 304 L 262.3 302 L 261.7 298.3 L 267 298 L 267.3 301.3 L 302 296.3 L 302 262 L 245 252 L 245 304 L 236.3 304 L 236.3 236.3 L 377.3 202"); path_d.attr({opacity: '0.52',fill: '#6E8E8A',stroke: '#000000',"stroke-miterlimit": '10','stroke-width': '0','stroke-opacity': '1'}).data('id', 'path_d'); floors.push(path_d);
var path_e = rsr.path("M 378 341.3 L 378 464.3 L 235.7 451.7 L 235.7 406.8 L 245.3 406 L 262.9 405.9 L 262.7 404 L 267.7 404 L 267.7 406.3 L 282 406 L 281.7 403 L 286.7 403 L 286.3 406 L 302 405 L 302 353.7 L 245.7 351.7 L 245.3 406 L 235.7 406.8 L 235.7 349.3 L 378 341.3"); path_e.attr({opacity: '0.52',fill: '#6E8E8A',stroke: '#000000',"stroke-miterlimit": '10','stroke-width': '0','stroke-opacity': '1'}).data('id', 'path_e'); floors.push(path_e);
var path_f = rsr.path("M 378 464.3 L 378 587.3 L 320.5 574 L 314.8 574.8 L 303.3 572.2 L 302.8 570 L 235.7 554 L 235.7 508 L 246 504 L 279.2 498.8 L 279.7 495.7 L 284.7 495.7 L 284.8 498.2 L 302.7 495 L 302 457.6 L 246 452.6 L 246 504 L 235.7 508 L 235.7 451.7 L 378 464.3"); path_f.attr({opacity: '0.52',fill: '#6E8E8A',stroke: '#000000',"stroke-miterlimit": '10','stroke-width': '0','stroke-opacity': '1'}).data('id', 'path_f'); floors.push(path_f);
      for (var i = 0; i < floors.length; i++) {

  

    // Showing off
    floors[i].mouseover(function(e){
    this.node.style.opacity = 0.7;
    this.node.style.cursor = 'pointer';
    

    
  });



  floors[i].mouseout(function(e){
    this.node.style.opacity = 0.3;
    
  });
}

Let's say I resized div coop1 , scaled it down. But svg remains, how to make svg scaled too?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
z_n_r, 2014-07-29
@z_n_r

element.setViewBox(0, 0, width, height );
insert right after var element = Raphael('div', 'width', 'height');
and change the values.
first value (0) - left/right shifts
second value (0) - up/down shifts
and width and height

A
Alexander Taratin, 2014-07-26
@Taraflex

raphaeljs.com/reference.html#Element.transform
raphaeljs.com/reference.html#Element.scale

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question