mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
[UI] Fixed Issue#454: Enchanted land position is not correct on the layout
This commit is contained in:
parent
bcb91dade1
commit
8ca8d80a5c
2 changed files with 10 additions and 4 deletions
|
@ -33,17 +33,18 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doLayout(JLayeredPane jLayeredPane, int width) {
|
public void doLayout(JLayeredPane jLayeredPane, int width) {
|
||||||
Map<UUID, MagePermanent> permanents = ((BattlefieldPanel)jLayeredPane).getPermanents();
|
Map<UUID, MagePermanent> permanents = ((BattlefieldPanel) jLayeredPane).getPermanents();
|
||||||
JLayeredPane jPanel = ((BattlefieldPanel)jLayeredPane).getMainPanel();
|
JLayeredPane jPanel = ((BattlefieldPanel) jLayeredPane).getMainPanel();
|
||||||
|
|
||||||
int height = Plugins.getInstance().sortPermanents(((BattlefieldPanel)jLayeredPane).getUiComponentsList(), permanents.values());
|
int height = Plugins.getInstance().sortPermanents(((BattlefieldPanel) jLayeredPane).getUiComponentsList(), permanents.values());
|
||||||
jPanel.setPreferredSize(new Dimension(width - 30, height));
|
jPanel.setPreferredSize(new Dimension(width - 30, height));
|
||||||
|
|
||||||
for (PermanentView permanent: ((BattlefieldPanel)jLayeredPane).getBattlefield().values()) {
|
for (PermanentView permanent : ((BattlefieldPanel) jLayeredPane).getBattlefield().values()) {
|
||||||
if (permanent.getAttachments() != null) {
|
if (permanent.getAttachments() != null) {
|
||||||
groupAttachments(jLayeredPane, jPanel, permanents, permanent);
|
groupAttachments(jLayeredPane, jPanel, permanents, permanent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void groupAttachments(JLayeredPane jLayeredPane, JLayeredPane jPanel, Map<UUID, MagePermanent> permanents, PermanentView permanent) {
|
private void groupAttachments(JLayeredPane jLayeredPane, JLayeredPane jPanel, Map<UUID, MagePermanent> permanents, PermanentView permanent) {
|
||||||
|
|
|
@ -151,6 +151,11 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
Stack stack = new Stack();
|
Stack stack = new Stack();
|
||||||
|
|
||||||
|
if (permanent.getOriginalPermanent().getAttachments() != null) {
|
||||||
|
stack.setMaxAttachedCount(permanent.getOriginalPermanent().getAttachments().size());
|
||||||
|
}
|
||||||
|
|
||||||
stack.add(permanent);
|
stack.add(permanent);
|
||||||
allLands.add(insertIndex == -1 ? allLands.size() : insertIndex, stack);
|
allLands.add(insertIndex == -1 ? allLands.size() : insertIndex, stack);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue