private void GetKeyInput() { // Key commands: // S -> Snap to grid // C -> Center on X-axis // Shift + C -> Center on all axes Event e = Event.current; switch (e.type) { case EventType.KeyDown: switch (e.keyCode) { case KeyCode.C: m_Comp.CenterDetectionBoundsOnAxes(!e.shift); m_Comp.EditorBounds = m_Comp.DetectionBounds; break; case KeyCode.S: m_Comp.RoundDetectionBoundsCenter(); m_Comp.EditorBounds = m_Comp.DetectionBounds; break; } break; } }
private void OnSceneGUI() { if (m_UpdateFlag) { m_UpdateFlag = false; m_Comp.Validate(); } if (m_Comp) { DrawHandles(); // Key commands: // S -> Snap to grid // C -> Center on X-axis // Shift + C -> Center on all axes Event e = Event.current; switch (e.type) { case EventType.KeyDown: switch (Event.current.keyCode) { case KeyCode.C: m_Comp.RoundDetectionBoundsSize(); m_Comp.CenterDetectionBoundsOnAxes(!e.shift); m_Comp.EditorBounds = m_Comp.DetectionBounds; break; case KeyCode.S: m_Comp.RoundDetectionBoundsSize(); m_Comp.RoundDetectionBoundsCenter(); m_Comp.EditorBounds = m_Comp.DetectionBounds; break; } break; } } }