1
0
Fork 0

Fix width of lua float edits

Float edits with a spinner are by default sized to fit their full
min-max range of possible values, so this makes min and max default to 0
and 100 (like it'd done internally in wx) instead of -DOUBLE_MAX and
DOUBLE_MAX.

Note that this does change the behavior of lua dialogs, but does not
contradict existing documentation or specification. It should only
affect scripts who either disobey the specification by specifying only
one value out of max/min, or scripts displaying these large float edits
by specifing a step, but no max or min.
This commit is contained in:
arch1t3cht 2022-08-14 16:24:50 +02:00
parent 1772dd17ae
commit 9ebe154964
1 changed files with 4 additions and 0 deletions

View File

@ -284,6 +284,10 @@ namespace Automation4 {
max = DBL_MAX;
min = -DBL_MAX;
}
if (step != 0.0) {
min = min == -DBL_MAX ? 0.0 : min;
max = max == DBL_MAX ? 100.0 : max;
}
}
bool CanSerialiseValue() const override { return true; }