Only update timeline when default iterp type changed (fixes #127)

This commit is contained in:
Jonas Herzig
2020-04-15 17:40:26 +02:00
parent 6ccb576637
commit 4586cb5382

View File

@@ -105,10 +105,13 @@ public class SPTimeline implements PathingRegistry {
public void setDefaultInterpolatorType(InterpolatorType defaultInterpolatorType) { public void setDefaultInterpolatorType(InterpolatorType defaultInterpolatorType) {
Validate.isTrue(defaultInterpolatorType != InterpolatorType.DEFAULT, "Must not be DEFAULT"); Validate.isTrue(defaultInterpolatorType != InterpolatorType.DEFAULT, "Must not be DEFAULT");
InterpolatorType prevType = this.defaultInterpolatorType;
this.defaultInterpolatorType = Validate.notNull(defaultInterpolatorType); this.defaultInterpolatorType = Validate.notNull(defaultInterpolatorType);
if (prevType != null && prevType != this.defaultInterpolatorType) {
timeline.pushChange(updateInterpolators()); timeline.pushChange(updateInterpolators());
} }
}
public Change setDefaultInterpolator(Interpolator interpolator) { public Change setDefaultInterpolator(Interpolator interpolator) {
Preconditions.checkState(defaultInterpolatorType != null, "Default interpolator type not set."); Preconditions.checkState(defaultInterpolatorType != null, "Default interpolator type not set.");