File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -223,15 +223,28 @@ protected override void LoadComplete()
223
223
inputManager = GetContainingInputManager ( ) ! ;
224
224
}
225
225
226
+ private double timeUntilCollapse ;
227
+
228
+ private const double collapse_grace_time = 180 ;
229
+ private const float collapse_grace_position = 40 ;
230
+
226
231
protected override void Update ( )
227
232
{
228
233
base . Update ( ) ;
229
234
230
- if ( ExpandedState . Value == ModCustomisationPanelState . Expanded
231
- && ! ReceivePositionalInputAt ( inputManager . CurrentState . Mouse . Position )
232
- && inputManager . DraggedDrawable == null )
235
+ if ( ExpandedState . Value == ModCustomisationPanelState . Expanded )
233
236
{
234
- ExpandedState . Value = ModCustomisationPanelState . Collapsed ;
237
+ bool canCollapse = ! DrawRectangle . Inflate ( new Vector2 ( collapse_grace_position ) ) . Contains ( ToLocalSpace ( inputManager . CurrentState . Mouse . Position ) )
238
+ && inputManager . DraggedDrawable == null ;
239
+
240
+ if ( canCollapse )
241
+ {
242
+ if ( timeUntilCollapse <= 0 )
243
+ ExpandedState . Value = ModCustomisationPanelState . Collapsed ;
244
+ timeUntilCollapse -= Time . Elapsed ;
245
+ }
246
+ else
247
+ timeUntilCollapse = collapse_grace_time ;
235
248
}
236
249
}
237
250
}
You can’t perform that action at this time.
0 commit comments