I've been experimenting with scaling different components of an SVG chart using Raphael js. While I have managed to scale the elements (.paths) as desired, I am now facing a challenge in scaling text alongside these scalable elements and applying .attr to the text. Is there a way to simultaneously scale a .path and .text when hovering over them? Could someone please review my jfiddle and provide some guidance on how I can achieve this? Thank you so much!!
var w = 600;
var h = 600;
var paper1 = Raphael("box");
paper1.setViewBox(0,0,w,h,false);
paper1.setSize('100%', '100%');
var ONEgrp = paper1.set();
var ONE = paper1.path("M340.1064,218.2627l97.8281-75.5117c-39.5898-48.9438-100.123-80.2485-167.9785-80.2485V186.019C298.0166,186.019,323.1533,198.5244,340.1064,218.2627z");
ONE.attr({parent: 'ONEgrp',fill: "#EFA35A",stroke:"#fff",'stroke-width':1, cursor: 'pointer'}).data('id', 'ONE');
var ONEtxt = paper1.text(340, 145, "Total Rewards\nManagement\nT1/GR1");
ONEtxt.attr('fill', '#000');
ONEtxt.attr('font-size', '12px');
ONE.mouseover(function(){
if(!ONE.data("over")) {
ONE.attr('opacity',
ONE.attr('opacity')*0.90);
ONE.toFront();
ONE.data("over",true);
ONEtxt.toFront();
}
});
ONE.mouseout(function(){
ONE.attr('opacity',1);
ONE.data("over",false);
ONEtxt.toFront();
});
ONEtxt.mouseover(function(){
if(!ONEtxt.data("over")) {
ONEtxt.attr('opacity',
ONEtxt.attr('opacity')*0.90);
ONEtxt.toFront();
ONEtxt.data("over",true);
}
});
ONEtxt.mouseout(function(){
ONEtxt.toFront();
ONEtxt.attr('opacity',1);
ONEtxt.data("over",false);
});
var rsrGroups = [];
function hovering(e){
this.animate({
transform: 's1.2' }, 100, "elastic");
}
function hoverout(e){
this.animate({
transform: 's1' }, 101);
}
ONE.mouseout(hoverout);
ONE.mouseover(hovering);
ONEtxt.mouseout(hoverout);
ONEtxt.mouseover(hovering);