Here is a working example of a draggable image with a array containment (jquery UI).
offsetLeft = $('#outerdiv').offset().left;
offsetTop = $('#outerdiv').offset().top;
blockWidth = $('#outerdiv').width();
blockHeight = $('#outerdiv').height();
imgWidth = $('#imgdrag').width();
imgHeight = $('#imgdrag').height();
x1 = offsetLeft + blockWidth - imgWidth;
y1 = offsetTop + blockHeight - imgHeight;
x2 = offsetLeft;
y2 = offsetTop;
$('#imgdrag').draggable({
containment: [x1,y1,x2,y2]
});
Now I rotate the div and my containment fail (not the whole image is display and sometimes you can see the red background color).
How can I recalculate or transform my x1/y1/x2/y2 when I rotate my div?