setTopbarEnabled hover bug
If you hover an icon and the topbar gets hidden while your mouse is still over it (e.g. clicking an icon that opens a page which calls Icon.setTopbarEnabled(false)) the icon comes back still looking hovered once the topbar is enabled again even with your mouse nowhere near it
A simple fix:
local isViewingWithMouse = false
clickRegion.MouseEnter:Connect(function()
local dontSetState = UserInputService.PreferredInput ~= preferredInput.desktop
isViewingWithMouse = true
viewingStarted(dontSetState)
end)
janitor:add(UserInputService.InputChanged:Connect(function(input)
if not (self.isViewing and isViewingWithMouse) or input.UserInputType ~= Enum.UserInputType.MouseMovement then
return
end
local point = input.Position
local position = clickRegion.AbsolutePosition
local size = clickRegion.AbsoluteSize
local isOver = point.X >= position.X and point.X <= position.X + size.X and point.Y >= position.Y and point.Y <= position.Y + size.Y
if not isOver then
viewingEnded()
end
end))
self.viewingEnded:Connect(function()
isViewingWithMouse = false
end)