v1.2.0: fixed keyblocker triggering in some cases when it shouldn't

This commit is contained in:
Evan Debenham 2022-02-16 13:26:21 -05:00
parent d7aef5bd39
commit 776661e739

View File

@ -66,7 +66,7 @@ public class InventoryPane extends Component {
//used to prevent clicks through the BG normally, or to cancel selectors if they're enabled //used to prevent clicks through the BG normally, or to cancel selectors if they're enabled
private PointerArea blocker; private PointerArea blocker;
private Signal.Listener keyBlocker; private Signal.Listener<KeyEvent> keyBlocker;
private static InventoryPane instance; private static InventoryPane instance;
@ -107,6 +107,7 @@ public class InventoryPane extends Component {
@Override @Override
public synchronized void destroy() { public synchronized void destroy() {
KeyEvent.removeKeyListener(keyBlocker);
super.destroy(); super.destroy();
if (instance == this) instance = null; if (instance == this) instance = null;
} }
@ -139,7 +140,7 @@ public class InventoryPane extends Component {
keyBlocker = new Signal.Listener<KeyEvent>(){ keyBlocker = new Signal.Listener<KeyEvent>(){
@Override @Override
public boolean onSignal(KeyEvent keyEvent) { public boolean onSignal(KeyEvent keyEvent) {
if (keyEvent.pressed && isSelecting() if (keyEvent.pressed && isSelecting() && InventoryPane.this.visible
&& KeyBindings.getActionForKey(keyEvent) != SPDAction.BAG_1 && KeyBindings.getActionForKey(keyEvent) != SPDAction.BAG_1
&& KeyBindings.getActionForKey(keyEvent) != SPDAction.BAG_2 && KeyBindings.getActionForKey(keyEvent) != SPDAction.BAG_2
&& KeyBindings.getActionForKey(keyEvent) != SPDAction.BAG_3 && KeyBindings.getActionForKey(keyEvent) != SPDAction.BAG_3