mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
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,7 +112,14 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
|
|||
}
|
||||
|
||||
if (changed) {
|
||||
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) {
|
||||
|
|
@ -113,7 +129,6 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
|
|||
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void addPermanent(PermanentView permanent) {
|
||||
MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, Config.dimensions, gameId);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
package mage.client.game;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
|
|
@ -410,6 +411,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
// </editor-fold>//GEN-END:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
abilityPicker = new mage.client.game.AbilityPicker();
|
||||
|
|
@ -440,8 +442,9 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
chatPanel = new mage.client.chat.ChatPanel();
|
||||
|
||||
jSplitPane1.setBorder(null);
|
||||
jSplitPane1.setDividerSize(3);
|
||||
jSplitPane1.setDividerSize(7);
|
||||
jSplitPane1.setResizeWeight(1.0);
|
||||
jSplitPane1.setOneTouchExpandable(true);
|
||||
jSplitPane1.setMinimumSize(new java.awt.Dimension(26, 48));
|
||||
|
||||
pnlGameInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
|
@ -636,6 +639,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(pnlGameInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jPanel3.setMinimumSize(new Dimension(1024, 768));
|
||||
jSplitPane1.setLeftComponent(jPanel3);
|
||||
|
||||
chatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
|
||||
|
|
@ -651,7 +655,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
}
|
||||
|
||||
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConcedeActionPerformed
|
||||
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
this.popupCard = null;
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
ArrowBuilder.removeAllArrows();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue