diff --git a/include/componentlibrary.hpp b/include/componentlibrary.hpp index 91eebc18..40236012 100644 --- a/include/componentlibrary.hpp +++ b/include/componentlibrary.hpp @@ -680,11 +680,10 @@ struct BefacoTinyKnob : app::SvgKnob { struct BefacoSlidePot : app::SvgSlider { BefacoSlidePot() { - math::Vec margin = math::Vec(3.5, 3.5); - maxHandlePos = math::Vec(-1, -2).plus(margin); - minHandlePos = math::Vec(-1, 87).plus(margin); setBackgroundSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoSlidePot.svg"))); setHandleSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoSlidePotHandle.svg"))); + math::Vec margin = math::Vec(3.5, 3.5); + setHandlePos(math::Vec(-1, 87).plus(margin), math::Vec(-1, -2).plus(margin)); background->box.pos = margin; box.size = background->box.size.plus(margin.mult(2)); } @@ -705,11 +704,10 @@ using LEDSlider = VCVSlider; struct VCVSliderHorizontal : app::SvgSlider { VCVSliderHorizontal() { horizontal = true; - // TODO Fix positions - maxHandlePos = mm2px(math::Vec(22.078, 0.738).plus(math::Vec(0, 2))); - minHandlePos = mm2px(math::Vec(0.738, 0.738).plus(math::Vec(0, 2))); // TODO Fix SVG setBackgroundSvg(Svg::load(asset::system("res/ComponentLibrary/VCVSliderHorizontal.svg"))); + // TODO Fix positions + setHandlePos(mm2px(math::Vec(0.738, 0.738).plus(math::Vec(0, 2))), mm2px(math::Vec(22.078, 0.738).plus(math::Vec(0, 2)))); } }; using LEDSliderHorizontal = VCVSliderHorizontal; diff --git a/src/app/Browser.cpp b/src/app/Browser.cpp index aa917ff1..fc6687e1 100644 --- a/src/app/Browser.cpp +++ b/src/app/Browser.cpp @@ -202,6 +202,9 @@ struct ModelBox : widget::OpaqueWidget { mwc->addChild(moduleWidget); mwc->box.size = moduleWidget->box.size; + // Step ModuleWidget so it can set its default appearance. + moduleWidget->step(); + updateZoom(); } diff --git a/src/app/SvgSlider.cpp b/src/app/SvgSlider.cpp index e44bcf1c..db650966 100644 --- a/src/app/SvgSlider.cpp +++ b/src/app/SvgSlider.cpp @@ -35,7 +35,7 @@ void SvgSlider::setHandleSvg(std::shared_ptr svg) { return; handle->setSvg(svg); - handle->box.pos = minHandlePos; + handle->box.pos = maxHandlePos; fb->setDirty(); } @@ -43,6 +43,9 @@ void SvgSlider::setHandleSvg(std::shared_ptr svg) { void SvgSlider::setHandlePos(math::Vec minHandlePos, math::Vec maxHandlePos) { this->minHandlePos = minHandlePos; this->maxHandlePos = maxHandlePos; + + // Set handle pos to maximum by default + handle->box.pos = maxHandlePos; }