private static void SetSvgPointAttributes(this HtmlElement element, string xAttributeName, string yAttributeName, Point point, SvgValueConverter converter) { if (point.IsNullOrEmpty()) { element.RemoveAttribute(xAttributeName); element.RemoveAttribute(yAttributeName); } else { element.SetAttribute(xAttributeName, converter.ToImplicitValueString(point.X)); element.SetAttribute(yAttributeName, converter.ToImplicitValueString(point.Y)); } }
public static void SetSvgSize(this HtmlElement element, Size size, SvgValueConverter converter) { if (size.IsNullOrEmpty()) { element.RemoveAttribute("width"); element.RemoveAttribute("height"); } else { element.SetAttribute("width", converter.ToImplicitValueString(size.Width)); element.SetAttribute("height", converter.ToImplicitValueString(size.Height)); } }
private static void SetSvgAttribute(this HtmlElement element, string attributeName, double value, SvgValueConverter converter) { if (value.IsNaN()) { element.RemoveAttribute(attributeName); } else { element.SetAttribute(attributeName, converter.ToImplicitValueString(value)); } }