Fixed stack page elements not using their defined x/y position

This commit is contained in:
Sollace 2023-08-04 18:11:45 +01:00
parent a6feeceaae
commit eac080d808
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -145,13 +145,14 @@ interface PageElement extends Drawable {
record Stack (DynamicContent.Page page, IngredientWithSpell ingredient, Bounds bounds) implements PageElement { record Stack (DynamicContent.Page page, IngredientWithSpell ingredient, Bounds bounds) implements PageElement {
@Override @Override
public void compile(int y, IViewRoot container) { public void compile(int y, IViewRoot container) {
int xx = 0, yy = 0;
if (container instanceof SpellbookScreen book) { if (container instanceof SpellbookScreen book) {
bounds().left = book.getX(); xx = book.getX();
bounds().top = book.getY(); yy = book.getY();
} }
IngredientTree tree = new IngredientTree( IngredientTree tree = new IngredientTree(
bounds().left + page().getBounds().left, bounds().left + xx + page().getBounds().left,
bounds().top + page().getBounds().top + y + 10, bounds().top + yy + page().getBounds().top + y + 10,
30 30
); );
tree.input(ingredient.getMatchingStacks()); tree.input(ingredient.getMatchingStacks());