@@ -35,9 +35,10 @@ CpSettingsUtil = {}
3535 - isExpertModeOnly(bool): is the setting visible in the expert version?, default = false
3636
3737 - generateValuesFunction(string): dynamically adds value, when the setting is created.
38- - min (int ): min value
39- - max (int ): max value
38+ - min (float ): min value
39+ - max (float ): max value
4040 - incremental (float): increment (optional), default "1"
41+ - precision (float): optional rounding precision
4142 - text(string): string to format the setting value with in the gui element.
4243 - unit (int) : 1 == km/h, 2 == meters, 3 == ha (optional), 4 = percent (%), 5 = degrees (°)
4344
@@ -89,9 +90,10 @@ function CpSettingsUtil.init()
8990 schema :register (XMLValueType .BOOL , key .. " #isExpertModeOnly" , " Is enabled in simple mode?" , false ) -- optional
9091
9192 schema :register (XMLValueType .STRING , key .. " #generateValuesFunction" , " Function to generate values." )
92- schema :register (XMLValueType .INT , key .. " #min" , " Setting min value" )
93- schema :register (XMLValueType .INT , key .. " #max" , " Setting max value" )
93+ schema :register (XMLValueType .FLOAT , key .. " #min" , " Setting min value" )
94+ schema :register (XMLValueType .FLOAT , key .. " #max" , " Setting max value" )
9495 schema :register (XMLValueType .FLOAT , key .. " #incremental" , " Setting incremental" , 1 ) -- optional
96+ schema :register (XMLValueType .FLOAT , key .. " #precision" , " Setting precision" , 2 ) -- optional
9597 schema :register (XMLValueType .STRING , key .. " #text" , " Setting text" ) -- optional
9698 schema :register (XMLValueType .INT , key .. " #unit" , " Setting value unit (km/h, m ...)" ) -- optional
9799
@@ -205,6 +207,7 @@ function CpSettingsUtil.loadSettingsFromSetup(class, filePath)
205207 settingParameters .min = xmlFile :getValue (baseKey .. " #min" )
206208 settingParameters .max = xmlFile :getValue (baseKey .. " #max" )
207209 settingParameters .incremental = MathUtil .round (xmlFile :getValue (baseKey .. " #incremental" ), 3 )
210+ settingParameters .precision = xmlFile :getValue (baseKey .. " #precision" , 2 )
208211 settingParameters .textStr = xmlFile :getValue (baseKey .. " #text" )
209212 settingParameters .unit = xmlFile :getValue (baseKey .. " #unit" )
210213
0 commit comments