示例#1
0
        public override void OnEndDrag(ViewControl vc, Point scrPt)
        {
            if (NodeList.Count > 0)
            {
                for (int k = 0; k < NodeList.Count; k++)
                {
                    IManipulatorNotify notifier = NodeList[k].As <IManipulatorNotify>();
                    if (notifier != null)
                    {
                        notifier.OnEndDrag();
                    }
                }

                var transactionContext = DesignView.Context.As <ITransactionContext>();
                try
                {
                    if (transactionContext.InTransaction)
                    {
                        transactionContext.End();
                    }
                }
                catch (InvalidTransactionException ex)
                {
                    if (transactionContext.InTransaction)
                    {
                        transactionContext.Cancel();
                    }

                    if (ex.ReportError)
                    {
                        Outputs.WriteLine(OutputMessageType.Error, ex.Message);
                    }
                }
            }

            NodeList.Clear();
            m_originalScales       = null;
            m_originalTranslations = null;
            m_hitRegion            = HitRegion.None;
            m_scale = new Vec3F(1, 1, 1);
        }
示例#2
0
        public void FinishTransaction()
        {
            if (NodeList.Count > 0)
            {
                for (int k = 0; k < NodeList.Count; k++)
                {
                    IManipulatorNotify notifier = NodeList[k].As <IManipulatorNotify>();
                    if (notifier != null)
                    {
                        notifier.OnEndDrag();
                    }
                }

                var transactionContexts = TransactionContextList;
                foreach (var t in transactionContexts)
                {
                    try
                    {
                        if (t.InTransaction)
                        {
                            t.End();
                        }
                    }
                    catch (InvalidTransactionException ex)
                    {
                        if (t.InTransaction)
                        {
                            t.Cancel();
                        }
                        if (ex.ReportError)
                        {
                            Outputs.WriteLine(OutputMessageType.Error, ex.Message);
                        }
                    }
                }

                NodeList.Clear();
            }
        }