public override uint MouseWheel(MouseEventArgs e, GL_ControlBase control) { uint var = 0; foreach (IEditableObject obj in GetObjects()) { var |= obj.MouseWheel(e, control); } foreach (AbstractGlDrawable obj in StaticObjects) { var |= obj.MouseWheel(e, control); } if (CurrentAction != NoAction || ExclusiveAction != NoAction) { CurrentAction.ApplyScrolling(e.Location, e.Delta); ExclusiveAction.ApplyScrolling(e.Location, e.Delta); var |= REDRAW | NO_CAMERA_ACTION; var &= ~REPICK; } return(var); }
public override uint MouseMove(MouseEventArgs e, Point lastMousePos, GL_ControlBase control) { uint var = 0; foreach (IEditableObject obj in GetObjects()) { var |= obj.MouseMove(e, lastMousePos, control); } foreach (AbstractGlDrawable obj in StaticObjects) { var |= obj.MouseMove(e, lastMousePos, control); } if (CurrentAction != NoAction || ExclusiveAction != NoAction) { CurrentAction.UpdateMousePos(e.Location); ExclusiveAction.UpdateMousePos(e.Location); var |= REDRAW | NO_CAMERA_ACTION; var &= ~REPICK; } else { var |= REPICK; } return(var); }
public override uint KeyDown(KeyEventArgs e, GL_ControlBase control) { TransformChangeInfos transformChangeInfos = new TransformChangeInfos(new List <TransformChangeInfo>()); uint var = 0; bool selectionHasChanged = false; if ((CurrentAction != NoAction || ExclusiveAction != NoAction) && e.KeyCode != Keys.V) { CurrentAction.KeyDown(e); ExclusiveAction.KeyDown(e); var = NO_CAMERA_ACTION | REDRAW; } else if (e.KeyCode == Keys.Z) //focus camera on the selection { if (e.Control) { Undo(); } else { BoundingBox box = BoundingBox.Default; foreach (IEditableObject obj in GetObjects()) { obj.GetSelectionBox(ref box); } if (box != BoundingBox.Default) { control.CameraTarget = box.GetCenter(); } } var = REDRAW_PICKING; } else if (e.KeyCode == Keys.Y && e.Control) { Redo(); var = REDRAW_PICKING; } else if (e.KeyCode == Keys.H) //hide/show selected objects { foreach (IEditableObject obj in GetObjects()) { if (obj.IsSelected()) { obj.Visible = e.Shift; } } var = REDRAW_PICKING; } else if (e.KeyCode == Keys.S && e.Shift) //auto snap selected objects { SnapAction action = new SnapAction(); foreach (IEditableObject obj in GetObjects()) { obj.ApplyTransformActionToSelection(action, ref transformChangeInfos); } var = REDRAW_PICKING; } else if (e.KeyCode == Keys.R && e.Shift && e.Control) //reset scale for selected objects { ResetScale action = new ResetScale(); foreach (IEditableObject obj in GetObjects()) { obj.ApplyTransformActionToSelection(action, ref transformChangeInfos); } var = REDRAW_PICKING; } else if (e.KeyCode == Keys.R && e.Shift) //reset rotation for selected objects { ResetRot action = new ResetRot(); foreach (IEditableObject obj in GetObjects()) { obj.ApplyTransformActionToSelection(action, ref transformChangeInfos); } var = REDRAW_PICKING; } else if (e.Control && e.KeyCode == Keys.A) //select/deselect all objects { if (e.Shift) { foreach (IEditableObject obj in GetObjects()) { obj.DeselectAll(control); } selectionHasChanged = true; } if (!e.Shift && multiSelect) { foreach (IEditableObject obj in GetObjects()) { obj.SelectAll(control); } selectionHasChanged = true; } var = REDRAW; } foreach (IEditableObject obj in GetObjects()) { var |= obj.KeyDown(e, control); } foreach (AbstractGlDrawable obj in StaticObjects) { var |= obj.KeyDown(e, control); } if (selectionHasChanged) { UpdateSelection(var); } AddTransformToUndo(transformChangeInfos); return(var); }