瀏覽代碼

Change order in which default parameters are computed

Christopher Mullins 6 年之前
父節點
當前提交
9be979eb9f
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 3 3
      lib/Transitions/ChangeFieldOnFinishTransition.cpp
  2. 1 0
      lib/Transitions/FieldTransition.cpp

+ 3 - 3
lib/Transitions/ChangeFieldOnFinishTransition.cpp

@@ -14,9 +14,9 @@ ChangeFieldOnFinishTransition::Builder::Builder(
 { }
 
 std::shared_ptr<Transition> ChangeFieldOnFinishTransition::Builder::_build() const {
-  delegate->setPeriod(this->getPeriod());
-  delegate->setNumPeriods(this->getNumPeriods());
-  delegate->setDurationRaw(this->getDuration());
+  delegate->setDurationRaw(this->getOrComputeDuration());
+  delegate->setNumPeriods(this->getOrComputeNumPeriods());
+  delegate->setPeriod(this->getOrComputePeriod());
 
   return std::make_shared<ChangeFieldOnFinishTransition>(
     delegate->build(),

+ 1 - 0
lib/Transitions/FieldTransition.cpp

@@ -13,6 +13,7 @@ FieldTransition::Builder::Builder(size_t id, const BulbId& bulbId, TransitionFn
 std::shared_ptr<Transition> FieldTransition::Builder::_build() const {
   size_t numPeriods = getOrComputeNumPeriods();
   size_t period = getOrComputePeriod();
+
   int16_t distance = end - start;
   int16_t stepSize = ceil(std::abs(distance / static_cast<float>(numPeriods)));