0

我正在尝试使中心旋钮与鼠标一起正确旋转,它正在工作,但它似乎与鼠标不对齐并从一侧跳到另一侧。我究竟做错了什么?

计算:

this.angle = Math.atan2((e.clientX - this.center.x), (e.clientY - this.center.y) )*(270 / Math.PI);  
this.knob.style.transform = `rotate(${this.angle}deg)`;  

演示: https ://replit.com/@Nashorn1/RotateKnob#index.html

4

0 回答 0