Fader changing UpDown axis to LeftRight axis

I remember reading a post on GitHub about changing the axis’s on a fader to use it as a crossfader. L/R as opposed to Up/Down

I have the L/R implemented it is just that Up/Down with the mouse is still +/- for the param. I would like to change this behaviour so Left/Right mouse changes the crossfader left and right respectively.

Not sure about 0.6, but I could add a flag to Knob in 1.0.

Is it on drag that the up/down axis is detected. Drag left to right or right to left is what I was thinking. Iv’e not updated the repo to the changes yet, spent the majority of the day coding 1 line :sweat:

I planned on making a a sequencer module also to use 4 axis’s of a mouse, in the form of a crossfader (up/down length of gate L/R time, I was thinking). Is there support for joysticks, same axis no?

In Rack 0.6, you could probably do it with

	void onDragMove(EventDragMove &e) override {
		EventDragMove e2 = e;
		e2.mouseRel = Vec(e.mouseRel.y, -e.mouseRel.x);
		Knob::onDragMove(e2);
	}

in your Knob subclass.

In Rack v1, you can now set horizontal = true in your Knob subclass’s constructor.

1 Like

Sweet. Cheers Andrew will try both tomorrow. :zzz:

If you find that the slider goes the wrong way, try changing that to:

e2.mouseRel = Vec(e.mouseRel.y, -e.mouseRel.x);

where I’ve added a minus sign before the mouseRel.x

This is similar to what I’ve done previously, but Andrew’s code is a bit safer than what I actually did. (I’ve copied Andrew’s suggestion now)

1 Like

Thanks, fixed.

Perfect, works like a charm!

what’s the correct call for horizontal = true;

knob::horizontal = true; :face_with_raised_eyebrow:

It should just be horizontal = true; in the constructor.

Okay, thanks!