local k={ParentClass=script.Parent.EFElement}k.__index=k local H=require(script.Parent)function k.Init(k)local H=k.Parent.MeshCreator local A=k.VertexAttachments local function U(A)if A=="\080\111\115\105\116\105\111\110"then if H.Settings.EdgeVisible then local H=k.VertexAttachments[1].Position local A=k.VertexAttachments[2].Position k.EdgeAdornment.CFrame=CFrame.new(H,A)k.EdgeAdornment.Length=(A-H).Magnitude end end end for k,H in A do H.Changed:Connect(function(k)task.spawn(U,k)end)end end function k.Destroy(k)local H=k.Parent.MeshCreator if H.Settings.EdgeVisible then table.remove(k.Parent.Edges,table.find(k.Parent.Edges,k))k.EdgeAdornment:Destroy()end end return k
local EdgeClass = {
	ParentClass = script.Parent.EFElement
}
EdgeClass.__index = EdgeClass

local Classes = require(script.Parent)

function EdgeClass:Init()
	local MeshCreator = self.Parent.MeshCreator

	local VAs = self.VertexAttachments

	local function OnChanged(propertyName)
		if propertyName == "Position" then
			if MeshCreator.Settings["EdgeVisible"] then
				local Origin = self.VertexAttachments[1].Position
				local End = self.VertexAttachments[2].Position
				--task.synchronize()
				self.EdgeAdornment.CFrame =  CFrame.new(Origin, End)
				self.EdgeAdornment.Length = (End - Origin).Magnitude
			end
		end
	end
	
	for _, VA in VAs do
		VA.Changed:Connect(function(propertyName)
			task.spawn(OnChanged, propertyName)
		end)
	end
end

function EdgeClass:Destroy()
	local MeshCreator = self.Parent.MeshCreator

	if MeshCreator.Settings["EdgeVisible"] then
		table.remove(self.Parent.Edges, table.find(self.Parent.Edges, self))
		--task.synchronize()
		self.EdgeAdornment:Destroy()
	end
end

return EdgeClass