Commit 5dbfa773 authored by tebjan's avatar tebjan
Browse files

Merge branch 'master' of github.com:vvvv/SVG

Conflicts:
	Samples/SVGViewer/SVGViewer.csproj
	Samples/SVGViewer/SvgViewer.Designer.cs
	Samples/SVGViewer/SvgViewer.cs
	Samples/SVGViewer/SvgViewer.resx
	Samples/SVGViewer/app.config
parents bab55885 ebba7b35
......@@ -94,7 +94,7 @@ namespace Svg
/// <param name="renderer">The <see cref="SvgRenderer"/> object to render to.</param>
protected override void Render(SvgRenderer renderer)
{
if (this.Path != null && this.Visible)
if ((this.Path != null) && this.Visible && this.Displayable)
{
this.PushTransforms(renderer);
this.SetClip(renderer);
......
......@@ -26,6 +26,30 @@ namespace Svg
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; }
}
// Displayable - false if attribute display="none", true otherwise
protected virtual bool Displayable
{
get
{
string checkForDisplayNone = this.Attributes["display"] as string;
if ((!string.IsNullOrEmpty(checkForDisplayNone)) && (checkForDisplayNone == "none"))
return false;
else
return true;
}
}
/// <summary>
/// Gets or sets the fill <see cref="SvgPaintServer"/> of this element.
/// </summary>
......
......@@ -68,6 +68,9 @@ namespace Svg
/// <param name="graphics">The <see cref="Graphics"/> object to render to.</param>
protected override void Render(SvgRenderer renderer)
{
if (!Visible || !Displayable)
return;
this.PushTransforms(renderer);
this.SetClip(renderer);
base.RenderChildren(renderer);
......
......@@ -80,6 +80,9 @@ namespace Svg
protected override void Render(SvgRenderer renderer)
{
if (!Visible || !Displayable)
return;
this.PushTransforms(renderer);
SvgVisualElement element = (SvgVisualElement)this.OwnerDocument.IdManager.GetElementById(this.ReferencedElement);
......
......@@ -43,8 +43,14 @@ namespace Svg
{
throw new ArgumentOutOfRangeException("value must be a string.");
}
return (string)value == "visible" ? true : false;
// Note: currently only used by SvgVisualElement.Visible but if
// conversion is used elsewhere these checks below will need to change
string visibility = (string)value;
if ((visibility == "hidden") || (visibility == "collapse"))
return false;
else
return true;
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
......
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