You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
679B

  1. #include <app/SvgPort.hpp>
  2. namespace rack {
  3. namespace app {
  4. SvgPort::SvgPort() {
  5. fb = new widget::FramebufferWidget;
  6. addChild(fb);
  7. shadow = new CircularShadow;
  8. fb->addChild(shadow);
  9. // Avoid breakage if plugins fail to call setSvg()
  10. // In that case, just disable the shadow.
  11. shadow->box.size = math::Vec();
  12. sw = new widget::SvgWidget;
  13. fb->addChild(sw);
  14. }
  15. void SvgPort::setSvg(std::shared_ptr<Svg> svg) {
  16. sw->setSvg(svg);
  17. fb->box.size = sw->box.size;
  18. box.size = sw->box.size;
  19. // Move shadow downward by 10%
  20. shadow->box.size = sw->box.size;
  21. shadow->box.pos = math::Vec(0, sw->box.size.y * 0.10);
  22. fb->dirty = true;
  23. }
  24. } // namespace app
  25. } // namespace rack