public bool DoSlider(int id, SliderData sliderData, out Vector3 newPosition) { EditorGUI.BeginChangeCheck(); if (HasCurrentCamera()) { newPosition = Handles.Slider2D(id, sliderData.position, sliderData.forward, sliderData.right, sliderData.up, 1f, nullCap, Vector2.zero); } else { newPosition = Slider2D.Do(id, sliderData.position, null); } return(EditorGUI.EndChangeCheck()); }
static internal Rect Do(int controlID) { EventType eventType = Event.current.GetTypeForControl(controlID); if (eventType == EventType.MouseDown) { s_StartPosition = GUIToWorld(Event.current.mousePosition); s_EndPosition = s_StartPosition; s_currentRect.position = s_StartPosition; s_currentRect.size = Vector2.zero; } if (eventType == EventType.Layout) { HandleUtility.AddDefaultControl(controlID); } s_EndPosition = Slider2D.Do(controlID, s_EndPosition); s_currentRect.min = s_StartPosition; s_currentRect.max = s_EndPosition; return(s_currentRect); }
internal Rect Do(int controlID) { var eventType = Event.current.GetTypeForControl(controlID); if (eventType == EventType.MouseDown) { m_StartPosition = ModuleUtility.GUIToWorld(Event.current.mousePosition); m_Position = m_StartPosition; } if (eventType == EventType.Layout) { HandleUtility.AddDefaultControl(controlID); } m_Position = Slider2D.Do(controlID, m_Position); var rect = new Rect(); rect.min = m_StartPosition; rect.max = m_Position; return(rect); }
//Slider for EditorWindows public bool DoSlider(int id, Vector2 position, out Vector2 newPosition) { EditorGUI.BeginChangeCheck(); newPosition = Slider2D.Do(id, position, null); return(EditorGUI.EndChangeCheck()); }