From 165589671db26a45ab16bc12ac30ed618e41dc56 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 27 Sep 2021 09:00:27 -0400 Subject: [PATCH] Make default size of SvgWidget (0,0). --- include/widget/SvgWidget.hpp | 2 ++ src/widget/SvgWidget.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/widget/SvgWidget.hpp b/include/widget/SvgWidget.hpp index f80876b5..f230c697 100644 --- a/include/widget/SvgWidget.hpp +++ b/include/widget/SvgWidget.hpp @@ -10,6 +10,8 @@ namespace widget { struct SvgWidget : Widget { std::shared_ptr svg; + SvgWidget(); + /** Sets the box size to the SVG image size */ void wrap(); diff --git a/src/widget/SvgWidget.cpp b/src/widget/SvgWidget.cpp index 552a5d0d..2f15746b 100644 --- a/src/widget/SvgWidget.cpp +++ b/src/widget/SvgWidget.cpp @@ -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 svg) { this->svg = svg; wrap(); } + void SvgWidget::draw(const DrawArgs& args) { if (!svg) return;