Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
4d631e7f
Commit
4d631e7f
authored
11 years ago
by
tebjan
Browse files
Options
Download
Email Patches
Plain Diff
made svg transform collection a proper ICloneable
parent
cecce654
master
netstandard2
nuget2.4.2
nuget2.4.1
nuget2.4
nuget2.3
nuget2.2.2
nuget2.2.1
nuget1.7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/SvgElement.cs
+1
-3
Source/SvgElement.cs
Source/Transforms/SvgTransformCollection.cs
+20
-6
Source/Transforms/SvgTransformCollection.cs
with
21 additions
and
9 deletions
+21
-9
Source/SvgElement.cs
+
1
-
3
View file @
4d631e7f
...
...
@@ -676,9 +676,7 @@ namespace Svg
if
(
this
.
Transforms
!=
null
)
{
newObj
.
Transforms
=
new
SvgTransformCollection
();
foreach
(
var
transform
in
this
.
Transforms
)
newObj
.
Transforms
.
Add
(
transform
.
Clone
()
as
SvgTransform
);
newObj
.
Transforms
=
this
.
Transforms
.
Clone
()
as
SvgTransformCollection
;
}
foreach
(
var
child
in
this
.
Children
)
...
...
This diff is collapsed.
Click to expand it.
Source/Transforms/SvgTransformCollection.cs
+
20
-
6
View file @
4d631e7f
...
...
@@ -8,12 +8,16 @@ using System.Text;
namespace
Svg.Transforms
{
[
TypeConverter
(
typeof
(
SvgTransformConverter
))]
public
class
SvgTransformCollection
:
List
<
SvgTransform
>
public
class
SvgTransformCollection
:
List
<
SvgTransform
>
,
ICloneable
{
public
new
void
Add
(
SvgTransform
item
)
private
void
AddItem
(
SvgTransform
item
)
{
base
.
Add
(
item
);
}
public
new
void
Add
(
SvgTransform
item
)
{
AddItem
(
item
);
OnTransformChanged
();
}
...
...
@@ -91,9 +95,19 @@ namespace Svg.Transforms
var
handler
=
TransformChanged
;
if
(
handler
!=
null
)
{
handler
(
this
,
new
AttributeEventArgs
{
Attribute
=
"transform"
,
Value
=
this
});
//make a copy of the current value to avoid collection changed exceptions
handler
(
this
,
new
AttributeEventArgs
{
Attribute
=
"transform"
,
Value
=
this
.
Clone
()
});
}
}
}
public
object
Clone
()
{
var
result
=
new
SvgTransformCollection
();
foreach
(
var
trans
in
this
)
{
result
.
AddItem
(
trans
.
Clone
()
as
SvgTransform
);
}
return
result
;
}
}
}
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
Menu
Projects
Groups
Snippets
Help