You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -241,20 +245,20 @@ open class Aether(renderer: UIRenderer) {
241
245
* as de-focusing the focused component and adding listeners to input.
242
246
*/
243
247
companionobject Properties {
248
+
249
+
val timings:Timings=Timings()
250
+
244
251
@JvmStatic
245
252
var debug:Boolean=true
246
253
247
254
@JvmStatic
248
255
lateinitvar instance:Aether
249
-
protected set
250
256
251
257
@JvmStatic
252
258
lateinitvar renderer:UIRenderer
253
-
protected set
254
259
255
260
@JvmStatic
256
261
var activeScreen:UIScreen?=null
257
-
protected set
258
262
259
263
/**
260
264
* The focused component (if applicable).
@@ -265,92 +269,79 @@ open class Aether(renderer: UIRenderer) {
265
269
*/
266
270
@JvmStatic
267
271
var focusedComponent:UIFocusable?=null
268
-
protected set
269
272
270
273
/**
271
274
* The width of the screen. It can be set via [update]
272
275
*/
273
276
@JvmStatic
274
277
var width:Float=0f
275
-
protected set
276
278
277
279
/**
278
280
* The width of the screen. It can be set via [update]
279
281
*/
280
282
@JvmStatic
281
283
var height:Float=0f
282
-
protected set
283
284
284
285
/**
285
286
* The device pixel ratio. It can be set via [update]. It is the equivalent of content scale.
286
287
*/
287
288
@JvmStatic
288
289
var devicePxRatio:Float=1f
289
-
protected set
290
290
291
291
/**
292
292
* The x position of the mouse relative to the screen
293
293
*/
294
294
@JvmStatic
295
295
var mouseX:Float=0f
296
-
protected set
297
296
298
297
/**
299
298
* The y position of the mouse relative to the screen
300
299
*/
301
300
@JvmStatic
302
301
var mouseY:Float=0f
303
-
protected set
304
302
305
303
/**
306
304
* Invoked whenever the layout needs to be updated. This can be when the screen
307
305
* is resized or created. Invoked prior to components.
308
306
*/
309
307
@JvmStatic
310
308
var updateListeners:HashMap<String, Runnable>?=null
311
-
protected set
312
309
313
310
/**
314
311
* The listeners for then the mouse is moved. Invoked prior to components.
315
312
*/
316
313
@JvmStatic
317
314
var mouseMoveListeners:HashMap<String, Runnable>?=null
318
-
protected set
319
315
320
316
/**
321
317
* Invoked when the mouse is pressed. Invoked prior to components.
322
318
*/
323
319
@JvmStatic
324
320
var mousePressedListeners:HashMap<String, Runnable>?=null
325
-
protected set
326
321
327
322
/**
328
323
* Invoked when the mouse is released. Invoked prior to components.
329
324
*/
330
325
@JvmStatic
331
326
var mouseReleasedListeners:HashMap<String, Runnable>?=null
332
-
protected set
333
327
334
328
/**
335
329
* Invoked when a key is pressed. Invoked prior to components.
336
330
*/
337
331
@JvmStatic
338
332
var keyPressListeners:HashMap<String, Consumer<Char>>?=null
339
-
protected set
340
333
341
334
/**
342
335
* Invoked when the mouse is scrolled. Invoked prior to components.
343
336
*/
344
337
@JvmStatic
345
338
var mouseScrollListeners:HashMap<String, Consumer<Float>>?=null
346
-
protected set
347
339
348
340
/**
349
341
* Invoked when the screen is deleted. This is used to deallocate listeners added to UICore.
350
342
*/
351
343
@JvmStatic
352
344
var deallocationListeners:HashMap<String, Runnable>?=null
353
-
protected set
354
345
355
346
/**
356
347
* The list of modifier keys. The value is if the key is pressed
@@ -502,13 +493,7 @@ open class Aether(renderer: UIRenderer) {
502
493
* Focuses the component. Please use [UIComponent.focus] instead.
503
494
*/
504
495
@JvmStatic
505
-
funfocus(component:UIFocusable) {
506
-
// Check if the given value is a valid instance of UIComponent
507
-
try {
508
-
component asUIComponent<*>
509
-
} catch (castException:ClassCastException) {
510
-
throwRuntimeException("When trying to focus, the provided value is not an instance of UIComponent. Make sure you are only using the UIFocus interface to focus UIComponents.")
511
-
}
496
+
fun <T> focus(component:T) where T : UIComponent<*>, T : UIFocusable {
512
497
focusedComponent = component
513
498
}
514
499
@@ -548,7 +533,7 @@ open class Aether(renderer: UIRenderer) {
548
533
for (i in0 until instance.frames!!.size) {
549
534
// UIContainers are what control scrolling, so
550
535
// if it is not an instance of it, skip and continue
551
-
val container = instance.frames!![i] as?UIContainer<*> ?:continue
536
+
val container = instance.frames!![i] as?UIContainer<UIContainerSheet> ?:continue
552
537
if (container.isMouseInsideBounds() && container.expandedHeight >0f&& container.style.overflowY !=UIContainerSheet.Overflow.None) {
553
538
// Iterate through the frame to see if there are more
554
539
// containers with it. If there are, it will pass true
0 commit comments