public void alignItem(ButtonGridItem item) { if (allowNewlines && currentPosition.x + ItemWidth > canvasSize.Width) { currentPosition.x = xStartPosition; currentPosition.y += ItemHeight + ItemPaddingY; } item.setPosition(currentPosition, ItemWidth, ItemHeight); currentPosition.x += item.Width + calculatedPadding; allowNewlines = true; }
public void alignItem(ButtonGridItem item) { int finalWidth = ItemWidth; int textSize = (int)item.TextSize.Width + 10 + extraPadding; if (textSize > finalWidth) { finalWidth = textSize; } if (currentPosition.x + finalWidth > canvasSize.Width) { currentPosition.x = 0; currentPosition.y += ItemHeight + ItemPaddingY; } item.setPosition(currentPosition, finalWidth, ItemHeight); currentPosition.x += item.Width + ItemPaddingX; }
public void alignItem(ButtonGridItem item) { item.setPosition(currentPosition, ItemWidth, ItemHeight); currentPosition.x = 0; currentPosition.y += ItemHeight + ItemPaddingY; }