Rotate the drawing of a parameter (switch)

Is there a way to rotate an element on my panel without creating a custom element? I’m okay using the built in 2-way CKSS switch but I need to rotate it 90 degrees to match my physical hardware.

addParam(createParamCentered(mm2px(Vec(43.714, 15.193)), module, MY_MODULE::ONE_SWITCH));

Thanks! Rick

You can try nesting the widget inside a TransformWidget, but for my modules I just made a CKSSHorizontal. Note there is already a CKSSThreeHorizontal in the common library, just not a CKSSHorizontal.

1 Like

Oh cool, I didn’t know about TransformWidget. I’m filing that away for future use.

Yeah, I had used the CKSSThreeHorizontal as I have a bunch of those in my module as well, haha. I decided to just go through the process of creating a custom control and wow was that easy. I just created a widgets/switches.hpp under src, included that file, then added:

#pragma once

#include “rack.hpp”

struct Switch2Horiz : app::SvgSwitch {
        Switch2Horiz() {
            addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/CKSS_0H.svg")));
            addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/CKSS_1H.svg")));
        }
};

Works like a charm!!