【发布时间】:2016-07-04 18:16:13
【问题描述】:
我有一个鼠标左键状态的流:
var leftMouseButton = mouse.Select(x => x.LeftButton).DistinctUntilChanged();
然后我 Window 这给了我一个 observable 的 observables 代表鼠标的拖动:
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));
现在我想制作一个来自leftMouseDrag 的流,它给出了点列表。每次用户完成拖动(LMB 向下 -> 移动 -> LMB 向上)时,它应该触发鼠标移动的位置列表。
如何将IObservable<IObservable<Point>> 转换为IObservable<IEnumerable<Point>>?
【问题讨论】:
-
你能不使用拖放,并从
BeginDrag和EndDrageventArgs 中提取坐标吗? -
@BarryO'Kane 我正在使用 MonoGame 的鼠标 API。
-
啊,很公平。我的坏:)
标签: c# system.reactive rx.net