42template <
typename ValueType>
57 convertFrom0To1Function (std::move (
other.convertFrom0To1Function)),
58 convertTo0To1Function (std::move (
other.convertTo0To1Function)),
59 snapToLegalValueFunction (std::move (
other.snapToLegalValueFunction))
71 convertFrom0To1Function = std::move (
other.convertFrom0To1Function);
72 convertTo0To1Function = std::move (
other.convertTo0To1Function);
73 snapToLegalValueFunction = std::move (
other.snapToLegalValueFunction);
149 if (convertTo0To1Function !=
nullptr)
150 return clampTo0To1 (convertTo0To1Function (
start,
end,
v));
175 if (convertFrom0To1Function !=
nullptr)
201 if (snapToLegalValueFunction !=
nullptr)
202 return snapToLegalValueFunction (
start,
end,
v);
263 void checkInvariants()
const
281 using ConversionFunction = std::function<ValueType(ValueType, ValueType, ValueType)>;
283 ConversionFunction convertFrom0To1Function = {},
284 convertTo0To1Function = {},
285 snapToLegalValueFunction = {};
Holds a resizable array of primitive or copy-by-value objects.
ElementType * end() const noexcept
Returns a pointer to the element which follows the last element in the array.
Represents a mapping between an arbitrary range of values and a normalised 0->1 range.
ValueType skew
An optional skew factor that alters the way values are distribute across the range.
ValueType end
The maximum value of the non-normalised range.
bool symmetricSkew
If true, the skew factor applies from the middle of the slider to each of its ends.
ValueType snapToLegalValue(ValueType v) const noexcept
Takes a non-normalised value and snaps it based on either the interval property of this NormalisedRan...
NormalisableRange()=default
Creates a continuous range that performs a dummy mapping.
ValueType start
The minimum value of the non-normalised range.
ValueType convertFrom0to1(ValueType proportion) const noexcept
Uses the properties of this mapping to convert a normalised 0->1 value to its full-range representati...
NormalisableRange(ValueType rangeStart, ValueType rangeEnd) noexcept
Creates a NormalisableRange with a given range, continuous interval, but a dummy skew-factor.
void setSkewForCentre(ValueType centrePointValue) noexcept
Given a value which is between the start and end points, this sets the skew such that convertFrom0to1...
NormalisableRange(ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue) noexcept
Creates a NormalisableRange with a given range and interval, but a dummy skew-factor.
Range< ValueType > getRange() const noexcept
Returns the extent of the normalisable range.
ValueType interval
The snapping interval that should be used (for a non-normalised value).
NormalisableRange(Range< ValueType > range, ValueType intervalValue) noexcept
Creates a NormalisableRange with a given range and interval, but a dummy skew-factor.
NormalisableRange(ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false) noexcept
Creates a NormalisableRange with a given range, interval and skew factor.
ValueType convertTo0to1(ValueType v) const noexcept
Uses the properties of this mapping to convert a non-normalised value to its 0->1 representation.
NormalisableRange(Range< ValueType > range) noexcept
Creates a NormalisableRange with a given range, continuous interval, but a dummy skew-factor.
NormalisableRange(ValueType rangeStart, ValueType rangeEnd, std::function< ValueType(ValueType currentRangeStart, ValueType currentRangeEnd, ValueType normalisedValue)> convertFrom0To1Func, std::function< ValueType(ValueType currentRangeStart, ValueType currentRangeEnd, ValueType mappedValue)> convertTo0To1Func, std::function< ValueType(ValueType currentRangeStart, ValueType currentRangeEnd, ValueType valueToSnap)> snapToLegalValueFunc=nullptr) noexcept
Creates a NormalisableRange with a given range and an injective mapping function.