Skip to content

Instantly share code, notes, and snippets.

@philcleveland
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save philcleveland/e410bed5756e66f34ecb to your computer and use it in GitHub Desktop.

Select an option

Save philcleveland/e410bed5756e66f34ecb to your computer and use it in GitHub Desktop.
Rx-js = mouseWheel handling
var canvasMouseOver = Rx.Observable.fromEvent(myCanvas, "mousedown");
var canvasMouseWheel = Rx.Observable.fromEvent(myCanvas, "mousewheel");
canvasMouseWheel.skipUntil(cavasMouseOver)
.subscribe(function (val) {
if (val.originalEvent.wheelDelta < 0) {
mainViewVM.incrementFrame();
}
else {
mainViewVM.decrementFrame();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment