mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
[Mobile] Fix cards hovered on MatchScreen
This commit is contained in:
@@ -83,6 +83,7 @@ public class Forge implements ApplicationListener {
|
||||
public static boolean autoCache = false;
|
||||
public static int lastButtonIndex = 0;
|
||||
public static String CJK_Font = "";
|
||||
public static int hoveredCount = 0;
|
||||
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName) {
|
||||
if (GuiBase.getInterface() == null) {
|
||||
@@ -920,11 +921,11 @@ public class Forge implements ApplicationListener {
|
||||
|
||||
//mouseMoved and scrolled events for desktop version
|
||||
private int mouseMovedX, mouseMovedY;
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
mouseMovedX = screenX;
|
||||
mouseMovedY = screenY;
|
||||
hoveredCount = 0;
|
||||
//reset
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
|
||||
@@ -96,7 +96,6 @@ public class FCardPanel extends FDisplayObject {
|
||||
public void draw(Graphics g) {
|
||||
if (card == null) { return; }
|
||||
boolean animate = Forge.animatedCardTapUntap;
|
||||
//TODO: FCardPanel ishovered and CardStackPosition is BehindHorz or BehindVert...
|
||||
float mod = isHighlighted()||isHovered() ? getWidth()/16f : 0f;
|
||||
float padding = getPadding();
|
||||
float x = padding-mod/2;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
|
||||
public abstract class FDisplayObject {
|
||||
@@ -130,8 +131,10 @@ public abstract class FDisplayObject {
|
||||
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
||||
listeners.add(this);
|
||||
}
|
||||
//TODO: needs better logic, it must be the only current selectable
|
||||
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY));
|
||||
Forge.hoveredCount = listeners.size();
|
||||
if (!Forge.getCurrentScreen().toString().contains("Match"))
|
||||
Forge.hoveredCount = 1;
|
||||
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
|
||||
scrX = screenX;
|
||||
scrY = screenY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user