Exemplo n.º 1
0
        public void Match(GePoint point, PositionIntent itent)
        {
            Debug.Assert(point != null && itent != null && m_SnapContext != null);
            if (null == point || null == itent) return;

            // Point match
            m_SnapContext.Accept(new GePointVisitor(m_SnapContext, point));
            if(m_SnapContext.HasResult())
            {
                itent.SetGeometryConstraint(m_SnapContext.SnappedGeometryConstraint);
                itent.SetPoint(m_SnapContext.SnappedPoint);
                return;
            }

            // Line match

            return;
        }
Exemplo n.º 2
0
        public override void StartDrag(EventContext Ctx)
        {
            Debug.Assert(Ctx != null);
            if (null == Ctx) return;

            m_DragStartPoint = (GePoint)Ctx.MouseWorldPoint.Clone();
            m_DragLastPoint = (GePoint)Ctx.MouseWorldPoint.Clone();

            m_Node.CanBeSelected = false;

            m_Intent = null;
        }
Exemplo n.º 3
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();
        }