Sliders for arguments on the Cmds tab with a small min/max delta (e.g. from 0 to 1) will now allow up to 2 decimal places, if the arg does not have cmds.round flag.

This commit is contained in:
SticklyMan 2015-06-01 22:24:35 -06:00
parent 22e36dabdd
commit 4aedfdde5b
3 changed files with 13 additions and 2 deletions

View File

@ -116,7 +116,7 @@ function xgui.init( ply )
draw.RoundedBoxEx( 4, 0, 1, 580, 20, xgui.settings.infoColor, false, false, true, true )
end
local version_type = ulx.revision and ( ulx.revision > 0 and " SVN " .. ulx.revision or " Release") or (" N/A")
xlib.makelabel{ x=5, y=-10, label="\nULX Admin Mod :: XGUI - by Stickly Man! :: v15.5.31 | ULX v" .. string.format("%.2f", ulx.version) .. version_type .. " | ULib v" .. ULib.VERSION, parent=xgui.infobar }:NoClipping( true )
xlib.makelabel{ x=5, y=-10, label="\nULX Admin Mod :: XGUI - by Stickly Man! :: v15.6.1 | ULX v" .. string.format("%.2f", ulx.version) .. version_type .. " | ULib v" .. ULib.VERSION, parent=xgui.infobar }:NoClipping( true )
xgui.thetime = xlib.makelabel{ x=515, y=-10, label="", parent=xgui.infobar }
xgui.thetime:NoClipping( true )
xgui.thetime.check = function()

View File

@ -297,9 +297,19 @@ function xgui.load_helpers()
local maxvalue = restrictions.max
if restrictions.max == nil and defvalue > 100 then maxvalue = defvalue end
local decimal = 0
if not table.HasValue( arg, ULib.cmds.round ) then
local minMaxDelta = maxvalue - restrictions.min
if minMaxDelta < 5 then
decimal = 2
elseif minMaxDelta <= 10 then
decimal = 1
end
end
local outPanel = xlib.makepanel{ h=35, parent=parent }
xlib.makelabel{ label=arg.hint or "NumArg", parent=outPanel }
outPanel.val = xlib.makeslider{ y=15, w=165, min=restrictions.min, max=maxvalue, value=defvalue, label="<--->", parent=outPanel }
outPanel.val = xlib.makeslider{ y=15, w=165, min=restrictions.min, max=maxvalue, value=defvalue, decimal=decimal, label="<--->", parent=outPanel }
outPanel.GetValue = function( self ) return outPanel.val.GetValue( outPanel.val ) end
outPanel.TextArea = outPanel.val.TextArea
return outPanel

View File

@ -83,6 +83,7 @@ v3.70 - *(00/00/00)*
* [CHANGE] XGUI: No longer autoexecutes skins to ensure they have been installed.
* [CHANGE] XGUI: Added "name" parameter to xgui.hookEvent to prevent event duplication. (Aids with autorefresh, is backwards compatible with old XGUI modules)
* [CHANGE] XGUI: Modules that no longer exist will be removed from the customizable sort order.
* [CHANGE] XGUI: Sliders for arguments on the Cmds tab with a small min/max delta (e.g. from 0 to 1) will now allow up to 2 decimal places, if the arg does not have cmds.round flag.
v3.62 - *(03/09/15)*
* [ADD] "ulx return" to return target to previous location they were in before a teleport command was used (Thanks for the idea, ludalex).