Hi I need some help with math for my problem. I have a situation where I need to access the left,top coord of a div whenever a touchstart event is fired. But I need to get it based on the rotation of the div being 0 degree.
I have attached a fiddle which shows my condition. Right now when you press the button, the value is 'x:169, y:195'. But I am looking for some formula to get 'x: 208, y: 234'
document.querySelectorAll('input')[0].addEventListener('click',function() {
var x = Math.round(document.querySelectorAll('#knob')[0].getBoundingClientRect().left),
y = Math.round(document.querySelectorAll('#knob')[0].getBoundingClientRect().top)
alert('x: '+x+', y: '+y);
/*
* Alerts x: 208, y: 234 when angle is 0.
* Need to get this value all the time irrespective of the rotation.
*/
});
Is that possible? I did a lot of search but couldn't find the apt answer. And my math isn't good enough to modify the formulas for the other answers in SO.