diff options
author | Janne Kangas <janne.kangas@qt.io> | 2018-09-03 14:23:05 +0300 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-09-07 10:31:54 +0000 |
commit | 19435690e0ddb9cfe652301a4469429033b3ca77 (patch) | |
tree | b1375bf33885f7a150f8dcebec6d71f7be4de66c | |
parent | 41c5d80c39d37bffeed087921dadfbb3da2fd3db (diff) |
Allow negative values as input to Ranged Number datainput
Do not clamp the incoming negative value to zero.
Task-number: QT3DS-2208
Change-Id: Iec2634b6dc4548abdbbd69a740fd3549ff028055
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
(cherry picked from commit 43ff7fd00e7b7906463d5aa6327301d7bf1ff6b7)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | src/runtime/q3dsscenemanager.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/runtime/q3dsscenemanager.cpp b/src/runtime/q3dsscenemanager.cpp index 75d8b3d..e7484b6 100644 --- a/src/runtime/q3dsscenemanager.cpp +++ b/src/runtime/q3dsscenemanager.cpp @@ -8143,9 +8143,15 @@ void Q3DSSceneManager::setDataInputValue(const QString &dataInputName, const QVa float seekTimeMs = 0.0f; if (meta.hasMinMax()) { Q_ASSERT(!qFuzzyIsNull(meta.maxValue)); - const float normalized = qBound(0.0f, (value.toFloat() / (meta.maxValue - meta.minValue)), 1.0f); - Q3DSSlide *slide = (obj->type() == Q3DSGraphObject::Component) ? static_cast<Q3DSComponentNode *>(obj)->currentSlide() - : m_currentSlide; + + const float normalized = + qBound(0.0f, + (value.toFloat() - meta.minValue) + / (meta.maxValue - meta.minValue), + 1.0f); + Q3DSSlide *slide = (obj->type() == Q3DSGraphObject::Component) + ? static_cast<Q3DSComponentNode *>(obj)->currentSlide() + : m_currentSlide; qint32 startTime = 0; qint32 endTime = 0; Q3DSSlideUtils::getStartAndEndTime(slide, &startTime, &endTime); |