Commits

Jason McKesson committed 41b3afd

Added the ability to add styles by table rather than by object.

  • Participants
  • Parent commits f95dfeb

Comments (0)

Files changed (1)

File Tools/SvgWriter.lua

 	return self;
 end
 
-function Style()
-	return AddMembersToClass({data={}}, StyleMembers);
+-------------------------------------------------------------
+-- Other work.
+function Style(styleTbl)
+	local style = AddMembersToClass({data={}}, StyleMembers);
+	
+	if(styleTbl) then
+		for styleName, styleValue in pairs(styleTbl) do
+			StyleMembers[styleName](style, styleValue);
+		end
+	end
+	
+	return style;
 end
 
 --------------------------------------------------------------
 --------------------------------------------------------------
 local StyleLibraryMembers = {}
 
-function StyleLibraryMembers.AddStyle(self, elementName, className, style)
+function StyleLibraryMembers:AddStyle(elementName, className, style)
 	local styleId = {element=elementName, class=className}
 	
 	self.data[styleId] = style
+	
+	return self;
+end
+
+function StyleLibraryMembers:AddTable(elementName, className, styleTable)
+	local styleId = {element=elementName, class=className}
+	
+	self.data[styleId] = Style(styleTable);
+	
+	return self;
 end
 
 function StyleLibrary()