Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
29a3026e
Commit
29a3026e
authored
11 years ago
by
Tebjan Halm
Browse files
Options
Download
Email Patches
Plain Diff
implemented insert for SvgElementCollection
parent
2bfed054
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Source/SvgElementCollection.cs
+26
-16
Source/SvgElementCollection.cs
with
26 additions
and
16 deletions
+26
-16
Source/SvgElementCollection.cs
+
26
-
16
View file @
29a3026e
...
...
@@ -53,7 +53,14 @@ namespace Svg
/// <param name="item">The <see cref="SvgElement"/> to be added.</param>
public
void
Insert
(
int
index
,
SvgElement
item
)
{
InsertAddAndFixID
(
index
,
item
,
false
,
false
);
}
public
void
InsertAddAndFixID
(
int
index
,
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
AddToIdManager
(
item
,
autoFixID
,
autoFixChildrenID
,
logElementOldIDNewID
);
this
.
_elements
.
Insert
(
index
,
item
);
item
.
_parent
.
OnElementAdded
(
item
,
index
);
}
public
void
RemoveAt
(
int
index
)
...
...
@@ -78,6 +85,13 @@ namespace Svg
}
public
void
AddAndFixID
(
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
AddToIdManager
(
item
,
autoFixID
,
autoFixChildrenID
,
logElementOldIDNewID
);
this
.
_elements
.
Add
(
item
);
item
.
_parent
.
OnElementAdded
(
item
,
this
.
Count
-
1
);
}
private
void
AddToIdManager
(
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
if
(!
this
.
_mock
)
{
...
...
@@ -85,7 +99,7 @@ namespace Svg
{
this
.
_owner
.
OwnerDocument
.
IdManager
.
AddAndFixID
(
item
,
autoFixID
,
logElementOldIDNewID
);
if
(!(
item
is
SvgDocument
))
//don't add subtree of a document to parent document
if
(!(
item
is
SvgDocument
))
//don't add subtree of a document to parent document
{
foreach
(
var
child
in
item
.
Children
)
{
...
...
@@ -96,10 +110,6 @@ namespace Svg
item
.
_parent
=
this
.
_owner
;
}
item
.
_parent
.
OnElementAdded
(
item
,
this
.
Count
-
1
);
this
.
_elements
.
Add
(
item
);
}
public
void
Clear
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment