File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
flixel/system/debug/watch Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ class EditableTextField extends TextField implements IFlxDestroyable
93
93
case TBool :
94
94
text = if (text == " true" ) " false" else " true" ;
95
95
selectEnd ();
96
+ case TEnum (e ):
97
+ cycleEnumValue (e , FlxMath .signOf (modifier ));
98
+ selectEnd ();
96
99
case _ :
97
100
setSelection (selection , selection );
98
101
}
@@ -114,6 +117,21 @@ class EditableTextField extends TextField implements IFlxDestroyable
114
117
text = Std .string (value );
115
118
}
116
119
120
+ private function cycleEnumValue (e : Enum <Dynamic >, modifier : Int ): Void
121
+ {
122
+ var values = e .getConstructors ();
123
+ var index = values .indexOf (text );
124
+ if (index == - 1 )
125
+ index = 0 ;
126
+ else
127
+ {
128
+ index + = modifier ;
129
+ if (index > values .length )
130
+ index = 0 ;
131
+ }
132
+ text = Std .string (values [index ]);
133
+ }
134
+
117
135
private function onFocusLost (_ )
118
136
{
119
137
setIsEditing (false );
@@ -129,6 +147,9 @@ class EditableTextField extends TextField implements IFlxDestroyable
129
147
#end
130
148
case TBool if (text == " true" ): true ;
131
149
case TBool if (text == " false" ): false ;
150
+ case TEnum (e ):
151
+ try Type .createEnum (e , text )
152
+ catch (_ : Dynamic ) null ;
132
153
case _ : text ;
133
154
}
134
155
You can’t perform that action at this time.
0 commit comments