mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Make arrow buttons account for insets
This commit is contained in:
@@ -100,14 +100,15 @@ public class FScrollPane extends SkinnedScrollPane {
|
|||||||
|
|
||||||
//determine bounds of button
|
//determine bounds of button
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
final Insets insets = getInsets();
|
||||||
final int panelWidth = getWidth();
|
final int panelWidth = getWidth();
|
||||||
final int panelHeight = getHeight();
|
final int panelHeight = getHeight();
|
||||||
final int arrowButtonSize = 18;
|
final int arrowButtonSize = 18;
|
||||||
final int cornerSize = arrowButtonSize - 1; //make borders line up
|
final int cornerSize = arrowButtonSize - 1; //make borders line up
|
||||||
|
|
||||||
if (dir < 2) { //if button for horizontal scrolling
|
if (dir < 2) { //if button for horizontal scrolling
|
||||||
y = 0;
|
y = insets.top;
|
||||||
h = panelHeight;
|
h = panelHeight - y - insets.bottom;
|
||||||
if (visible[2]) {
|
if (visible[2]) {
|
||||||
y += cornerSize;
|
y += cornerSize;
|
||||||
h -= cornerSize;
|
h -= cornerSize;
|
||||||
@@ -115,12 +116,12 @@ public class FScrollPane extends SkinnedScrollPane {
|
|||||||
if (visible[3]) {
|
if (visible[3]) {
|
||||||
h -= cornerSize;
|
h -= cornerSize;
|
||||||
}
|
}
|
||||||
x = (dir == 0 ? 0 : panelWidth - arrowButtonSize);
|
x = (dir == 0 ? insets.left : panelWidth - arrowButtonSize - insets.right);
|
||||||
w = arrowButtonSize;
|
w = arrowButtonSize;
|
||||||
}
|
}
|
||||||
else { //if button for vertical scrolling
|
else { //if button for vertical scrolling
|
||||||
x = 0;
|
x = insets.left;
|
||||||
w = panelWidth;
|
w = panelWidth - x - insets.right;
|
||||||
if (visible[0]) {
|
if (visible[0]) {
|
||||||
x += cornerSize;
|
x += cornerSize;
|
||||||
w -= cornerSize;
|
w -= cornerSize;
|
||||||
@@ -128,7 +129,7 @@ public class FScrollPane extends SkinnedScrollPane {
|
|||||||
if (visible[1]) {
|
if (visible[1]) {
|
||||||
w -= cornerSize;
|
w -= cornerSize;
|
||||||
}
|
}
|
||||||
y = (dir == 2 ? 0 : panelHeight - arrowButtonSize);
|
y = (dir == 2 ? insets.top : panelHeight - arrowButtonSize - insets.bottom);
|
||||||
h = arrowButtonSize;
|
h = arrowButtonSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user