@@ -49,6 +49,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
49
49
var value = property . vector2IntValue ;
50
50
var minValue = ( float ) value . x ;
51
51
var maxValue = ( float ) value . y ;
52
+ ( minValue , maxValue ) = ClampValues ( minValue , maxValue , minLimit , maxLimit ) ;
52
53
DrawSlider ( position , property , minLimit , maxLimit , ref minValue , ref maxValue , BuildIntLabel ) ;
53
54
value . x = ( int ) minValue ;
54
55
value . y = ( int ) maxValue ;
@@ -59,12 +60,22 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
59
60
var value = property . vector2Value ;
60
61
var minValue = value . x ;
61
62
var maxValue = value . y ;
63
+ ( minValue , maxValue ) = ClampValues ( minValue , maxValue , minLimit , maxLimit ) ;
62
64
DrawSlider ( position , property , minLimit , maxLimit , ref minValue , ref maxValue , BuildFloatLabel ) ;
63
65
value . x = minValue ;
64
66
value . y = maxValue ;
65
67
property . vector2Value = value ;
66
68
}
67
69
70
+ static ( float , float ) ClampValues ( float minValue , float maxValue , float minLimit , float maxLimit )
71
+ {
72
+ minValue = Math . Max ( minLimit , minValue ) ;
73
+ minValue = Math . Min ( maxLimit , minValue ) ;
74
+ maxValue = Math . Min ( maxLimit , maxValue ) ;
75
+ maxValue = Math . Max ( maxValue , minValue ) ;
76
+ return ( minValue , maxValue ) ;
77
+ }
78
+
68
79
static void DrawSlider ( Rect position , SerializedProperty property , float min , float max , ref float x ,
69
80
ref float y , Func < float , GUIContent > buildLabel )
70
81
{
0 commit comments