Skip to content

Commit 20a6ca0

Browse files
committed
feat: add a button to swap gradation colors (editor)
1 parent f2df188 commit 20a6ca0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Packages/src/Editor/UIEffectEditor.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,23 @@ public void DrawProperties()
286286
EditorGUILayout.PropertyField(_gradationGradient);
287287
break;
288288
default:
289+
{
289290
EditorGUILayout.PropertyField(_gradationColor1);
290-
EditorGUILayout.PropertyField(_gradationColor2);
291+
var r = EditorGUILayout.GetControlRect();
292+
r.width -= 20;
293+
EditorGUI.PropertyField(r, _gradationColor2);
294+
295+
r.x += r.width;
296+
r.width = 20;
297+
// Swap colors
298+
if (GUI.Button(r, EditorGUIUtility.IconContent("preaudioloopoff"), "iconbutton"))
299+
{
300+
(_gradationColor1.colorValue, _gradationColor2.colorValue)
301+
= (_gradationColor2.colorValue, _gradationColor1.colorValue);
302+
}
303+
291304
break;
305+
}
292306
}
293307

294308
EditorGUILayout.PropertyField(_gradationOffset);

0 commit comments

Comments
 (0)