v2.5.0: slightly adjusted spacing for item slots and item buttons
This commit is contained in:
@@ -81,7 +81,12 @@ public class ItemButton extends Component {
|
||||
bg.y = y;
|
||||
bg.size( width, height );
|
||||
|
||||
slot.setRect( x + 2, y + 2, width - 4, height - 4 );
|
||||
slot.setRect(x, y, width, height);
|
||||
if (width() >= 24 || height >= 24) {
|
||||
slot.setMargins(2, 2, 2, 2);
|
||||
} else {
|
||||
slot.setMargins(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public Item item(){
|
||||
|
||||
@@ -153,8 +153,14 @@ public class ItemSlot extends Button {
|
||||
}
|
||||
|
||||
if (itemIcon != null){
|
||||
itemIcon.x = x + width - (ItemSpriteSheet.Icons.SIZE + itemIcon.width())/2f - margin.right;
|
||||
itemIcon.y = y + (ItemSpriteSheet.Icons.SIZE - itemIcon.height)/2f + margin.top;
|
||||
//center the icon slightly if there is enough room
|
||||
if (width >= 24 || height >= 24) {
|
||||
itemIcon.x = x + width - (ItemSpriteSheet.Icons.SIZE + itemIcon.width()) / 2f - margin.right;
|
||||
itemIcon.y = y + (ItemSpriteSheet.Icons.SIZE - itemIcon.height) / 2f + margin.top;
|
||||
} else {
|
||||
itemIcon.x = x + width - itemIcon.width() - margin.right;
|
||||
itemIcon.y = y + margin.top;
|
||||
}
|
||||
PixelScene.align(itemIcon);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user