public void ToolMouseDown(object sender, MouseEventArgs e) { this.xInitial = e.X; this.yInitial = e.Y; int flag = 0; if (currentObject != null && !multiselectProcess) { currentObject.ChangeState(StaticState.GetInstance()); } foreach (DrawingObject obj in this.canvas.GetListObjects().Reverse <DrawingObject>()) { if (obj.intersect(e.Location)) { if (!multiselectProcess) { memberGroup.Clear(); } else { if (!memberGroup.Any()) { memberGroup.Add(this.currentObject); } memberGroup.Add(obj); } this.currentObject = obj; obj.ChangeState(EditState.GetInstance()); break; } } }
public void ToolMouseDown(object sender, MouseEventArgs e) { point = e.Location; if (e.Button == MouseButtons.Left && canvas != null) { if (selectedObject == null) { canvas.DeselectAllObjects(); tempGroup.Clear(); } else if (!multiSelect) { selectedObject.ChangeState(StaticState.GetInstance()); } selectedObject = canvas.SelectObjectAt(e.X, e.Y); if (selectedObject != null) { selectedObject.ChangeState(EditState.GetInstance()); if (multiSelect) { tempGroup.Add(selectedObject); } } } else if (e.Button == MouseButtons.Right) { canvas.RemoveDrawingObject(this.selectedObject); } }
public void ToolMouseDown(object sender, MouseEventArgs e) { point = e.Location; if (e.Button == MouseButtons.Left && drawingCanvas != null) { if (currentObject == null) { drawingCanvas.DeselectAll(); tempGroup.Clear(); } else if (!multiSelect) { currentObject.ChangeState(IdleState.GetInstance()); } currentObject = drawingCanvas.SelectObject(e.X, e.Y); if (currentObject != null) { currentObject.ChangeState(EditState.GetInstance()); if (multiSelect) { tempGroup.Add(currentObject); } } } }
public void ToolKeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.E) { Debug.WriteLine("Edit"); Debug.WriteLine(selectedObject.State); selectedObject.ChangeState(EditState.GetInstance()); } }
public void ToolMouseUp(object sender, MouseEventArgs e) { rectangle.ChangeState(EditState.GetInstance()); if (this.rectangle.Height > 0 && this.rectangle.Width > 0) { canvas.initUndoRedo(); } }
public void ToolHotKeysDown(object sender, Keys e) { if (this.selectedObjects.Count() > 0) { Debug.WriteLine("Grouping started"); DrawingGroup drawingGroup = new DrawingGroup(); foreach (DrawingObject obj in this.selectedObjects) { drawingGroup.AddDrawingObject(obj); } drawingGroup.ChangeState(EditState.GetInstance()); this.canvas.AddDrawingObject(drawingGroup); this.selectedObject = drawingGroup; } }
public void ToolMouseDown(object sender, MouseEventArgs e) { this.xInitial = e.X; this.yInitial = e.Y; if (e.Button == MouseButtons.Left && canvas != null) { if (!multiselectState) { canvas.DeselectAllObjects(); this.selectedObjects.Clear(); this.selectedObject = null; } //this.selectedObject = canvas.SelectObjectAt(e.X, e.Y); if (this.selectedObject != null && !multiselectState) { this.selectedObject.ChangeState(StaticState.GetInstance()); } foreach (DrawingObject obj in this.canvas.GetDrawingObjects().Reverse <DrawingObject>()) { if (obj.Intersect(e.X, e.Y)) { if (!this.multiselectState) { this.selectedObjects.Clear(); } else { //if (!selectedObjects.Any()) selectedObjects.Add(this.selectedObject); this.selectedObjects.Add(obj); } this.selectedObject = obj; obj.ChangeState(EditState.GetInstance()); break; } } } }
public void ToolHotKeysDown(object sender, KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.ControlKey) { multiselectProcess = true; } else if (e.KeyCode == System.Windows.Forms.Keys.G) { if (memberGroup.Count() > 0) { Group groupObject = new Group(); foreach (DrawingObject obj in memberGroup) { groupObject.addMember(obj); } groupObject.ChangeState(EditState.GetInstance()); this.canvas.AddDrawingObject(groupObject); this.currentObject = groupObject; } } }
public void onNodeMove() { this.ChangeState(EditState.GetInstance()); this.updateConnectLine(); }