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
d773cc48
"Source/vscode:/vscode.git/clone" did not exist on "1313230018ad14be2004b6811d511a3f8ac00514"
Commit
d773cc48
authored
Mar 11, 2014
by
tebjan
Browse files
added insertbefore sibling to child added event
parent
b667a15a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/SvgElement.cs
View file @
d773cc48
...
@@ -316,10 +316,15 @@ namespace Svg
...
@@ -316,10 +316,15 @@ namespace Svg
internal
void
OnElementAdded
(
SvgElement
child
,
int
index
)
internal
void
OnElementAdded
(
SvgElement
child
,
int
index
)
{
{
this
.
AddElement
(
child
,
index
);
this
.
AddElement
(
child
,
index
);
SvgElement
sibling
=
null
;
if
(
index
<
(
Children
.
Count
-
1
))
{
sibling
=
Children
[
index
+
1
];
}
var
handler
=
ChildAdded
;
var
handler
=
ChildAdded
;
if
(
handler
!=
null
)
if
(
handler
!=
null
)
{
{
handler
(
this
,
new
ChildAddedEventArgs
{
NewChild
=
child
});
handler
(
this
,
new
ChildAddedEventArgs
{
NewChild
=
child
,
BeforeSibling
=
sibling
});
}
}
}
}
...
@@ -980,6 +985,7 @@ namespace Svg
...
@@ -980,6 +985,7 @@ namespace Svg
public
class
ChildAddedEventArgs
:
SVGArg
public
class
ChildAddedEventArgs
:
SVGArg
{
{
public
SvgElement
NewChild
;
public
SvgElement
NewChild
;
public
SvgElement
BeforeSibling
;
}
}
//deriving class registers event actions and calls the actions if the event occurs
//deriving class registers event actions and calls the actions if the event occurs
...
...
Source/SvgElementCollection.cs
View file @
d773cc48
...
@@ -53,10 +53,10 @@ namespace Svg
...
@@ -53,10 +53,10 @@ 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
)
{
{
InsertA
ddA
ndFixID
(
index
,
item
,
false
,
false
);
InsertAndFixID
(
index
,
item
,
false
,
false
);
}
}
public
void
InsertA
ddA
ndFixID
(
int
index
,
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
public
void
InsertAndFixID
(
int
index
,
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
{
AddToIdManager
(
item
,
this
.
_elements
[
index
],
autoFixID
,
autoFixChildrenID
,
logElementOldIDNewID
);
AddToIdManager
(
item
,
this
.
_elements
[
index
],
autoFixID
,
autoFixChildrenID
,
logElementOldIDNewID
);
this
.
_elements
.
Insert
(
index
,
item
);
this
.
_elements
.
Insert
(
index
,
item
);
...
...
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