I have a stream for the state of the left mouse button:
var leftMouseButton = mouse.Select(x => x.LeftButton).DistinctUntilChanged();
I then Window
this to give me an observable of observables representing drags of the mouse:
var leftMouseDrag = mouse
.Select(mouseState => new Point(mouseState.X, mouseState.Y))
.DistinctUntilChanged()
.Window(leftMouseButton.Where(x => x == ButtonState.Pressed), x => leftMouseButton.Where(y => y != x));
Now I would like to make a stream off of leftMouseDrag
that gives lists of points. Every time the user completes a drag (LMB down -> move -> LMB up) it should fire with the list of positions that the mouse moved through.
How do I take an IObservable<IObservable<Point>>
and turn it into an IObservable<IEnumerable<Point>>
?