Reputation: 7133
Is that possible with Raphael.FreeTransform to rotate an element, without scaling it?
When I initialize my element with scale: false, rotate: true
I can only rotate it without scaling and that's OK. I wan't to achieve the same but when rotate start
event occurs, ie. I want to change the scale
dynamically from the callback function:
ft = paper.freeTransform(rect, {}, function(ft, events) {
if (events.indexOf("rotate start") !== -1) {
ft.setOpts({scale: false});
}
});
The element is initialized with the following properties:
ft.setOpts({
keepRatio: false,
draw: 'bbox',
snap: {
rotate: 45
},
keepRatio: ['axisX', 'axisY']
});
Upvotes: 0
Views: 484
Reputation: 7133
I actually figured out how to do this. Just initialize FreeTransform with the following parameters:
ft.setOpts({
drag: ['center', 'self'],
rotate: ['axisY'],
scale: ['bboxCorners', 'bboxSides'],
keepRatio: ['bboxCorners'],
snap: {
rotate: 45
},
draw: 'bbox'
});
http://alias.io/raphael/free_transform/ helped a lot in figuring this out.
Upvotes: 1