Allow keyframe timeline cursor sync to be toggled (closes #290)
This commit is contained in:
@@ -41,6 +41,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class KeyBindingRegistry extends EventRegistrations {
|
||||
private static final String CATEGORY = "replaymod.title";
|
||||
@@ -176,6 +177,8 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
public final KeyBinding keyBinding;
|
||||
private final List<Runnable> handlers = new ArrayList<>();
|
||||
private final List<Runnable> repeatedHandlers = new ArrayList<>();
|
||||
private boolean autoActivation;
|
||||
private Consumer<Boolean> autoActivationUpdate;
|
||||
|
||||
public Binding(String name, KeyBinding keyBinding) {
|
||||
this.name = name;
|
||||
@@ -199,5 +202,26 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
acc.setPressTime(acc.getPressTime() + 1);
|
||||
handleKeyBindings();
|
||||
}
|
||||
|
||||
public void registerAutoActivationSupport(boolean active, Consumer<Boolean> update) {
|
||||
this.autoActivation = active;
|
||||
this.autoActivationUpdate = update;
|
||||
}
|
||||
|
||||
public boolean supportsAutoActivation() {
|
||||
return autoActivationUpdate != null;
|
||||
}
|
||||
|
||||
public boolean isAutoActivating() {
|
||||
return supportsAutoActivation() && autoActivation;
|
||||
}
|
||||
|
||||
public void setAutoActivating(boolean active) {
|
||||
if (this.autoActivation == active) {
|
||||
return;
|
||||
}
|
||||
this.autoActivation = active;
|
||||
this.autoActivationUpdate.accept(active);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user