hi there … i need a simple solution for Senocular’s drag’n’rotate handle sample . I want limited range to rotation only 90 degree angle … or whatever I needed… how can i do this ? I’m not good at code stuff… Thanks already
here is original code from senocular’s sample
handle.grip.onPress = function(){
// when you press the grip in the handle
handle.onMouseMove = function(){
// add a mouse move event to the handle
// get an angle to the mouse using atan2 (gets radians)
var angle = Math.atan2(this._parent._ymouse-this._y,this._parent._xmouse-this._x);
// apply rotation to handle by converting angle into degrees
this._rotation = angle*180/Math.PI;
// rotate the grip opposite the handle so it won't rotate along with it
this.grip._rotation = -this._rotation;
}
}
handle.onMouseUp = function(){
// if a mouse move event, delete it on mouse up
if (this.onMouseMove) delete this.onMouseMove;
}