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.

33 lines
672B

  1. #include "app.hpp"
  2. namespace rack {
  3. SVGPort::SVGPort() {
  4. shadow = new CircularShadow;
  5. addChild(shadow);
  6. // Avoid breakage if plugins fail to call setSVG()
  7. // In that case, just disable the shadow.
  8. shadow->box.size = math::Vec();
  9. background = new SVGWidget;
  10. addChild(background);
  11. }
  12. void SVGPort::setSVG(std::shared_ptr<SVG> svg) {
  13. background->setSVG(svg);
  14. box.size = background->box.size;
  15. shadow->box.size = background->box.size;
  16. shadow->box.pos = math::Vec(0, background->box.size.y * 0.1);
  17. // shadow->box = shadow->box.grow(math::Vec(2, 2));
  18. }
  19. void SVGPort::draw(NVGcontext *vg) {
  20. Port::draw(vg);
  21. FramebufferWidget::draw(vg);
  22. }
  23. } // namespace rack