Skip to content

v14.2.3

…zed space. This allows to have special drag-modes that round values, depending on mouse button used.

Example in new Inner Pitch:

class InnerPitchKnob : UIImageKnob
{
public:
nothrow:
@nogc:

    this(UIContext context, KnobImage knobImage, Parameter parameter)
    {
        super(context, knobImage, parameter);
    }

    override double roundParamValue(double normalizedValue, MouseState mstate)
    {
        if (mstate.rightButtonDown)
        {
            float roundedPitch = cast(int)(0.5 + 48 * normalizedValue);
            roundedPitch /= 48;
            if (roundedPitch < 0)
                roundedPitch = 0;
            if (roundedPitch > 1)
                roundedPitch = 1;

            return roundedPitch; // special drag
        }
        else
        {
            return normalizedValue; // normal drag
        }
    }
}
Assets 2