コード例 #1
0
        protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
        {
            m_RecreateHandles = false;

            Point loc = e.GetPosition(this);

            if (m_dragging && m_draggingHandle != NOT_SELECTED)
            {
                double x, y, z;

                if (Perspective == PerspectiveType.FRONT)
                {
                    // Front
                    x = (m_startDrag.X - loc.X) / m_scale;
                    y = (m_startDrag.Y - loc.Y) / m_scale;
                    z = 0;

                    // Can't change X coordinate on front view of BOW.
                    if (m_editableHull.Bulkheads[m_selectedBulkhead].Type == Bulkhead.BulkheadType.BOW)
                    {
                        x = 0;
                    }
                }
                else if (Perspective == PerspectiveType.SIDE)
                {
                    // Side
                    x = 0;
                    y = (m_startDrag.Y - loc.Y) / m_scale;
                    z = -(m_startDrag.X - loc.X) / m_scale;
                }
                else if (Perspective == PerspectiveType.TOP)
                {
                    // Top
                    x = -(m_startDrag.Y - loc.Y) / m_scale;
                    y = 0;
                    z = -(m_startDrag.X - loc.X) / m_scale;
                }
                else
                {
                    x = 0;
                    y = 0;
                    z = 0;
                }


                m_editableHull.UpdateBulkheadPoint(m_selectedBulkhead, m_draggingHandle, x, y, z);

                m_dragging        = false;
                m_draggingHandle  = NOT_SELECTED;
                m_RecreateHandles = true;

                //FIXTHIS: need to recompute chines?
                InvalidateVisual();
            }

            HullLog undoLog = (HullLog)this.FindResource("UndoLog");

            undoLog.Snapshot();
        }
コード例 #2
0
        //public bool AllowBulkheadMoves;

        public MainWindow()
        {
            InitializeComponent();
            myHull = new Hull();
            myHull.PropertyChanged += hull_PropertyChanged;

            undoLog = (HullLog)this.FindResource("UndoLog");
            undoLog.Clear();
            undoLog.Add(myHull);

            redoLog = (HullLog)this.FindResource("RedoLog");
            redoLog.Clear();
        }
コード例 #3
0
        public DesignControl()
        {
            InitializeComponent();

            BaseHull.Instance().PropertyChanged += hull_PropertyChanged;

            undoLog = (HullLog)this.FindResource("UndoLog");
            undoLog.Clear();
            undoLog.Add(BaseHull.Instance());

            redoLog = (HullLog)this.FindResource("RedoLog");
            redoLog.Clear();
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: trevor34/AVSHull
        //public bool AllowBulkheadMoves;

        public MainWindow()
        {
            InitializeComponent();
            myHull = new Hull();
            myHull.PropertyChanged += hull_PropertyChanged;

            undoLog = (HullLog)this.FindResource("UndoLog");
            undoLog.Clear();
            undoLog.Add(myHull);

            redoLog = (HullLog)this.FindResource("RedoLog");
            redoLog.Clear();

            this.KeyDown += new KeyEventHandler(MainWindow_KeyDown);
            this.KeyUp   += new KeyEventHandler(MainWindow_KeyUp);

            movementStopped = true;
            shifted         = false;
            ctrl            = false;
        }