From 29c4199b831e9ee0b44e31b4f20c39e6deac2b7a Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 6 Sep 2024 15:07:35 -0400 Subject: [PATCH] Reverted hit() optimizations for now --- arc-core/src/arc/scene/Scene.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arc-core/src/arc/scene/Scene.java b/arc-core/src/arc/scene/Scene.java index 8b61610d..ba64c04b 100644 --- a/arc-core/src/arc/scene/Scene.java +++ b/arc-core/src/arc/scene/Scene.java @@ -90,11 +90,12 @@ public void registerStyles(Class type){ public void registerStyles(Object obj){ Seq.with(obj.getClass().getFields()) - .each(f -> f.getName().startsWith("default"), f -> addStyle(f.getType(), Reflect.get(obj, f))); + .each(f -> f.getName().startsWith("default"), f -> addStyle(f.getType(), Reflect.get(obj, f))); } public @Nullable Element getHoverElement(){ - return mouseOverElement; + //TODO: this is slow, use mouseOverElement instead? + return hit(Core.input.mouseX(), Core.input.mouseY(), true); } public boolean hasField(){ @@ -102,7 +103,7 @@ public boolean hasField(){ } public boolean hasMouse(){ - return mouseOverElement != null; + return getHoverElement() != null; } public boolean hasMouse(float mousex, float mousey){