mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-01 05:44:43 +08:00
frontend: Round theme variables with "px" units
This commit is contained in:
@@ -646,6 +646,12 @@ static QString EvalMath(const QHash<QString, OBSThemeVariable> &vars, const OBST
|
||||
val = d1 < d2 ? d1 : d2;
|
||||
}
|
||||
|
||||
// Round any values with a px suffix. Qt does this anyway for some properties,
|
||||
// but then will flat out break with decimals for others.
|
||||
if (val1.suffix == "px" || val2.suffix == "px") {
|
||||
val = std::roundf(val);
|
||||
}
|
||||
|
||||
bool isInteger = ceill(val) == val;
|
||||
QString result = QString::number(val, 'f', isInteger ? 0 : -1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user