Skip to content

Commit

Permalink
feat(core): Add support for mouse scroll interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
rkunev committed Apr 1, 2018
1 parent 4bd5f91 commit df69663
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
props: {
scrollSensitivity: {
default: 2
}
},
mouseScroll: {
default: false
},
},
data() {
return {
Expand All @@ -45,6 +48,10 @@
}
},
mounted() {
if (this.mouseScroll) {
this.$refs.rotator.addEventListener('wheel', this.onScroll);
}
fillColorWheel(this.$refs.colorPalette, this.$el.offsetWidth || 280);
rotator = new Rotator(this.$refs.rotator, {
Expand All @@ -56,6 +63,18 @@
});
},
methods: {
onScroll(ev) {
if (this.isDisabled)
return;
ev.preventDefault();
if (ev.deltaY > 0) {
rotator.angle += this.scrollSensitivity;
} else {
rotator.angle -= this.scrollSensitivity;
}
},
onKeydownDecrement(ev) {
if (this.isDisabled)
return;
Expand Down

0 comments on commit df69663

Please sign in to comment.