void mPanel_MouseUp(object sender, MouseEventArgs e) { if (CurrentTool != null) { CurrentTool.OnMouseUp(e.X, e.Y); } }
private void panelForm_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { CurrentTool.OnMouseUp(e.X, e.Y); } }
//-------------------------------------------------------------------------------------------------- public void MouseUp(bool shiftKey, ViewportController viewportController) { bool wasSelecting = IsSelecting; IsSelecting = false; if (CurrentTool != null) { if (CurrentTool.OnMouseUp(_MouseEventData, shiftKey)) { // Handled by tool return; } } if (_ToolActions.Any()) { foreach (var toolAction in _ToolActions) { if (toolAction.OnMouseUp(_MouseEventData, shiftKey)) { // Handled by tool action return; } } } if (wasSelecting) { if (_MouseEventData.DetectedEntities.Any()) { // Shape selected Selection.SelectEntities(_MouseEventData.DetectedEntities, !shiftKey); Invalidate(); } else { // Empty click if (!shiftKey) { Selection.SelectEntity(null); Invalidate(); } } } }
protected override void OnToolGUI(Event e) { CurrentTool.OnGUI(e); switch (e.type) { case EventType.MouseDown when MouseRayValid && e.button == 0: IsMouseDown = true; IsMouseMove = false; CurrentTool.OnMouseDown(e); break; case EventType.MouseDrag when MouseRayValid: IsMouseMove = true; CurrentTool.OnMouseDrag(e); break; case EventType.MouseUp when MouseRayValid && e.button == 0: if (IsMouseMove) { CurrentTool.OnMouseUp(e); } else { CurrentTool.OnPrimaryMouseClicked(e); } IsMouseDown = false; break; case EventType.MouseUp when MouseRayValid && e.button == 1: CurrentTool.OnSecondaryMouseClicked(); break; case EventType.KeyUp: CurrentTool.OnKeyUp(e); break; } }
void DrawingCanvas_MouseUp(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { Point loc = e.GetPosition(this); if (CurrentRuler.IsSnapping) { CurrentSnapPosition = new Point(-1, -1); Point snap = new Point(loc.X, loc.Y); if (CurrentRuler.GuideManager.Intersection_GetNearst(ref snap)) { CurrentSnapPosition = snap; CurrentPosition = loc; CurrentTool.OnMouseUp(this, CurrentSnapPosition); return; } Guideline gl = CurrentRuler.GuideManager.GetSnapGuide(loc); if (gl != null) { gl.GetNearestPos(ref snap, CurrentRuler.dPicCapture); CurrentSnapPosition = snap; CurrentPosition = loc; CurrentTool.OnMouseUp(this, CurrentSnapPosition); return; } } CurrentPosition = loc; CurrentTool.OnMouseUp(this, CurrentPosition); //CurrentTool.OnMouseUp(this, e); } }