public sealed override void SetEvents() { if (CommonMethods.CheckType(this, typeof(ISelectable))) { MouseDown += SelectShape; } if (CommonMethods.CheckType(this, typeof(IMovable))) { MouseDown += SetDragPoint; } if (CommonMethods.CheckType(this, typeof(IEditable))) { MouseDown += ShowProperties; } }
public void MovingShape(object sender, MouseEventArgs e) { if (!GlobalProperties.DrawModeOn) { if (e.LeftButton == MouseButtonState.Pressed && CommonMethods.CheckType(GlobalProperties.selectedShape, typeof(RectanglesModule))) { var rect = (RectanglesModule)GlobalProperties.selectedShape; GlobalProperties.selectedShape.Opacity = GlobalProperties.Opacity; if (!double.IsNaN(rect.dragPoint.X)) { var currentMousePosition = e.GetPosition(GlobalProperties.MainCanvas); var offset = new Point(rect.startPoint.X + (currentMousePosition.X - rect.dragPoint.X), rect.startPoint.Y + (currentMousePosition.Y - rect.dragPoint.Y)); ChangePosition(offset, rect, GlobalProperties.frameSize, currentMousePosition); } } } }
public void SelectShape(object sender, MouseEventArgs e) { if (!GlobalProperties.DrawModeOn) { var rect = (Shapes)sender; if (GlobalProperties.selectedShape != null) { CommonMethods.RemoveSelection(GlobalProperties.selectedShape); } GlobalProperties.selectedShape = rect; GlobalProperties.drawShape = rect; rect.AnglesBorder = GetFocusAngles(rect); if (CommonMethods.CheckType(rect, typeof(IResizable))) { SetAnglesAction(rect); } } }
public void SelectShape(object sender, MouseEventArgs e) { if (!GlobalProperties.DrawModeOn) { var triangle = (TetragonsModule)sender; if (GlobalProperties.selectedShape != null) { CommonMethods.RemoveSelection(GlobalProperties.selectedShape); } triangle.Selection = GetFocusFrame(triangle, GlobalProperties.frameSize); GlobalProperties.selectedShape = triangle; GlobalProperties.drawShape = triangle; triangle.AnglesBorder = GetFocusAngles(triangle, GlobalProperties.frameSize); if (CommonMethods.CheckType(triangle, typeof(IResizable))) { SetAnglesAction(triangle); } } }
public void SelectShape(object sender, MouseEventArgs e) { if (GlobalProperties.DrawModeOn) { return; } var circle = (Shapes)sender; if (GlobalProperties.selectedShape != null) { CommonMethods.RemoveSelection(GlobalProperties.selectedShape); } circle.Selection = GetFocusFrame(circle, GlobalProperties.frameSize); GlobalProperties.selectedShape = circle; GlobalProperties.drawShape = circle; circle.AnglesBorder = GetFocusAngles(circle, GlobalProperties.frameSize); if (CommonMethods.CheckType(circle, typeof(IResizable))) { SetAnglesAction(circle); } }