Skip to content

Commit

Permalink
Added Scene#getHoverElement
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Aug 16, 2024
1 parent 6ecc39b commit e9573c9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions arc-core/src/arc/scene/Scene.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,16 @@ public void registerStyles(Object obj){
.each(f -> f.getName().startsWith("default"), f -> addStyle(f.getType(), Reflect.get(obj, f)));
}

public @Nullable Element getHoverElement(){
return mouseOverElement;
}

public boolean hasField(){
return getKeyboardFocus() instanceof TextField;
}

public boolean hasMouse(){
return hit(Core.input.mouseX(), Core.input.mouseY(), true) != null;
return mouseOverElement != null;
}

public boolean hasMouse(float mousex, float mousey){
Expand Down Expand Up @@ -178,8 +182,11 @@ public void act(float delta){
pointerOverActors[pointer] = fireEnterAndExit(overLast, pointerScreenX[pointer], pointerScreenY[pointer], pointer);
}
// Update over element for the mouse on the desktop.
if(Core.app.isDesktop() || Core.app.isWeb())
if(Core.app.isDesktop() || Core.app.isWeb()){
mouseOverElement = fireEnterAndExit(mouseOverElement, mouseScreenX, mouseScreenY, -1);
}else{
mouseOverElement = hit(mouseScreenX, mouseScreenY, true);
}

if(scrollFocus != null && (!scrollFocus.visible || scrollFocus.getScene() == null)) scrollFocus = null;
if(keyboardFocus != null && (!keyboardFocus.visible || keyboardFocus.getScene() == null)) keyboardFocus = null;
Expand Down

0 comments on commit e9573c9

Please sign in to comment.