mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-04-14 08:02:45 +02:00
DroidFish: In edit board mode, use a larger gap between the board and the setup pieces.
This commit is contained in:
parent
55de4ccdc4
commit
e2ca919e78
@ -41,23 +41,25 @@ public class ChessBoardEdit extends ChessBoard {
|
|||||||
landScape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
|
landScape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static int gap = 4;
|
private final static int getGap(int sqSize) {
|
||||||
|
return sqSize / 4;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getWidth(int sqSize) {
|
protected int getWidth(int sqSize) {
|
||||||
return landScape ? sqSize * 10 + gap : sqSize * 8;
|
return landScape ? sqSize * 10 + getGap(sqSize) : sqSize * 8;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected int getHeight(int sqSize) {
|
protected int getHeight(int sqSize) {
|
||||||
return landScape ? sqSize * 8 : sqSize * 10 + gap;
|
return landScape ? sqSize * 8 : sqSize * 10 + getGap(sqSize);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected int getSqSizeW(int width) {
|
protected int getSqSizeW(int width) {
|
||||||
return landScape ? (width - gap) / 10 : width / 8;
|
return landScape ? (width - getGap(sqSize)) / 10 : width / 8;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected int getSqSizeH(int height) {
|
protected int getSqSizeH(int height) {
|
||||||
return landScape ? height / 8 : (height - gap) / 10;
|
return landScape ? height / 8 : (height - getGap(sqSize)) / 10;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected int getMaxHeightPercentage() { return 85; }
|
protected int getMaxHeightPercentage() { return 85; }
|
||||||
@ -217,12 +219,12 @@ public class ChessBoardEdit extends ChessBoard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getXCrd(int x) {
|
protected int getXCrd(int x) {
|
||||||
return x0 + sqSize * x + ((x >= 8) ? gap : 0);
|
return x0 + sqSize * x + ((x >= 8) ? getGap(sqSize) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getYCrd(int y) {
|
protected int getYCrd(int y) {
|
||||||
return y0 + sqSize * (7 - y) + ((y < 0) ? gap : 0);
|
return y0 + sqSize * (7 - y) + ((y < 0) ? getGap(sqSize) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -230,7 +232,7 @@ public class ChessBoardEdit extends ChessBoard {
|
|||||||
int x = (xCrd - x0) / sqSize;
|
int x = (xCrd - x0) / sqSize;
|
||||||
if (x < 8)
|
if (x < 8)
|
||||||
return x;
|
return x;
|
||||||
return (xCrd - x0 - gap) / sqSize;
|
return (xCrd - x0 - getGap(sqSize)) / sqSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -238,7 +240,7 @@ public class ChessBoardEdit extends ChessBoard {
|
|||||||
int y = 7 - (yCrd - y0) / sqSize;
|
int y = 7 - (yCrd - y0) / sqSize;
|
||||||
if (y >= 0)
|
if (y >= 0)
|
||||||
return y;
|
return y;
|
||||||
return 7 - (yCrd - y0 - gap) / sqSize;
|
return 7 - (yCrd - y0 - getGap(sqSize)) / sqSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user