Commit c1ce332d authored by tebjan's avatar tebjan
Browse files

view box has correct equals check now

parent 218faebb
......@@ -85,6 +85,44 @@ namespace Svg
this.Width = width;
this.Height = height;
}
#region Equals and GetHashCode implementation
public override bool Equals(object obj)
{
return (obj is SvgViewBox) && Equals((SvgViewBox)obj);
}
public bool Equals(SvgViewBox other)
{
return this.MinX == other.MinX
&& this.MinY == MinY
&& this.Width == other.Width
&& this.Height == other.Height;
}
public override int GetHashCode()
{
int hashCode = 0;
unchecked {
hashCode += 1000000007 * MinX.GetHashCode();
hashCode += 1000000009 * MinY.GetHashCode();
hashCode += 1000000021 * Width.GetHashCode();
hashCode += 1000000033 * Height.GetHashCode();
}
return hashCode;
}
public static bool operator ==(SvgViewBox lhs, SvgViewBox rhs)
{
return lhs.Equals(rhs);
}
public static bool operator !=(SvgViewBox lhs, SvgViewBox rhs)
{
return !(lhs == rhs);
}
#endregion
}
internal class SvgViewBoxConverter : TypeConverter
......
......@@ -118,6 +118,8 @@ namespace Svg
return UnboxAndCheck<int>(a, b);
else if(a is float)
return UnboxAndCheck<float>(a, b);
else if(a is SvgViewBox)
return UnboxAndCheck<SvgViewBox>(a, b);
else
return true;
}
......
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