I am applying a CSS transform (and the browser specific -webkit, -o etc):
transform: matrix(0.5 , 0 , 0, 0.5, 0 , 0);
to a div then using jQuery\'s draggable
None of these solutions worked for me, as for one, I could not transform the parent of the draggables - only the draggables themselves were transformed.
This is how I fixed this issue:
$('.draggable').draggable(
{
cancel: '.restrict-drag',
scroll: false,
containment: '#contain',
start: function(event, ui)
{
ui.position.left = 0;
ui.position.top = 0;
},
drag: function(event, ui)
{
ui.position.left = ui.position.left - ($(event.target).width() * Zoom);
ui.position.top = ui.position.top - ($(event.target).height() * Zoom);
}
});
Zoom is by default 0.
To scale the draggables I did the following:
function changeZoom(zoom)
{
$('.draggable').each(function() { $(this).css('transform-origin', '50% 50%'); $(this).css('transform', 'scale(' + zoom + ')'); });
Zoom = zoom; // Global Zoom-variable
}
And everything seems to work allright.