Line | |
---|
1 | using System.Drawing;
|
---|
2 | using System.Windows.Forms;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Visualization {
|
---|
5 | public class PanListener : IMouseEventListener {
|
---|
6 | private Point startPoint;
|
---|
7 |
|
---|
8 | public event MoveHandler Pan;
|
---|
9 | public event MoveHandler PanEnd;
|
---|
10 |
|
---|
11 | public PanListener(Point startPoint) {
|
---|
12 | this.startPoint = startPoint;
|
---|
13 | }
|
---|
14 |
|
---|
15 | #region IMouseEventListener Members
|
---|
16 |
|
---|
17 | public void MouseMove(object sender, MouseEventArgs e) {
|
---|
18 | if (Pan != null) {
|
---|
19 | Pan(startPoint, e.Location);
|
---|
20 | }
|
---|
21 |
|
---|
22 | startPoint = e.Location;
|
---|
23 | }
|
---|
24 |
|
---|
25 | public void MouseUp(object sender, MouseEventArgs e) {
|
---|
26 | if(PanEnd != null) {
|
---|
27 | PanEnd(startPoint, e.Location);
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | #endregion
|
---|
32 | }
|
---|
33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.