local h=Cheer.CreateComponent("\084\111\111\108\116\105\112",View)local o={}function h.Start(W)View.Visible=false View.Text=W o.ShowOnEnter=Support.AddGuiInputListener(View.Parent,"\066\101\103\097\110","\077\111\117\115\101\077\111\118\101\109\101\110\116",true,h.Show)o.HideOnLeave=Support.AddGuiInputListener(View.Parent,"\069\110\100\101\100","\077\111\117\115\101\077\111\118\101\109\101\110\116",true,h.Hide)Cheer.Bind(h.OnRemove,ClearConnections)return h end function h.Show()View.Size=UDim2.new(0,View.TextBounds.X+10,0,View.TextBounds.Y+10)View.Position=UDim2.new(.5,-View.AbsoluteSize.X/2,1,3)View.Visible=true end function h.Hide()View.Visible=false end function ClearConnections()for h,W in pairs(o)do W:Disconnect()o[h]=nil end end return h

local Component = Cheer.CreateComponent('Tooltip', View);

local Connections = {};

function Component.Start(Text)

	-- Hide the view
	View.Visible = false;

	-- Set the tooltip text
	View.Text = Text;

	-- Show the tooltip on hover
	Connections.ShowOnEnter = Support.AddGuiInputListener(View.Parent, 'Began', 'MouseMovement', true, Component.Show);
	Connections.HideOnLeave = Support.AddGuiInputListener(View.Parent, 'Ended', 'MouseMovement', true, Component.Hide);

	-- Clear connections when the component is removed
	Cheer.Bind(Component.OnRemove, ClearConnections);

	-- Return component for chaining
	return Component;

end;

function Component.Show()
	View.Size = UDim2.new(0, View.TextBounds.X + 10, 0, View.TextBounds.Y + 10);
	View.Position = UDim2.new(0.5, -View.AbsoluteSize.X / 2, 1, 3);
	View.Visible = true;
end;

function Component.Hide()
	View.Visible = false;
end;

function ClearConnections()
	-- Clears out temporary connections

	for ConnectionKey, Connection in pairs(Connections) do
		Connection:Disconnect();
		Connections[ConnectionKey] = nil;
	end;

end;

return Component;
