1
0
mirror of https://github.com/aNNiMON/HotaruFX.git synced 2024-09-19 14:14:21 +03:00

Remove keyframe duplication check

This commit is contained in:
Victor 2017-08-25 11:31:29 +03:00
parent a34a23372b
commit 0f67442d0a
2 changed files with 1 additions and 16 deletions

View File

@ -1,10 +0,0 @@
package com.annimon.hotarufx.exceptions;
import com.annimon.hotarufx.visual.KeyFrame;
public class KeyFrameDuplicationException extends RuntimeException {
public KeyFrameDuplicationException(KeyFrame keyFrame) {
super("Key frame " + keyFrame.getFrame() + " already exists in timeline");
}
}

View File

@ -1,11 +1,9 @@
package com.annimon.hotarufx.visual; package com.annimon.hotarufx.visual;
import com.annimon.hotarufx.exceptions.KeyFrameDuplicationException;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import javafx.beans.value.WritableValue; import javafx.beans.value.WritableValue;
import lombok.Getter; import lombok.Getter;
import lombok.val;
@Getter @Getter
public class PropertyTimeline<T> { public class PropertyTimeline<T> {
@ -19,10 +17,7 @@ public class PropertyTimeline<T> {
} }
public PropertyTimeline<T> add(KeyFrame keyFrame, T value) { public PropertyTimeline<T> add(KeyFrame keyFrame, T value) {
val previous = keyFrames.put(keyFrame, value); keyFrames.put(keyFrame, value);
if (previous != null) {
throw new KeyFrameDuplicationException(keyFrame);
}
return this; return this;
} }
} }