in the following code re-scaling of the square object goes wrong:
after clicking the button (which apply y-scale factor and make a rectangle out of our square) object displays correct BUT if you touch handles after that the previous scale values erase and the square displays again.
I want to be able to make rectangle in a code and re-scale it uniformly using handles afterwards. How to solve this problem?
<button id="btn" onclick="onClick()">apply scale</button>
<script>
var r = Raphael(100, 0 , 300, 400);
var square = r.rect(100,150, 100, 100).attr({ fill: "#aaa", stroke: "black", opacity: 0.5 });
var ft = r.freeTransform(square, {}, function () {});
ft.setOpts({
attrs: { fill: 'white', stroke: '#000' },
drag: false,
keepRatio: ['axisX', 'axisY'],
size: 5,
scale: ['axisX', 'axisY'],
rotate:false
});
function onClick() {
ft.attrs.scale.y = 2;
ft.apply();
}
</script>
in the following code re-scaling of the square object goes wrong: after clicking the button (which apply y-scale factor and make a rectangle out of our square) object displays correct BUT if you touch handles after that the previous scale values erase and the square displays again.
I want to be able to make rectangle in a code and re-scale it uniformly using handles afterwards. How to solve this problem?