Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created February 20, 2018 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/62d7a7ac2bbe57d79f79b920bdc68623 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/62d7a7ac2bbe57d79f79b920bdc68623 to your computer and use it in GitHub Desktop.
const move$ = fromEvent(document, 'mousemove')
const down$ = fromEvent(document, 'mousedown')
const up$ = fromEvent(document, 'mouseup')
const mergeFn = downs => { // In case you want the first position
// If you want to deltas between start and end, you might want a map that captures downs versus moves
return move$.pipe(takeUntil($ups));
};
const paints$ = move$.pipe(
mergeMap(mergeFn)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment