void OnDrawGizmos()
{
if (mVisibleFlag != 0 && mPanel != null && mPanel.debugInfo == UIPanel.DebugInfo.Gizmos && UnityEditor.Selection.activeGameObject != gameObject)
{
Color outline = new Color(1f, 1f, 1f, 0.2f);
// Position should be offset by depth so that the selection works properly
Vector3 pos = Vector3.zero;
pos.z -= mDepth * 0.25f;
Vector3 size = relativeSize;
Vector2 offset = pivotOffset;
Vector4 padding = relativePadding;
float x0 = offset.x * size.x - padding.x;
float y0 = offset.y * size.y + padding.y;
float x1 = x0 + size.x + padding.x + padding.z;
float y1 = y0 - size.y - padding.y - padding.w;
pos.x = (x0 + x1) * 0.5f;
pos.y = (y0 + y1) * 0.5f;
size.x = (x1 - x0);
size.y = (y1 - y0);
// Draw the gizmo
Gizmos.matrix = cachedTransform.localToWorldMatrix;
Gizmos.color = (UnityEditor.Selection.activeGameObject == gameObject) ? new Color(0f, 0.75f, 1f) : outline;
Gizmos.DrawWireCube(pos, size);
// Make the widget selectable
size.z = 0.01f;
Gizmos.color = Color.clear;
Gizmos.DrawCube(pos, size);
}
}