Deselect marker when selecting keyframe (and vice versa) (fixes #104)
This commit is contained in:
@@ -2,8 +2,10 @@ package com.replaymod.simplepathing;
|
|||||||
|
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.core.events.SettingsChangedEvent;
|
import com.replaymod.core.events.SettingsChangedEvent;
|
||||||
|
import com.replaymod.replay.ReplayModReplay;
|
||||||
import com.replaymod.replay.events.ReplayCloseEvent;
|
import com.replaymod.replay.events.ReplayCloseEvent;
|
||||||
import com.replaymod.replay.events.ReplayOpenEvent;
|
import com.replaymod.replay.events.ReplayOpenEvent;
|
||||||
|
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
|
||||||
import com.replaymod.replaystudio.pathing.path.Keyframe;
|
import com.replaymod.replaystudio.pathing.path.Keyframe;
|
||||||
import com.replaymod.simplepathing.SPTimeline.SPPath;
|
import com.replaymod.simplepathing.SPTimeline.SPPath;
|
||||||
import com.replaymod.simplepathing.gui.GuiPathing;
|
import com.replaymod.simplepathing.gui.GuiPathing;
|
||||||
@@ -81,20 +83,34 @@ public class ReplayModSimplePathing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GuiReplayOverlay getReplayOverlay() {
|
||||||
|
return ReplayModReplay.instance.getReplayHandler().getOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
private SPTimeline currentTimeline;
|
private SPTimeline currentTimeline;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private SPPath selectedPath;
|
private SPPath selectedPath;
|
||||||
@Getter
|
@Getter
|
||||||
private long selectedTime;
|
private long selectedTime;
|
||||||
|
|
||||||
|
public SPPath getSelectedPath() {
|
||||||
|
if (getReplayOverlay().timeline.getSelectedMarker() != null) {
|
||||||
|
selectedPath = null;
|
||||||
|
selectedTime = 0;
|
||||||
|
}
|
||||||
|
return selectedPath;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSelected(Keyframe keyframe) {
|
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) {
|
public void setSelected(SPPath path, long time) {
|
||||||
selectedPath = path;
|
selectedPath = path;
|
||||||
selectedTime = time;
|
selectedTime = time;
|
||||||
|
if (selectedPath != null) {
|
||||||
|
getReplayOverlay().timeline.setSelectedMarker(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentTimeline(SPTimeline newTimeline) {
|
public void setCurrentTimeline(SPTimeline newTimeline) {
|
||||||
|
|||||||
Reference in New Issue
Block a user