DEFAULT_FORCED_GROUP_VALUES.caption=1 function Icon.setCaption(n,w)assert(typeof(w)=="\115\116\114\105\110\103"or w==nil,"\069\120\112\101\099\116\101\100 \115\116\114\105\110\103\044 \103\111\116 "..typeof(w))n.captionText=w n.instances.captionLabel.Text=w n.instances.captionContainer.Parent=w and activeItems or n.instances.iconContainer n:_updateIconSize(nil,n:getIconState())local a=Maid.new()n._maid.captionMaid=a a:give(n.hoverStarted:Connect(function()if not n.isSelected then n:displayCaption(true)end end))a:give(n.hoverEnded:Connect(function()n:displayCaption(false)end))a:give(n.selected:Connect(function()if n.hovering then n:displayCaption(false)end end))local g=n.instances.iconContainer a:give((g:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\083\105\122\101")):Connect(function()if n.hovering then n:displayCaption()end end))a:give((g:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\080\111\115\105\116\105\111\110")):Connect(function()if n.hovering then n:displayCaption()end end))n:displayCaption(n.hovering)return n end function Icon.displayCaption(n,w)if userInputService.TouchEnabled and not n._draggingFinger then return end local a=8 if n._draggingFinger then a=a+THUMB_OFFSET end local g=n.instances.iconContainer local Q=n.instances.captionContainer local I=UDim2.new(0,(g.AbsolutePosition.X+g.AbsoluteSize.X/2)-Q.AbsoluteSize.X/2,0,(g.AbsolutePosition.Y+g.AbsoluteSize.Y*2)+a)Q.Position=I local C=n.captionVisible or false if typeof(w)=="\098\111\111\108\101\097\110"then C=w end n.captionVisible=C local W=n:get("\099\097\112\116\105\111\110\070\097\100\101\073\110\102\111")for w,a in pairs(n._groupSettings.caption)do local g=n._settingsDictionary[a]g.useForcedGroupValue=not C n:_update(a)end end
-- Captions
DEFAULT_FORCED_GROUP_VALUES["caption"] = 1

function Icon:setCaption(text)
	assert(typeof(text) == "string" or text == nil, "Expected string, got " .. typeof(text))
	self.captionText = text
	self.instances.captionLabel.Text = text
	self.instances.captionContainer.Parent = (text and activeItems) or self.instances.iconContainer
	self:_updateIconSize(nil, self:getIconState())
	local captionMaid = Maid.new()
	self._maid.captionMaid = captionMaid
	captionMaid:give(self.hoverStarted:Connect(function()
		if not self.isSelected then
			self:displayCaption(true)
		end
	end))
	captionMaid:give(self.hoverEnded:Connect(function()
		self:displayCaption(false)
	end))
	captionMaid:give(self.selected:Connect(function()
		if self.hovering then
			self:displayCaption(false)
		end
	end))
	local iconContainer = self.instances.iconContainer
	captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
		if self.hovering then
			self:displayCaption()
		end
	end))
	captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
		if self.hovering then
			self:displayCaption()
		end
	end))
	self:displayCaption(self.hovering)
	return self
end

function Icon:displayCaption(bool)
	if userInputService.TouchEnabled and not self._draggingFinger then
		return
	end
	local yOffset = 8

	-- Determine caption position
	if self._draggingFinger then
		yOffset = yOffset + THUMB_OFFSET
	end
	local iconContainer = self.instances.iconContainer
	local captionContainer = self.instances.captionContainer
	local newPos = UDim2.new(
		0,
		iconContainer.AbsolutePosition.X + iconContainer.AbsoluteSize.X / 2 - captionContainer.AbsoluteSize.X / 2,
		0,
		iconContainer.AbsolutePosition.Y + (iconContainer.AbsoluteSize.Y * 2) + yOffset
	)
	captionContainer.Position = newPos

	-- Determine caption visibility
	local isVisible = self.captionVisible or false
	if typeof(bool) == "boolean" then
		isVisible = bool
	end
	self.captionVisible = isVisible

	-- Change transparency of relavent caption instances
	local captionFadeInfo = self:get("captionFadeInfo")
	for _, settingName in pairs(self._groupSettings.caption) do
		local settingDetail = self._settingsDictionary[settingName]
		settingDetail.useForcedGroupValue = not isVisible
		self:_update(settingName)
	end
end
