Skip to content

Commit

Permalink
fix MinMaxSlider() indent level
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMa0012 committed Dec 10, 2023
1 parent b39b52d commit 91be5cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Editor/ShaderDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,13 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l
var w = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 0;
Rect inputRect = MaterialEditor.GetRectAfterLabelWidth(controlRect); // this is the remaining rect area after label's area
EditorGUIUtility.labelWidth = w;

// draw label
EditorGUI.PrefixLabel(controlRect, label);

// draw min max slider
var indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
Rect[] splittedRect = Helper.SplitRect(inputRect, 3);

EditorGUI.BeginChangeCheck();
Expand Down Expand Up @@ -408,6 +409,9 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l
minProp.floatValue = Mathf.Clamp(minf, minProp.rangeLimits.x, minProp.rangeLimits.y);
maxProp.floatValue = Mathf.Clamp(maxf, maxProp.rangeLimits.x, maxProp.rangeLimits.y);
}

EditorGUI.indentLevel = indentLevel;
EditorGUIUtility.labelWidth = w;
}
}

Expand Down

0 comments on commit 91be5cd

Please sign in to comment.