Deselect marker when selecting keyframe (and vice versa) (fixes #104)

This commit is contained in:
Jonas Herzig
2018-01-16 15:08:17 +01:00
parent e854635a34
commit 5a1e893a45

View File

@@ -2,8 +2,10 @@ package com.replaymod.simplepathing;
import com.replaymod.core.ReplayMod;
import com.replaymod.core.events.SettingsChangedEvent;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.events.ReplayCloseEvent;
import com.replaymod.replay.events.ReplayOpenEvent;
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
import com.replaymod.replaystudio.pathing.path.Keyframe;
import com.replaymod.simplepathing.SPTimeline.SPPath;
import com.replaymod.simplepathing.gui.GuiPathing;
@@ -81,20 +83,34 @@ public class ReplayModSimplePathing {
}
}
private GuiReplayOverlay getReplayOverlay() {
return ReplayModReplay.instance.getReplayHandler().getOverlay();
}
private SPTimeline currentTimeline;
@Getter
private SPPath selectedPath;
@Getter
private long selectedTime;
public SPPath getSelectedPath() {
if (getReplayOverlay().timeline.getSelectedMarker() != null) {
selectedPath = null;
selectedTime = 0;
}
return selectedPath;
}
public boolean isSelected(Keyframe keyframe) {
return selectedPath != null && currentTimeline.getKeyframe(selectedPath, selectedTime) == keyframe;
return getSelectedPath() != null && currentTimeline.getKeyframe(selectedPath, selectedTime) == keyframe;
}
public void setSelected(SPPath path, long time) {
selectedPath = path;
selectedTime = time;
if (selectedPath != null) {
getReplayOverlay().timeline.setSelectedMarker(null);
}
}
public void setCurrentTimeline(SPTimeline newTimeline) {