nodeinputdragger: acknowledge min/max values if they're set

This commit is contained in:
itsmattkc
2020-11-22 10:25:04 +11:00
parent 5e319a0cdd
commit 7899c396dc
2 changed files with 19 additions and 2 deletions
+18 -1
View File
@@ -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_);
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;
//input_->blockSignals(true);