GUI sencitivity areas

I’m using the default GUI style. The ‘click’ areas of toggles and scrollbars are overlapping so that the click and/or drag effects the other controls. What controls the limits of the GUI control’s sensitivity? Thanks.

The “limits” of a GUI control is it’s Rect since the control functions (Button, Toggle, …) just call GUIStyle.Draw which uses rect.Contains() to test if the mouse position is inside the element.

This is the Draw method of GUIStyle:

public void Draw(Rect position, GUIContent content, int controlID, bool on)
{
	if (Event.current.type != EventType.Repaint)
	{
		Debug.LogError("Style.Draw may not be called if it is not a repaint event");
		return;
	}
	Event current = Event.current;
	bool flag = position.Contains(current.mousePosition);
	bool flag2 = flag && GUIClip.enabled;
	bool isHover = flag2 && (GUIUtility.hotControl == controlID || GUIUtility.hotControl == 0);
	if (flag2)
	{
		GUIUtility.mouseUsed = true;
	}
	bool flag3 = controlID == GUIUtility.hotControl && GUI.enabled && flag;
	bool flag4 = GUIUtility.keyboardControl == controlID && GUI.enabled && GUIStyle.showKeyboardFocus;
	GUIStyle.Internal_Draw(this.m_Ptr, position, content.text, content.image, isHover, flag3, on, flag4);
	if (content.tooltip != null && content.tooltip != string.Empty && !flag3)
	{
		if (flag3 || GUIUtility.hotControl == controlID || (flag2 && GUIClip.visibleRect.Contains(Event.current.mousePosition)))
		{
			GUI.s_EditorTooltip = (GUI.s_MouseTooltip = content.tooltip);
			Vector2 vector = GUIUtility.GUIToScreenPoint(new Vector2(position.x, position.y));
			GUI.s_ToolTipRect = new Rect(vector.x, vector.y, position.width, position.height);
		}
		if (flag4)
		{
			GUI.s_EditorTooltip = (GUI.s_KeyTooltip = content.tooltip);
		}
	}
}

If you’re interested in how the GUI system works behind the scenes, just use a Reflector like ILSpy