function RadialMenuClass.SetRadialProps(g,T)for g,b in next,g.Frame.Radial:GetChildren()do for T,g in next,T do b[T]=g end end end function RadialMenuClass.SetDialProps(g,T)local b=g.Frame.RadialDial for T,g in next,T do b[T]=g end end function RadialMenuClass.GetTheta(g,T)local b=nil if MOUSE_GROUP[T]then local T=g.Frame local R=T.AbsoluteSize.y/2 local G=T.AbsolutePosition+T.AbsoluteSize/2 local Y=UIS:GetMouseLocation()+Vector2.new(0,-36)b=(Y-G)/R elseif GAMEPAD_GROUP[T]then local g=UIS:GetGamepadState(T)for T,b in next,g do g[b.KeyCode]=b end b=g[Enum.KeyCode.Thumbstick2].Position*Vector3.new(1,-1,1)end if b then local T=b.Magnitude if T>=g.DeadZoneIn and T<=g.DeadZoneOut then return math.atan2(b.y,-b.x)end end end function RadialMenuClass.PickIndex(g,T)local b=math.rad(g.Frame.Rotation)local R=math.deg((((T-g.Rotation)+b)+EX_OFFSET)+2*TAU)%360 local G=math.floor(R/(360/g.SubN))return G+1 end function RadialMenuClass.GetRotation(g,T)return-TAU*((T-1)/g.SubN)end function RadialMenuClass.GetRadial(g,T)return g.Frame.Radial[T]end function RadialMenuClass.GetAttachment(g,T)return g.Frame.Attach[T]end function RadialMenuClass.IsVisible(T)local g=T.Frame while g and(g:IsA("\071\117\105\079\098\106\101\099\116")and g.Visible)do g=g.Parent if g and(g:IsA("\083\099\114\101\101\110\071\117\105")and g.Enabled)then return true end end return false end function RadialMenuClass.Destroy(T)T._Maid:Sweep()T.Frame:Destroy()T.Clicked=nil T.Hover=nil T.Frame=nil end


function RadialMenuClass:SetRadialProps(props)
	for _, child in next, self.Frame.Radial:GetChildren() do
		for prop, value in next, props do
			child[prop] = value
		end
	end
end

function RadialMenuClass:SetDialProps(props)
	local dial = self.Frame.RadialDial
	for prop, value in next, props do
		dial[prop] = value
	end
end

function RadialMenuClass:GetTheta(userInputType)
	local delta = nil
	
	if (MOUSE_GROUP[userInputType]) then
		local frame = self.Frame
		local radius = frame.AbsoluteSize.y/2
		local center = frame.AbsolutePosition + frame.AbsoluteSize/2
		local mousePos = UIS:GetMouseLocation() + Vector2.new(0, -36)
		delta = (mousePos - center) / radius
	elseif (GAMEPAD_GROUP[userInputType]) then
		local states = UIS:GetGamepadState(userInputType)
		for _, state in next, states do
			states[state.KeyCode] = state
		end
		delta = states[Enum.KeyCode.Thumbstick2].Position * Vector3.new(1, -1, 1)
	end
	
	if (delta) then
		local m = delta.Magnitude
		if (m >= self.DeadZoneIn and m <= self.DeadZoneOut) then
			return math.atan2(delta.y, -delta.x)
		end
	end
end

function RadialMenuClass:PickIndex(theta)
	local frameRot = math.rad(self.Frame.Rotation)
	local toDeg = math.deg(theta - self.Rotation + frameRot + EX_OFFSET + 2*TAU) % 360
	local closest = math.floor(toDeg / (360 / self.SubN))
	return closest + 1
end

function RadialMenuClass:GetRotation(index)
	return -TAU * ((index - 1) / self.SubN)
end

function RadialMenuClass:GetRadial(index)
	return self.Frame.Radial[index]
end

function RadialMenuClass:GetAttachment(index)
	return self.Frame.Attach[index]
end

function RadialMenuClass:IsVisible()
	local frame = self.Frame
	while (frame and frame:IsA("GuiObject") and frame.Visible) do
		frame = frame.Parent
		if (frame and frame:IsA("ScreenGui") and frame.Enabled) then
			return true
		end
	end
	return false
end

function RadialMenuClass:Destroy()
	self._Maid:Sweep()
	self.Frame:Destroy()
	self.Clicked = nil
	self.Hover = nil
	self.Frame = nil
end
