local x=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local C=x.AvatarEditor local I=require(C.Shared.Util.Spring)local N=require(C.Shared.Util.Maid)local X=require(C.Shared.Settings)local a=require(C.Client.Theme)local O={}O.__index=O function O.new(x,C)local a=setmetatable({},O)a.Button=x a.ColorSpring=I.new(0)a.ColorSpring.Damper=1 a.ColorSpring.Speed=20 a.Maid=N.new()a.Maid:GiveTask(x.InputBegan:Connect(function(C)if not X.HOVER_INPUTS[C.UserInputType]then return end x.MaxVisibleGraphemes=-1 x.Icon.Visible=false end))a.Maid:GiveTask(x.InputEnded:Connect(function(C)if not X.HOVER_INPUTS[C.UserInputType]then return end x.MaxVisibleGraphemes=0 x.Icon.Visible=true end))a.Maid:GiveTask(x.Activated:Connect(C))return a end function O.OnRenderStep(C,x)local I=C.ColorSpring local N=C.Button I:TimeSkip(x)local X=I.Position local O=(a:GetColor("\068\101\115\101\108\101\099\116\101\100")):lerp(a:GetColor("\083\101\108\101\099\116\101\100"),X)N.Icon.ImageColor3=O N.TextColor3=O end function O.Destroy(x)x.Maid:DoCleaning()x.Maid=nil x.Button=nil x.ColorSpring=nil setmetatable(x,nil)end return O
-- Class
-- 0_1195
-- January 10, 2021

--[[



]]

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local AvatarEditor = ReplicatedStorage.AvatarEditor
local Spring = require(AvatarEditor.Shared.Util.Spring)
local Maid = require(AvatarEditor.Shared.Util.Maid)
local Settings = require(AvatarEditor.Shared.Settings)
local Theme = require(AvatarEditor.Client.Theme)

local Class = {}
Class.__index = Class


function Class.new(guiButton, callback)
	local self = setmetatable({}, Class)
	
	self.Button = guiButton
	
	self.ColorSpring = Spring.new(0)
	self.ColorSpring.Damper = 1
	self.ColorSpring.Speed = 20
	
	self.Maid = Maid.new()
	
	self.Maid:GiveTask(guiButton.InputBegan:Connect(function(inputObject)
		if not Settings.HOVER_INPUTS[inputObject.UserInputType] then
			return
		end
		guiButton.MaxVisibleGraphemes = -1
		guiButton.Icon.Visible = false
	end))
	
	self.Maid:GiveTask(guiButton.InputEnded:Connect(function(inputObject)
		if not Settings.HOVER_INPUTS[inputObject.UserInputType] then
			return
		end
		guiButton.MaxVisibleGraphemes = 0
		guiButton.Icon.Visible = true
	end))
	
	self.Maid:GiveTask(guiButton.Activated:Connect(callback))
	
	return self
end


function Class:OnRenderStep(delta)
	local colorSpring = self.ColorSpring
	local button = self.Button
	
	colorSpring:TimeSkip(delta)
	
	local pos = colorSpring.Position
	local color = Theme:GetColor("Deselected"):lerp(Theme:GetColor("Selected"), pos)
	button.Icon.ImageColor3 = color
	button.TextColor3 = color
end


function Class:Destroy()
	self.Maid:DoCleaning()
	self.Maid = nil
	
	self.Button = nil
	self.ColorSpring = nil
	
	setmetatable(self, nil)
end


return Class