コード例 #1
0
        //-///////////////////////////////////////////////////////////////////////
        //-///////////////////////////////////////////////////////////////////////

        public override bool HandleMouseEvent(object sender, MouseEventArgs mea, V2 mouseScenePos)
        {
            _hot = false;

            PointF screenPos, handlePos;
            double thetaOffset;

            if (GetPositions(out screenPos, out handlePos, out thetaOffset))
            {
                if (Misc.ArePointsCloser(mea.Location, handlePos, _handleRadius))
                {
                    _hot = true;
                }
            }

            if ((mea.Button & MouseButtons.Left) != 0)
            {
                if (_dragging)
                {
                    float dx = (float)mea.Location.X - screenPos.X;
                    float dy = (float)mea.Location.Y - screenPos.Y;

                    Attr.SetValue(Math.Atan2(dy, dx) - thetaOffset);
                }
                else
                {
                    if (_hot)
                    {
                        _dragging = true;
                    }
                }
            }
            else
            {
                _dragging = false;
            }

            return(false);
        }