Action <InputEvent> mouseDrawHandler(Color c) { return((InputEvent e) => { Debug.Log(e); if (e.type == InputEventType.Begin) { draw.DragBegin(e, c); } else { draw.Dragging(e, c); } }); }
void TraceDragAndDrop(IInputObservable io) { io.LongSequence(500).Subscribe(begin => { log($"<color=green>Drag begin at. {begin}</color>"); draw.DragBegin(begin, Color.green, begin.ToString()); io.MoveThrottle(100).TakeUntil(io.OnEnd).Subscribe(drag => { log($"Dragging. {drag}"); draw.Dragging(drag, Color.green, drag.ToString()); }).AddTo(disposables); io.OnEnd.First().Subscribe(drop => { log($"<color=green>Drop at. {drop}</color>"); draw.DragEnd(drop, Color.green, drop.ToString()); }).AddTo(disposables); }).AddTo(disposables); }