nodeinputdragger: acknowledge min/max values if they're set
This commit is contained in:
@@ -70,10 +70,27 @@ void NodeInputDragger::Start(NodeInput *input, const rational &time, int track)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInputDragger::Drag(const QVariant& value)
|
void NodeInputDragger::Drag(QVariant value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(input_);
|
Q_ASSERT(input_);
|
||||||
|
|
||||||
|
if (!input_->get_property(QStringLiteral("min")).isNull()) {
|
||||||
|
// Assumes the value is a double of some kind
|
||||||
|
double min = input_->get_property(QStringLiteral("min")).toDouble();
|
||||||
|
double v = value.toDouble();
|
||||||
|
if (v < min) {
|
||||||
|
value = min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!input_->get_property(QStringLiteral("max")).isNull()) {
|
||||||
|
double max = input_->get_property(QStringLiteral("max")).toDouble();
|
||||||
|
double v = value.toDouble();
|
||||||
|
if (v > max) {
|
||||||
|
value = max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
end_value_ = value;
|
end_value_ = value;
|
||||||
|
|
||||||
//input_->blockSignals(true);
|
//input_->blockSignals(true);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
void Start(NodeInput* input, const rational& time, int track);
|
void Start(NodeInput* input, const rational& time, int track);
|
||||||
|
|
||||||
void Drag(const QVariant &value);
|
void Drag(QVariant value);
|
||||||
|
|
||||||
void End();
|
void End();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user