Commit cebda093 authored by C Moore's avatar C Moore
Browse files

Support for `"display=none"` #66

parent ff49b835
...@@ -22,10 +22,29 @@ namespace Svg ...@@ -22,10 +22,29 @@ namespace Svg
[SvgAttribute("visibility")] [SvgAttribute("visibility")]
public virtual bool Visible public virtual bool Visible
{ {
get { return (this.Attributes["visibility"] == null) ? true : (bool)this.Attributes["visibility"]; } // Add a check for display="none" (that also affects/sets Visible)
get
{
string checkForDisplayNone = this.Attributes["display"] as string;
if ((!string.IsNullOrEmpty(checkForDisplayNone)) && (checkForDisplayNone == "none"))
return false;
else
return (this.Attributes["visibility"] == null) ? true : (bool)this.Attributes["visibility"];
}
set { this.Attributes["visibility"] = value; } set { this.Attributes["visibility"] = value; }
} }
/// <summary>
/// Gets or sets a value to determine whether the element will be rendered.
/// Needed to support SVG attribute display="none"
/// </summary>
[SvgAttribute("display")]
public virtual string Display
{
get { return this.Attributes["display"] as string; }
set { this.Attributes["display"] = value; }
}
/// <summary> /// <summary>
/// Gets or sets the fill <see cref="SvgPaintServer"/> of this element. /// Gets or sets the fill <see cref="SvgPaintServer"/> of this element.
/// </summary> /// </summary>
......
...@@ -68,6 +68,9 @@ namespace Svg ...@@ -68,6 +68,9 @@ namespace Svg
/// <param name="graphics">The <see cref="Graphics"/> object to render to.</param> /// <param name="graphics">The <see cref="Graphics"/> object to render to.</param>
protected override void Render(SvgRenderer renderer) protected override void Render(SvgRenderer renderer)
{ {
if (!Visible)
return;
this.PushTransforms(renderer); this.PushTransforms(renderer);
this.SetClip(renderer); this.SetClip(renderer);
base.RenderChildren(renderer); base.RenderChildren(renderer);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment