Exemplo n.º 1
0
        public override void Drag(EventContext Ctx)
        {
            Debug.Assert(Ctx != null && m_DragLastPoint != null);
            if (null == Ctx || null == m_DragLastPoint) return;

            GePoint CurrentPoint = Ctx.MouseWorldPoint;

            SnapContext snapCtx = SnapContext.InitalizeSnapContextFromPreSelection(CurrentPoint);

            SnapMatcher macher = new SnapMatcher(snapCtx);
            m_Intent = new PositionIntent();
            m_Intent.SetPoint(CurrentPoint);
            macher.Match(CurrentPoint, m_Intent);

            GePoint NewCenter = null;
            if (m_Intent.IsValid())
            {
                m_CursorShape = m_Intent.GetCursorShape();

                NewCenter = m_Intent.GetPoint();
            }
            else
            {
                m_CursorShape = "Move.cur";

                GePoint OldCenter = m_Instance.CenterPoint;
                NewCenter = OldCenter
                    + (CurrentPoint - m_DragLastPoint);
            }

            m_Instance.SetCenter(NewCenter);

            m_DragLastPoint = (GePoint)CurrentPoint.Clone();

            m_Instance.Compute();
            UpdateView();
        }