| 67 | |
| 68 | |
| 69 | void SvgSwitch::onChange(const ChangeEvent& e) { |
| 70 | if (!latch) { |
| 71 | engine::ParamQuantity* pq = getParamQuantity(); |
| 72 | if (!frames.empty() && pq) { |
| 73 | int index = (int) std::round(pq->getValue() - pq->getMinValue()); |
| 74 | index = math::clamp(index, 0, (int) frames.size() - 1); |
| 75 | sw->setSvg(frames[index]); |
| 76 | fb->setDirty(); |
| 77 | } |
| 78 | } |
| 79 | ParamWidget::onChange(e); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | } // namespace app |