From a23ede9bbbcd965d76bec900aefe57635dd52e61 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 4 Sep 2015 00:22:18 -0400 Subject: [PATCH] v0.3.1b: fixed a bug with centered toolbar and less than 4 quickslots --- .../shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index 73246f810..942ae133a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -207,8 +207,11 @@ public class Toolbar extends Component { //center = group but.. well.. centered, so all we need to do is pre-emptively set the right side further in. case CENTER: - right = width - (width - btnWait.width() - btnSearch.width() - btnInventory.width() - - btnQuick[0].width() - btnQuick[1].width() - btnQuick[2].width() - btnQuick[3].width())/2; + float toolbarWidth = btnWait.width() + btnSearch.width() + btnInventory.width(); + for(Button slot : btnQuick){ + if (slot.visible) toolbarWidth += slot.width(); + } + right = (width + toolbarWidth)/2; case GROUP: btnWait.setPos(right - btnWait.width(), y);