Browse Source

Make default size of SvgWidget (0,0).

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
165589671d
2 changed files with 9 additions and 0 deletions
  1. +2
    -0
      include/widget/SvgWidget.hpp
  2. +7
    -0
      src/widget/SvgWidget.cpp

+ 2
- 0
include/widget/SvgWidget.hpp View File

@@ -10,6 +10,8 @@ namespace widget {
struct SvgWidget : Widget {
std::shared_ptr<window::Svg> svg;

SvgWidget();

/** Sets the box size to the SVG image size */
void wrap();



+ 7
- 0
src/widget/SvgWidget.cpp View File

@@ -6,6 +6,11 @@ namespace rack {
namespace widget {


SvgWidget::SvgWidget() {
box.size = math::Vec();
}


void SvgWidget::wrap() {
if (svg) {
box.size = svg->getSize();
@@ -15,11 +20,13 @@ void SvgWidget::wrap() {
}
}


void SvgWidget::setSvg(std::shared_ptr<window::Svg> svg) {
this->svg = svg;
wrap();
}


void SvgWidget::draw(const DrawArgs& args) {
if (!svg)
return;


Loading…
Cancel
Save