Please take a look at my jsfiddle to understand my problem: The yellow is the parent div that you can rotate by using the red circle, it's also draggable, inside this div there is another div with a black border that we could consider as a containment to the blue circle. The blue circle is draggable within the containment boundaries, the y coordinate only is required nothing more, the problem happens if you rotate the yellow div ex; 90 degrees or more, the mouse coordinates are not matching the expected dragging position, I've tried to solve the issue by using trigonometry and reversing the axis but it in-vain, I hope someone could solve this and leave a jsfiddle for a working sample is highly appreciated. 'please don't direct me to other posts as I think I have read everything related to this issue'
HTML
<div id="container">
<div id="containment">
<div id="circle"></div>
</div>
</div>
CSS
#container{width:100px;
height:140px;
background:#FFEB3B;
position:absolute;
top:50%;
bottom:50%;
margin-top:-70px;
margin-right:-50px}
.ui-rotatable-handle {
height: 30px;
width: 30px;
cursor: pointer;
background:#ff0000;
border-radius:50%;
right: -15px;
bottom: -15px;
position:absolute;
z-index:1}
#containment{width:30px;
height:190px;
position:absolute;
bottom:70px;
left:35px;
border:solid 1px #000}
#circle{width:30px;
height:30px;
position:absolute;
top:0;
left:0;
border-radius:50%;
background:#3F51B5}
JavaScript
$(function(){
$('#container').draggable().rotatable();
$('#circle').draggable({containment: $('#containment')
});
});