Use same border for hovered and selected items

This commit is contained in:
drdev
2014-02-04 18:06:33 +00:00
parent 42e6dffda2
commit ffee3af0ac

View File

@@ -766,23 +766,16 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
private void drawItemImage(Graphics2D g, ItemInfo itemInfo) {
Rectangle bounds = itemInfo.getBounds();
final int itemWidth = bounds.width;
final int selBorderSize = Math.max(1, Math.round(itemWidth * GAP_SCALE_FACTOR / 2) - 1);
final int selBorderSize = 1;
final int borderSize = Math.round(itemWidth * CardPanel.BLACK_BORDER_SIZE);
final int cornerSize = Math.max(4, Math.round(itemWidth * CardPanel.ROUNDED_CORNER_SIZE));
if (itemInfo.selected) {
if (itemInfo.selected || itemInfo == hoveredItem) {
g.setColor(Color.green);
g.fillRoundRect(bounds.x - selBorderSize, bounds.y - selBorderSize,
bounds.width + 2 * selBorderSize, bounds.height + 2 * selBorderSize,
cornerSize + selBorderSize, cornerSize + selBorderSize);
}
else if (itemInfo == hoveredItem) {
int hoverBorderSize = Math.max(1, selBorderSize / 2);
g.setColor(Color.green);
g.fillRoundRect(bounds.x - hoverBorderSize, bounds.y - hoverBorderSize,
bounds.width + 2 * hoverBorderSize, bounds.height + 2 * hoverBorderSize,
cornerSize + hoverBorderSize, cornerSize + hoverBorderSize);
}
g.setColor(Color.black);
g.fillRoundRect(bounds.x, bounds.y, bounds.width, bounds.height, cornerSize, cornerSize);