Created
February 20, 2018 16:07
-
-
Save mattpodwysocki/62d7a7ac2bbe57d79f79b920bdc68623 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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