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
f099da1a
Commit
f099da1a
authored
Jun 02, 2014
by
tebjan
Browse files
added X/Y attributes to svg fragment
parent
6c1198d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Source/Document Structure/SvgFragment.cs
View file @
f099da1a
...
@@ -19,6 +19,43 @@ namespace Svg
...
@@ -19,6 +19,43 @@ namespace Svg
/// </summary>
/// </summary>
public
static
readonly
Uri
Namespace
=
new
Uri
(
"http://www.w3.org/2000/svg"
);
public
static
readonly
Uri
Namespace
=
new
Uri
(
"http://www.w3.org/2000/svg"
);
private
SvgUnit
_x
;
private
SvgUnit
_y
;
/// <summary>
/// Gets or sets the position where the left point of the svg should start.
/// </summary>
[
SvgAttribute
(
"x"
)]
public
SvgUnit
X
{
get
{
return
_x
;
}
set
{
if
(
_x
!=
value
)
{
_x
=
value
;
OnAttributeChanged
(
new
AttributeEventArgs
{
Attribute
=
"x"
,
Value
=
value
});
}
}
}
/// <summary>
/// Gets or sets the position where the top point of the svg should start.
/// </summary>
[
SvgAttribute
(
"y"
)]
public
SvgUnit
Y
{
get
{
return
_y
;
}
set
{
if
(
_y
!=
value
)
{
_y
=
value
;
OnAttributeChanged
(
new
AttributeEventArgs
{
Attribute
=
"y"
,
Value
=
value
});
}
}
}
/// <summary>
/// <summary>
/// Gets or sets the width of the fragment.
/// Gets or sets the width of the fragment.
/// </summary>
/// </summary>
...
@@ -80,6 +117,7 @@ namespace Svg
...
@@ -80,6 +117,7 @@ namespace Svg
if
(!
this
.
ViewBox
.
Equals
(
SvgViewBox
.
Empty
))
if
(!
this
.
ViewBox
.
Equals
(
SvgViewBox
.
Empty
))
{
{
renderer
.
TranslateTransform
(
_x
,
_y
,
MatrixOrder
.
Append
);
renderer
.
TranslateTransform
(-
this
.
ViewBox
.
MinX
,
-
this
.
ViewBox
.
MinY
,
MatrixOrder
.
Append
);
renderer
.
TranslateTransform
(-
this
.
ViewBox
.
MinX
,
-
this
.
ViewBox
.
MinY
,
MatrixOrder
.
Append
);
renderer
.
ScaleTransform
(
this
.
Width
.
ToDeviceValue
()
/
this
.
ViewBox
.
Width
,
this
.
Height
.
ToDeviceValue
()
/
this
.
ViewBox
.
Height
,
MatrixOrder
.
Append
);
renderer
.
ScaleTransform
(
this
.
Width
.
ToDeviceValue
()
/
this
.
ViewBox
.
Width
,
this
.
Height
.
ToDeviceValue
()
/
this
.
ViewBox
.
Height
,
MatrixOrder
.
Append
);
...
@@ -119,6 +157,8 @@ namespace Svg
...
@@ -119,6 +157,8 @@ namespace Svg
/// </summary>
/// </summary>
public
SvgFragment
()
public
SvgFragment
()
{
{
_x
=
0.0f
;
_y
=
0.0f
;
this
.
Height
=
new
SvgUnit
(
SvgUnitType
.
Percentage
,
100.0f
);
this
.
Height
=
new
SvgUnit
(
SvgUnitType
.
Percentage
,
100.0f
);
this
.
Width
=
new
SvgUnit
(
SvgUnitType
.
Percentage
,
100.0f
);
this
.
Width
=
new
SvgUnit
(
SvgUnitType
.
Percentage
,
100.0f
);
this
.
ViewBox
=
SvgViewBox
.
Empty
;
this
.
ViewBox
=
SvgViewBox
.
Empty
;
...
...
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