Slider action 'relative' mode?

Hello

2 quick questions for those in the know:

  1. is there a way to get Slider to behave relatively, aka wherever one clicks, it is the drag that is taking the cursor from where it is (not where clicked) and drags the value relatively?

  2. I search here and the help and the implementation and couldn’t find my answer. If it is possible, how should have I been able to find this info?

thanks !

I don’t know if there’s a simpler solution, but overriding mousedown/mousemove actions is an option:

~relativeSlider = {
	var storedValue;
	Slider().orientation_(\vertical).mouseDownAction_({ |v, x, y|
		storedValue = y / v.bounds.height;
		false;
	}).mouseMoveAction_({ |v, x, y|
		var currentValue = y / v.bounds.height;
		v.value = v.value + storedValue - currentValue;
		storedValue = currentValue;
		false
	})
};
Window().layout_(HLayout(~relativeSlider.value)).front
1 Like

that is very elegant thanks!