/// <summary> /// Begins an action that happens twice in a row with the mouse. /// </summary> public static HUMEvents.Data.Double Double(this HUMEvents.Data.Mouse mouse) { return(new HUMEvents.Data.Double(mouse)); }
/// <summary> /// Begins an operation where the mouse is left. /// </summary> public static HUMEvents.Data.Left Left(this HUMEvents.Data.Mouse mouse) { return(new HUMEvents.Data.Left(mouse)); }
public static HUMEvents.Data.Is Is(this HUMEvents.Data.Mouse mouse) { return(new HUMEvents.Data.Is(mouse)); }
/// <summary> /// Begins an operation where the mouse is bottom. /// </summary> public static HUMEvents.Data.Bottom Bottom(this HUMEvents.Data.Mouse mouse) { return(new HUMEvents.Data.Bottom(mouse)); }
/// <summary> /// Begins an operation where the mouse is top. /// </summary> public static HUMEvents.Data.Top Top(this HUMEvents.Data.Mouse mouse) { return(new HUMEvents.Data.Top(mouse)); }
/// <summary> /// Begins an operation where the mouse is right. /// </summary> public static HUMEvents.Data.Right Right(this HUMEvents.Data.Mouse mouse) { return(new HUMEvents.Data.Right(mouse)); }
private static Rect Resizer(HUMEvents.Data.Mouse mouse, Rect handleRect, Rect rect, Vector2 minSize, Vector2 maxSize, HUMEvents_Children.Side side, bool mouseDown, ref bool isUsing) { var mousePosition = EditorGUIUtility.GUIToScreenPoint(mouse.e.mousePosition); var delta = HUMEvents.mouseDelta; var handleContains = handleRect.Contains(mousePosition); if (mouse.Left().Clicked() && handleContains) { isUsing = true; HUMEvents_Children.lastLeftClickPosition = mousePosition; } if (mouse.Left().Released()) { isUsing = false; } if (handleContains && !mouseDown) { if (side == HUMEvents_Children.Side.Bottom || side == HUMEvents_Children.Side.Top) { EditorGUIUtility.AddCursorRect(new Rect(mouse.e.mousePosition, new Vector2(34, 34)), MouseCursor.ResizeVertical); } else { EditorGUIUtility.AddCursorRect(new Rect(mouse.e.mousePosition, new Vector2(34, 34)), MouseCursor.ResizeHorizontal); } } if (!mouseDown) { HUMEvents_Children.lastLeftClickPosition = mousePosition; } else { if (isUsing) { if (side == HUMEvents_Children.Side.Bottom || side == HUMEvents_Children.Side.Top) { EditorGUIUtility.AddCursorRect(new Rect(mouse.e.mousePosition, new Vector2(34, 34)), MouseCursor.ResizeVertical); } else { EditorGUIUtility.AddCursorRect(new Rect(mouse.e.mousePosition, new Vector2(34, 34)), MouseCursor.ResizeHorizontal); } var yDeltaMax = (mousePosition.y - rect.y) - (rect.yMax - rect.y); var xDeltaMax = (mousePosition.x - rect.x) - (rect.xMax - rect.x); var yDeltaMin = (mousePosition.y - rect.y) - (rect.yMin - rect.y); var xDeltaMin = (mousePosition.x - rect.x) - (rect.xMin - rect.x); if (mouse.e.type == EventType.MouseDrag) { if (side == HUMEvents_Children.Side.Bottom) { if ((rect.height + yDeltaMax < maxSize.y && rect.height + yDeltaMax > minSize.y) || yDeltaMax > 0) { mouse.e.Use(); return(rect.Add().Height(yDeltaMax)); } } if (side == HUMEvents_Children.Side.Top) { if ((rect.height + yDeltaMin < maxSize.y && rect.height + yDeltaMin > minSize.y) || yDeltaMin < 0) { mouse.e.Use(); return(rect.Subtract().Height(yDeltaMin).Add().Y(yDeltaMin)); } } if (side == HUMEvents_Children.Side.Left) { if ((rect.width + xDeltaMin < maxSize.x && rect.width + xDeltaMin > minSize.x) || xDeltaMin < 0) { mouse.e.Use(); return(rect.Subtract().Width(xDeltaMin).Add().X(xDeltaMin)); } } if (side == HUMEvents_Children.Side.Right) { if ((rect.width + xDeltaMax < maxSize.x && rect.width + xDeltaMax > minSize.x) || xDeltaMax > 0) { mouse.e.Use(); return(rect.Add().Width(xDeltaMax)); } } mouse.e.Use(); } } } return(rect); }