Fix ConfigDialog's ButtonProgress Fine tune updating presets (#6433)

Witnessed with "L/R Margins": tapping on a button
sets the value to the preset table, by reference.
Tapping the -/+ fine tuning buttons was updating
these tables in-place, in effect modifying the presets.
reviewable/pr6436/r1
poire-z 4 years ago committed by GitHub
parent 4c70e6cb56
commit 1c49f817fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -997,12 +997,17 @@ function ConfigDialog:onConfigFineTuneChoose(values, name, event, args, events,
if direction == "-" then
value = self.configurable[name] or values[1]
if type(value) == "table" then
-- Don't update directly this table: it might be a reference
-- to one of the original preset values tables
local updated = {}
for i=1, #value do
value[i] = value[i] - 1
if value[i] < 0 then
value[i] = 0
local v = value[i] - 1
if v < 0 then
v = 0
end
table.insert(updated, v)
end
value = updated
else
value = value - 1
if value < 0 then
@ -1012,9 +1017,11 @@ function ConfigDialog:onConfigFineTuneChoose(values, name, event, args, events,
else
value = self.configurable[name] or values[#values]
if type(value) == "table" then
local updated = {}
for i=1, #value do
value[i] = value[i] + 1
table.insert(updated, value[i] + 1)
end
value = updated
else
value = value + 1
end

Loading…
Cancel
Save