-
Notifications
You must be signed in to change notification settings - Fork 28
/
SetCursorPosition.cs
31 lines (30 loc) · 1.09 KB
/
SetCursorPosition.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.ComponentModel;
using System.Drawing;
using System.Reactive.Linq;
using System.Windows.Forms;
namespace Bonsai.Windows.Input
{
/// <summary>
/// Represents an operator that sets the current position of the mouse cursor.
/// </summary>
[Description("Sets the current position of the mouse cursor.")]
public class SetCursorPosition : Sink<Point>
{
/// <summary>
/// Sets the current position of the mouse cursor using an observable sequence
/// of point values.
/// </summary>
/// <param name="source">
/// A sequence of <see cref="Point"/> values representing the position to set the cursor to.
/// </param>
/// <returns>
/// An observable sequence that is identical to the <paramref name="source"/> sequence
/// but where there is an additional side effect of updating the cursor position.
/// </returns>
public override IObservable<Point> Process(IObservable<Point> source)
{
return source.Do(input => Cursor.Position = input);
}
}
}