Skip to content

Commit

Permalink
Allow ButtonToLockKeyAction as part of ButtonToCycleAction
Browse files Browse the repository at this point in the history
  • Loading branch information
bwRavencl committed Dec 19, 2024
1 parent 4662da2 commit 7f5d9b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ public void doAction(final Input input, final int component, Byte value) {
}

private void doActionAndAdvanceIndex(final Input input, final int component) {
actions.get(index).doAction(input, component, Byte.MAX_VALUE);
final var action = actions.get(index);

action.doAction(input, component, Byte.MAX_VALUE);
if (action instanceof final ButtonToLockKeyAction buttonToLockKeyAction) {
buttonToLockKeyAction.resetWasUp();
}

if (index == actions.size() - 1) {
index = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import de.bwravencl.controllerbuddy.input.action.gui.LockKeyEditorBuilder;
import java.text.MessageFormat;

@Action(label = "BUTTON_TO_LOCK_KEY_ACTION", category = ActionCategory.BUTTON, order = 116)
@Action(label = "BUTTON_TO_LOCK_KEY_ACTION", category = ActionCategory.BUTTON_AND_CYCLES, order = 116)
public final class ButtonToLockKeyAction extends DescribableAction<Byte>
implements IButtonToAction, IInitializationAction<Byte> {

Expand Down Expand Up @@ -73,7 +73,7 @@ public LockKey getLockKey() {

@Override
public void init(final Input input) {
wasUp = true;
resetWasUp();
}

@Override
Expand All @@ -85,6 +85,10 @@ public boolean isOn() {
return on;
}

void resetWasUp() {
wasUp = true;
}

public void setLockKey(final LockKey lockKey) {
virtualKeyCode = lockKey;
}
Expand Down

0 comments on commit 7f5d9b9

Please sign in to comment.