Commit 540bfa57 authored by tebjan's avatar tebjan
Browse files

auto fix ids by default and log it to console

parent fe32d9ae
...@@ -53,7 +53,12 @@ namespace Svg ...@@ -53,7 +53,12 @@ namespace Svg
/// <param name="item">The <see cref="SvgElement"/> to be added.</param> /// <param name="item">The <see cref="SvgElement"/> to be added.</param>
public void Insert(int index, SvgElement item) public void Insert(int index, SvgElement item)
{ {
InsertAndForceUniqueID(index, item, false, false); InsertAndForceUniqueID(index, item, true, true, LogIDChange);
}
private void LogIDChange(SvgElement elem, string oldId, string newID)
{
Console.WriteLine("ID of SVG element " + elem.ToString() + " changed from " + oldId + " to " + newID);
} }
public void InsertAndForceUniqueID(int index, SvgElement item, bool autoForceUniqueID = true, bool autoFixChildrenID = true, Action<SvgElement, string, string> logElementOldIDNewID = null) public void InsertAndForceUniqueID(int index, SvgElement item, bool autoForceUniqueID = true, bool autoFixChildrenID = true, Action<SvgElement, string, string> logElementOldIDNewID = null)
...@@ -81,7 +86,7 @@ namespace Svg ...@@ -81,7 +86,7 @@ namespace Svg
public void Add(SvgElement item) public void Add(SvgElement item)
{ {
this.AddAndForceUniqueID(item, false, false); this.AddAndForceUniqueID(item, true, true, LogIDChange);
} }
public void AddAndForceUniqueID(SvgElement item, bool autoForceUniqueID = true, bool autoFixChildrenID = true, Action<SvgElement, string, string> logElementOldIDNewID = null) public void AddAndForceUniqueID(SvgElement item, bool autoForceUniqueID = true, bool autoFixChildrenID = true, Action<SvgElement, string, string> logElementOldIDNewID = null)
......
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