[Android] enclosed check for FScrollPane drawOverlay

This commit is contained in:
Anthony Calosa
2021-03-01 17:50:44 +08:00
parent 92c6ab27a0
commit d622dc773f

View File

@@ -155,32 +155,36 @@ public abstract class FScrollPane extends FContainer {
@Override
protected void drawOverlay(Graphics g) {
boolean isFieldZoneView = toString().contains("VField")||toString().contains("VZoneDisplay");
//TODO: Consider other ways to indicate scroll potential that fade in and out based on input
//draw triangles indicating scroll potential
if (!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ENABLE_MATCH_SCROLL_INDICATOR))
return;
if (!isFieldZoneView)
return;
if (scrollLeft > 0) {
float x = INDICATOR_MARGIN;
float y = getHeight() / 2;
g.fillTriangle(INDICATOR_COLOR, x, y, x + INDICATOR_SIZE, y - INDICATOR_SIZE, x + INDICATOR_SIZE, y + INDICATOR_SIZE);
}
if (scrollLeft < getMaxScrollLeft()) {
float x = getWidth() - INDICATOR_MARGIN;
float y = getHeight() / 2;
g.fillTriangle(INDICATOR_COLOR, x, y, x - INDICATOR_SIZE, y - INDICATOR_SIZE, x - INDICATOR_SIZE, y + INDICATOR_SIZE);
}
if (scrollTop > 0) {
float x = getWidth() / 2;
float y = INDICATOR_MARGIN;
g.fillTriangle(INDICATOR_COLOR, x, y, x - INDICATOR_SIZE, y + INDICATOR_SIZE, x + INDICATOR_SIZE, y + INDICATOR_SIZE);
}
if (scrollTop < getMaxScrollTop()) {
float x = getWidth() / 2;
float y = getHeight() - INDICATOR_MARGIN;
g.fillTriangle(INDICATOR_COLOR, x, y, x - INDICATOR_SIZE, y - INDICATOR_SIZE, x + INDICATOR_SIZE, y - INDICATOR_SIZE);
try {
boolean isFieldZoneView = toString().contains("VField")||toString().contains("VZoneDisplay");
//TODO: Consider other ways to indicate scroll potential that fade in and out based on input
//draw triangles indicating scroll potential
if (!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ENABLE_MATCH_SCROLL_INDICATOR))
return;
if (!isFieldZoneView)
return;
if (scrollLeft > 0) {
float x = INDICATOR_MARGIN;
float y = getHeight() / 2;
g.fillTriangle(INDICATOR_COLOR, x, y, x + INDICATOR_SIZE, y - INDICATOR_SIZE, x + INDICATOR_SIZE, y + INDICATOR_SIZE);
}
if (scrollLeft < getMaxScrollLeft()) {
float x = getWidth() - INDICATOR_MARGIN;
float y = getHeight() / 2;
g.fillTriangle(INDICATOR_COLOR, x, y, x - INDICATOR_SIZE, y - INDICATOR_SIZE, x - INDICATOR_SIZE, y + INDICATOR_SIZE);
}
if (scrollTop > 0) {
float x = getWidth() / 2;
float y = INDICATOR_MARGIN;
g.fillTriangle(INDICATOR_COLOR, x, y, x - INDICATOR_SIZE, y + INDICATOR_SIZE, x + INDICATOR_SIZE, y + INDICATOR_SIZE);
}
if (scrollTop < getMaxScrollTop()) {
float x = getWidth() / 2;
float y = getHeight() - INDICATOR_MARGIN;
g.fillTriangle(INDICATOR_COLOR, x, y, x - INDICATOR_SIZE, y - INDICATOR_SIZE, x + INDICATOR_SIZE, y - INDICATOR_SIZE);
}
} catch (Exception e) {
e.printStackTrace();
}
}