text: //***********************************************************************************************
  //Geodesics: A modular collection for VCV Rack by Pierre Collard and Marc Boulé
  //
  //See ./LICENSE.txt for all licenses
  //***********************************************************************************************
  
  
  #include "GeoWidgets.hpp"
  
  
  // Dynamic SVGPort
  
  void DynamicSVGPort::addFrame(std::shared_ptr<Svg> svg) {
      frames.push_back(svg);
      if(frames.size() == 1) {
          SvgPort::setSvg(svg);
  	}
  }
  
  
  
  // Dynamic SVGSwitch
  
  void DynamicSVGSwitch::addFrameAll(std::shared_ptr<Svg> svg) {
      framesAll.push_back(svg);
  	if (framesAll.size() == 2) {
  		addFrame(framesAll[0]);
  		addFrame(framesAll[1]);
  	}
  }
  
  
  
  // Dynamic SVGKnob
  
  void DynamicSVGKnob::addFrameAll(std::shared_ptr<Svg> svg) {
      framesAll.push_back(svg);
  	if (framesAll.size() == 1) {
  		setSvg(svg);
  	}
  }
  
  void DynamicSVGKnob::setOrientation(float angle) {
  	tw->removeChild(sw);
  	TransformWidget *tw2 = new TransformWidget();
  	tw2->addChild(sw);
  	tw->addChild(tw2);
  
  	Vec center = sw->box.getCenter();
  	tw2->translate(center);
  	tw2->rotate(angle);
  	tw2->translate(center.neg());
  }
  