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
88f9340e
Commit
88f9340e
authored
Jul 25, 2013
by
Tebjan Halm
Browse files
added missing raise event methods
parent
23a53f05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/SvgElement.cs
View file @
88f9340e
...
@@ -417,14 +417,16 @@ namespace Svg
...
@@ -417,14 +417,16 @@ namespace Svg
//events
//events
if
(
AutoPublishEvents
)
if
(
AutoPublishEvents
)
foreach
(
var
attr
in
_svgEventAttributes
)
{
{
var
evt
=
attr
.
Event
.
GetValue
(
this
);
foreach
(
var
attr
in
_svgEventAttributes
)
{
if
(
evt
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
this
.
ID
))
var
evt
=
attr
.
Event
.
GetValue
(
this
);
{
writer
.
WriteAttributeString
(
attr
.
Attribute
.
Name
,
this
.
ID
+
"/"
+
attr
.
Attribute
.
Name
);
if
(
evt
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
this
.
ID
))
}
{
writer
.
WriteAttributeString
(
attr
.
Attribute
.
Name
,
this
.
ID
+
"/"
+
attr
.
Attribute
.
Name
);
}
}
}
}
//add the custom attributes
//add the custom attributes
...
@@ -655,9 +657,9 @@ namespace Svg
...
@@ -655,9 +657,9 @@ namespace Svg
caller
.
RegisterAction
<
float
,
float
,
int
,
int
>(
rpcID
+
"onclick"
,
OnClick
);
caller
.
RegisterAction
<
float
,
float
,
int
,
int
>(
rpcID
+
"onclick"
,
OnClick
);
caller
.
RegisterAction
<
float
,
float
,
int
,
int
>(
rpcID
+
"onmousedown"
,
OnMouseDown
);
caller
.
RegisterAction
<
float
,
float
,
int
,
int
>(
rpcID
+
"onmousedown"
,
OnMouseDown
);
caller
.
RegisterAction
<
float
,
float
,
int
>(
rpcID
+
"onmouseup"
,
OnMouseUp
);
caller
.
RegisterAction
<
float
,
float
,
int
>(
rpcID
+
"onmouseup"
,
OnMouseUp
);
caller
.
RegisterAction
<
float
,
float
>(
rpcID
+
"onmousemove"
,
OnMouseMove
);
caller
.
RegisterAction
(
rpcID
+
"onmouseover"
,
OnMouseOver
);
caller
.
RegisterAction
(
rpcID
+
"onmouseover"
,
OnMouseOver
);
caller
.
RegisterAction
(
rpcID
+
"onmouseout"
,
OnMouseOut
);
caller
.
RegisterAction
(
rpcID
+
"onmouseout"
,
OnMouseOut
);
caller
.
RegisterAction
<
float
,
float
>(
rpcID
+
"onmousemove"
,
OnMouseMove
);
}
}
}
}
...
@@ -669,28 +671,35 @@ namespace Svg
...
@@ -669,28 +671,35 @@ namespace Svg
[
SvgAttribute
(
"onmouseup"
)]
[
SvgAttribute
(
"onmouseup"
)]
public
event
EventHandler
<
MouseArg
>
MouseUp
;
public
event
EventHandler
<
MouseArg
>
MouseUp
;
[
SvgAttribute
(
"onmousemove"
)]
public
event
EventHandler
<
PointArg
>
MouseMove
;
[
SvgAttribute
(
"onmouseover"
)]
[
SvgAttribute
(
"onmouseover"
)]
public
event
EventHandler
MouseOver
;
public
event
EventHandler
MouseOver
;
[
SvgAttribute
(
"onmousemove"
)]
public
event
EventHandler
<
PointArg
>
MouseMove
;
[
SvgAttribute
(
"onmouseout"
)]
[
SvgAttribute
(
"onmouseout"
)]
public
event
EventHandler
MouseOut
;
public
event
EventHandler
MouseOut
;
//click
protected
void
OnClick
(
float
x
,
float
y
,
int
button
,
int
clickCount
)
protected
void
OnClick
(
float
x
,
float
y
,
int
button
,
int
clickCount
)
{
{
var
handler
=
Click
;
RaiseMouseClick
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
,
ClickCount
=
clickCount
});
if
(
handler
!=
null
)
}
{
handler
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
,
ClickCount
=
clickCount
});
protected
void
RaiseMouseClick
(
object
sender
,
MouseArg
e
)
{
var
handler
=
Click
;
if
(
handler
!=
null
)
{
handler
(
sender
,
e
);
}
}
}
}
//down
protected
void
OnMouseDown
(
float
x
,
float
y
,
int
button
,
int
clickCount
)
protected
void
OnMouseDown
(
float
x
,
float
y
,
int
button
,
int
clickCount
)
{
{
RaiseMouseDown
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
,
ClickCount
=
clickCount
});
RaiseMouseDown
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
,
ClickCount
=
clickCount
});
}
}
protected
void
RaiseMouseDown
(
object
sender
,
MouseArg
e
)
protected
void
RaiseMouseDown
(
object
sender
,
MouseArg
e
)
...
@@ -702,39 +711,63 @@ namespace Svg
...
@@ -702,39 +711,63 @@ namespace Svg
}
}
}
}
//up
protected
void
OnMouseUp
(
float
x
,
float
y
,
int
button
)
protected
void
OnMouseUp
(
float
x
,
float
y
,
int
button
)
{
{
var
handler
=
MouseUp
;
RaiseMouseUp
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
});
}
protected
void
RaiseMouseUp
(
object
sender
,
MouseArg
e
)
{
var
handler
=
MouseUp
;
if
(
handler
!=
null
)
if
(
handler
!=
null
)
{
{
handler
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
}
);
handler
(
sender
,
e
);
}
}
}
}
protected
void
OnMouseOver
()
//move
protected
void
OnMouseMove
(
float
x
,
float
y
)
{
{
var
handler
=
MouseOver
;
RaiseMouseMove
(
this
,
new
PointArg
{
x
=
x
,
y
=
y
});
}
protected
void
RaiseMouseMove
(
object
sender
,
PointArg
e
)
{
var
handler
=
MouseMove
;
if
(
handler
!=
null
)
if
(
handler
!=
null
)
{
{
handler
(
this
,
new
EventArgs
()
);
handler
(
sender
,
e
);
}
}
}
}
protected
void
OnMouseOut
()
//over
protected
void
OnMouseOver
()
{
{
var
handler
=
MouseOut
;
RaiseMouseOver
(
this
);
}
protected
void
RaiseMouseOver
(
object
sender
)
{
var
handler
=
MouseOver
;
if
(
handler
!=
null
)
if
(
handler
!=
null
)
{
{
handler
(
this
,
new
EventArgs
());
handler
(
sender
,
new
EventArgs
());
}
}
}
}
protected
void
OnMouseMove
(
float
x
,
float
y
)
//out
protected
void
OnMouseOut
()
{
RaiseMouseOut
(
this
);
}
protected
void
RaiseMouseOut
(
object
sender
)
{
{
var
handler
=
Mouse
Move
;
var
handler
=
Mouse
Out
;
if
(
handler
!=
null
)
if
(
handler
!=
null
)
{
{
handler
(
this
,
new
Poi
ntArg
{
x
=
x
,
y
=
y
}
);
handler
(
sender
,
new
Eve
ntArg
s
()
);
}
}
}
}
...
...
Source/SvgExtentions.cs
View file @
88f9340e
...
@@ -47,5 +47,10 @@ namespace Svg
...
@@ -47,5 +47,10 @@ namespace Svg
}
}
}
}
public
static
bool
HasNonEmptyCustomAttribute
(
this
SvgElement
element
,
string
name
)
{
return
element
.
CustomAttributes
.
ContainsKey
(
name
)
&&
!
string
.
IsNullOrEmpty
(
element
.
CustomAttributes
[
name
]);
}
}
}
}
}
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