mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
[Mobile] fix accuracy for mouse hover
This commit is contained in:
@@ -128,6 +128,7 @@ public abstract class FDisplayObject {
|
|||||||
|
|
||||||
public abstract void draw(Graphics g);
|
public abstract void draw(Graphics g);
|
||||||
public void buildTouchListeners(float screenX, float screenY, List<FDisplayObject> listeners) {
|
public void buildTouchListeners(float screenX, float screenY, List<FDisplayObject> listeners) {
|
||||||
|
boolean exact = !GuiBase.isAndroid() && (this instanceof FCardPanel);
|
||||||
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
||||||
listeners.add(this);
|
listeners.add(this);
|
||||||
}
|
}
|
||||||
@@ -136,9 +137,13 @@ public abstract class FDisplayObject {
|
|||||||
Forge.hoveredCount = listeners.size();
|
Forge.hoveredCount = listeners.size();
|
||||||
if (!Forge.getCurrentScreen().toString().contains("Match"))
|
if (!Forge.getCurrentScreen().toString().contains("Match"))
|
||||||
Forge.hoveredCount = 1;
|
Forge.hoveredCount = 1;
|
||||||
|
if (exact) {
|
||||||
|
setHovered(this.enabled && this.visible && ((FCardPanel) this).renderedCardContains(screenToLocalX(screenX), screenToLocalY(screenY)) && Forge.hoveredCount < 2);
|
||||||
|
} else {
|
||||||
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
|
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean press(float x, float y) {
|
public boolean press(float x, float y) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user