Esempio n. 1
0
        public Boolean Viewport_MouseMove(Point sceneCoordinates, MouseEventArgs e)
        {
            Boolean needRedraw = false;

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (SelectedObject != null)
                {
                    if (leftMouseDown)
                    {
                        double translateX = (sceneCoordinates.X - previousPosition.X);
                        double translateY = (sceneCoordinates.Y - previousPosition.Y);
                        if (SelectedObject is ResizableRectangleElement)
                        {
                            ResizableRectangleElement componentPainter = (ResizableRectangleElement)SelectedObject;
                            componentPainter.Translate(translateX, translateY);
                            AutosarApplication.GetInstance().ActiveComposition.UpdateConnections();
                            needRedraw = true;
                        }
                        else if (SelectedObject is AnchorPoint)
                        {
                            AnchorPoint anchor = (AnchorPoint)SelectedObject;
                            anchor.Move(translateX, translateY);
                            AutosarApplication.GetInstance().ActiveComposition.UpdateConnections();
                            needRedraw = true;
                        }
                        else if (SelectedObject is PortPainter)
                        {
                            PortPainter portPainter = (PortPainter)SelectedObject;
                            TranslatePortPainter(portPainter, sceneCoordinates, translateX, translateY);
                            AutosarApplication.GetInstance().ActiveComposition.UpdateConnections();
                            needRedraw = true;
                        }
                    }
                }
                previousPosition = sceneCoordinates;
            }
            return(needRedraw);
        }