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
28df78fa
Commit
28df78fa
authored
Jun 28, 2013
by
Tebjan Halm
Browse files
implemented basic mouse events for testing purposes
parent
3d89dfc6
Changes
1
Show whitespace changes
Inline
Side-by-side
Source/SvgElement.cs
View file @
28df78fa
...
@@ -631,6 +631,10 @@ namespace Svg
...
@@ -631,6 +631,10 @@ namespace Svg
var
rpcID
=
this
.
ID
+
"/"
;
var
rpcID
=
this
.
ID
+
"/"
;
caller
.
RegisterAction
<
float
,
float
,
int
>(
rpcID
+
"onclick"
,
OnClick
);
caller
.
RegisterAction
<
float
,
float
,
int
>(
rpcID
+
"onclick"
,
OnClick
);
caller
.
RegisterAction
<
float
,
float
,
int
>(
rpcID
+
"onmousedown"
,
OnMouseDown
);
caller
.
RegisterAction
<
float
,
float
,
int
>(
rpcID
+
"onmouseup"
,
OnMouseUp
);
caller
.
RegisterAction
(
rpcID
+
"onmouseover"
,
OnMouseOver
);
caller
.
RegisterAction
(
rpcID
+
"onmouseout"
,
OnMouseOut
);
caller
.
RegisterAction
<
float
,
float
>(
rpcID
+
"onmousemove"
,
OnMouseMove
);
caller
.
RegisterAction
<
float
,
float
>(
rpcID
+
"onmousemove"
,
OnMouseMove
);
}
}
}
}
...
@@ -638,15 +642,63 @@ namespace Svg
...
@@ -638,15 +642,63 @@ namespace Svg
[
SvgAttribute
(
"onclick"
)]
[
SvgAttribute
(
"onclick"
)]
public
event
EventHandler
<
MouseArg
>
Click
;
public
event
EventHandler
<
MouseArg
>
Click
;
[
SvgAttribute
(
"onmousedown"
)]
public
event
EventHandler
<
MouseArg
>
MouseDown
;
[
SvgAttribute
(
"onmouseup"
)]
public
event
EventHandler
<
MouseArg
>
MouseUp
;
[
SvgAttribute
(
"onmouseover"
)]
public
event
EventHandler
MouseOver
;
[
SvgAttribute
(
"onmousemove"
)]
[
SvgAttribute
(
"onmousemove"
)]
public
event
EventHandler
<
PointArg
>
MouseMove
;
public
event
EventHandler
<
PointArg
>
MouseMove
;
[
SvgAttribute
(
"onmouseout"
)]
public
event
EventHandler
MouseOut
;
protected
void
OnClick
(
float
x
,
float
y
,
int
button
)
protected
void
OnClick
(
float
x
,
float
y
,
int
button
)
{
{
var
handler
=
Click
;
var
handler
=
Click
;
if
(
handler
!=
null
)
if
(
handler
!=
null
)
{
{
handler
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
button
=
button
});
handler
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
});
}
}
protected
void
OnMouseDown
(
float
x
,
float
y
,
int
button
)
{
var
handler
=
MouseDown
;
if
(
handler
!=
null
)
{
handler
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
});
}
}
protected
void
OnMouseUp
(
float
x
,
float
y
,
int
button
)
{
var
handler
=
MouseUp
;
if
(
handler
!=
null
)
{
handler
(
this
,
new
MouseArg
{
x
=
x
,
y
=
y
,
Button
=
button
});
}
}
protected
void
OnMouseOver
()
{
var
handler
=
MouseOver
;
if
(
handler
!=
null
)
{
handler
(
this
,
new
EventArgs
());
}
}
protected
void
OnMouseOut
()
{
var
handler
=
MouseOut
;
if
(
handler
!=
null
)
{
handler
(
this
,
new
EventArgs
());
}
}
}
}
...
@@ -666,6 +718,7 @@ namespace Svg
...
@@ -666,6 +718,7 @@ namespace Svg
//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
public
interface
ISvgEventCaller
public
interface
ISvgEventCaller
{
{
void
RegisterAction
(
string
rpcID
,
Action
action
);
void
RegisterAction
<
T1
>(
string
rpcID
,
Action
<
T1
>
action
);
void
RegisterAction
<
T1
>(
string
rpcID
,
Action
<
T1
>
action
);
void
RegisterAction
<
T1
,
T2
>(
string
rpcID
,
Action
<
T1
,
T2
>
action
);
void
RegisterAction
<
T1
,
T2
>(
string
rpcID
,
Action
<
T1
,
T2
>
action
);
void
RegisterAction
<
T1
,
T2
,
T3
>(
string
rpcID
,
Action
<
T1
,
T2
,
T3
>
action
);
void
RegisterAction
<
T1
,
T2
,
T3
>(
string
rpcID
,
Action
<
T1
,
T2
,
T3
>
action
);
...
@@ -681,9 +734,9 @@ namespace Svg
...
@@ -681,9 +734,9 @@ namespace Svg
public
float
y
;
public
float
y
;
/// <summary>
/// <summary>
///
0
= left,
1
= middle,
2
= right
///
1
= left,
2
= middle,
3
= right
/// </summary>
/// </summary>
public
int
b
utton
;
public
int
B
utton
;
}
}
/// <summary>
/// <summary>
...
...
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