From c7dd7a715f832ef082097a3b396662ea827041b6 Mon Sep 17 00:00:00 2001 From: owaits Date: Tue, 2 Nov 2010 11:54:59 +0000 Subject: [PATCH] SvgUnit comparison seems not to be working so added IsNone() method to correctly identify a none type. --- Source/DataTypes/SvgUnit.cs | 8 ++++++++ Source/DataTypes/SvgUnitCollection.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/DataTypes/SvgUnit.cs b/Source/DataTypes/SvgUnit.cs index 852b444..3c437bd 100644 --- a/Source/DataTypes/SvgUnit.cs +++ b/Source/DataTypes/SvgUnit.cs @@ -36,6 +36,14 @@ namespace Svg get { return this._isEmpty; } } + /// + /// Gets whether this unit is none. + /// + public bool IsNone + { + get { return _type == SvgUnitType.None; } + } + /// /// Gets the value of the unit. /// diff --git a/Source/DataTypes/SvgUnitCollection.cs b/Source/DataTypes/SvgUnitCollection.cs index f7d049d..e9b1c4a 100644 --- a/Source/DataTypes/SvgUnitCollection.cs +++ b/Source/DataTypes/SvgUnitCollection.cs @@ -40,7 +40,7 @@ namespace Svg foreach (string point in points) { SvgUnit newUnit = (SvgUnit)_unitConverter.ConvertFrom(point.Trim()); - if(newUnit != SvgUnit.None) + if (!newUnit.IsNone) units.Add(newUnit); } -- GitLab