forked from External/mage
Chat panel is one touch resizeable. Minor fix for delayed popup. Added sorting layout on BattlefieldPanel resize.
This commit is contained in:
parent
fa2a2888e1
commit
937ddf79a2
3 changed files with 32 additions and 12 deletions
|
|
@ -37,6 +37,7 @@ package mage.client.game;
|
|||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -68,12 +69,20 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
|
|||
private Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
||||
|
||||
protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
|
||||
|
||||
protected static Map<UUID, PermanentView> battlefield;
|
||||
|
||||
/** Creates new form BattlefieldPanel */
|
||||
public BattlefieldPanel(JScrollPane jScrollPane) {
|
||||
ui.put("jScrollPane", jScrollPane);
|
||||
ui.put("battlefieldPanel", this);
|
||||
initComponents();
|
||||
|
||||
addComponentListener(new ComponentAdapter(){
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
sortLayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void init(UUID gameId, BigCard bigCard) {
|
||||
|
|
@ -103,17 +112,23 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
|
|||
}
|
||||
|
||||
if (changed) {
|
||||
Plugins.getInstance().sortPermanents(ui, permanents.values());
|
||||
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
if (permanent.getAttachments() != null) {
|
||||
groupAttachments(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
invalidate();
|
||||
BattlefieldPanel.battlefield = battlefield;
|
||||
sortLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void sortLayout() {
|
||||
Plugins.getInstance().sortPermanents(ui, permanents.values());
|
||||
if (battlefield == null) {return;}
|
||||
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
if (permanent.getAttachments() != null) {
|
||||
groupAttachments(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void addPermanent(PermanentView permanent) {
|
||||
MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, Config.dimensions, gameId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue