LM_AngleWidget:Value()

Version added: before 9.5
Returns the current angle value (in radians)

Return value:

real
For the user's convenience, the Angle Widget's value is displayed in degrees.
However, for the internal functions, radians are much more useful, so this method returns the value in radians.
If you need to get the same value in degrees, you can use following function:
function GetDegreeValue(radians)
	local degrees = math.deg(radians)
	return math.floor(degrees * 100 + 0.5) / 100
end

Example:
function MyDialog:UpdateWidgets()
	-- set the value:
	self.MyAngleWidget:SetValue(math.pi/2) -- 90°
	
	-- get the value: 
	local v = self.MyAngleWidget:Value()
	
	print(v)
	print(GetDegreeValue(v))
end

Result:
Image

Value in degrees


See also: LM_AngleWidget:SetValue, LM.GUI.AngleWidget
<< Back to LM_AngleWidget