mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Reduce flicker during zone window resize
This commit is contained in:
@@ -305,6 +305,10 @@ public class FDialog extends SkinnedDialog implements ITitleBarOwner, KeyEventDi
|
|||||||
getRootPane().setCursor(Cursor.getPredefinedCursor(resizeCursor0));
|
getRootPane().setCursor(Cursor.getPredefinedCursor(resizeCursor0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isResizing() {
|
||||||
|
return sizeBeforeResize != null;
|
||||||
|
}
|
||||||
|
|
||||||
private void addResizeSupport() {
|
private void addResizeSupport() {
|
||||||
final JRootPane resizeBorders = getRootPane();
|
final JRootPane resizeBorders = getRootPane();
|
||||||
resizeBorders.addMouseListener(new MouseAdapter() {
|
resizeBorders.addMouseListener(new MouseAdapter() {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class CardArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void doLayout() {
|
public void doLayout() {
|
||||||
if (this.getCardPanels().isEmpty()) {
|
if (this.getCardPanels().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,14 @@ import forge.view.FFrame;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
|
import javax.swing.Timer;
|
||||||
|
|
||||||
|
|
||||||
public class FloatingCardArea extends CardArea {
|
public class FloatingCardArea extends CardArea {
|
||||||
@@ -284,6 +286,29 @@ public class FloatingCardArea extends CardArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doLayout() {
|
||||||
|
if (window.isResizing()) {
|
||||||
|
//delay layout slightly to reduce flicker during window resize
|
||||||
|
layoutTimer.restart();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
finishDoLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Timer layoutTimer = new Timer(250, new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
layoutTimer.stop();
|
||||||
|
finishDoLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
private void finishDoLayout() {
|
||||||
|
super.doLayout();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void mouseOver(final CardPanel panel, final MouseEvent evt) {
|
public final void mouseOver(final CardPanel panel, final MouseEvent evt) {
|
||||||
CMatchUI.SINGLETON_INSTANCE.setCard(panel.getCard(), evt.isShiftDown());
|
CMatchUI.SINGLETON_INSTANCE.setCard(panel.getCard(), evt.isShiftDown());
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Clicking the zone icon under a player's avatar will now hide the zone window if
|
|||||||
After the last card is removed from a zone window, that window will now automatically be hidden. An example of this would be casting the last card in the Flashback zone.
|
After the last card is removed from a zone window, that window will now automatically be hidden. An example of this would be casting the last card in the Flashback zone.
|
||||||
Default size of zone windows has been slightly reduced.
|
Default size of zone windows has been slightly reduced.
|
||||||
Prevent horizontal scrollbar appearing in zone windows.
|
Prevent horizontal scrollbar appearing in zone windows.
|
||||||
|
Reduce flicker when resizing zone windows
|
||||||
|
|
||||||
---------
|
---------
|
||||||
New Cards
|
New Cards
|
||||||
|
|||||||
Reference in New Issue
Block a user