feat: duration picker updated with mouse wheel#1157
feat: duration picker updated with mouse wheel#1157MitanOmar wants to merge 1 commit intoadfinis:mainfrom
Conversation
| @action | ||
| wheel(event) { | ||
| debounceTask(this, "wheelAction", event.deltaY, 100); | ||
| } | ||
|
|
||
| wheelAction(deltaY) { | ||
| const direction = deltaY > 0 ? -1 : 1; | ||
| this._addMinutes(this.precision * direction); | ||
| } |
There was a problem hiding this comment.
| @action | |
| wheel(event) { | |
| debounceTask(this, "wheelAction", event.deltaY, 100); | |
| } | |
| wheelAction(deltaY) { | |
| const direction = deltaY > 0 ? -1 : 1; | |
| this._addMinutes(this.precision * direction); | |
| } | |
| @action | |
| wheelAction(event) { | |
| debounceTask(this, "wheelAction", event.deltaY, 100); | |
| } | |
| #wheel(deltaY) { | |
| const direction = deltaY > 0 ? -1 : 1; | |
| this._addMinutes(this.precision * direction); | |
| } |
Clarify naming.
There was a problem hiding this comment.
implemented
it's happen that my dev tools was open, and the page height was more then the window height,
so it was scrolling the page and updating the value.
so by preventing the default, the window scroll will stop if the mouse on duration input
There was a problem hiding this comment.
# missing. Either that or _wheel to show that this is private API.
b7ca497 to
d7d9e8c
Compare
d7d9e8c to
d7c5969
Compare
|
Just tested it locally. The scroll to increase doesn't feel good. It only increases by 15 even if I scroll really slow, since it's debounced. It would be better to compare the |
|
@derrabauke i tried that, but then it will go from 15 to 45 directly, and the user may confuse with the scroll amount and speed. is that OK ? |
d7c5969 to
869c320
Compare
| @action | ||
| wheelAction(event) { | ||
| event.preventDefault(); | ||
| debounceTask(this, "_wheel", event.deltaY, 100); | ||
| } |
There was a problem hiding this comment.
| @action | |
| wheelAction(event) { | |
| event.preventDefault(); | |
| debounceTask(this, "_wheel", event.deltaY, 100); | |
| } | |
| @action | |
| wheelAction(event) { | |
| event.preventDefault(); | |
| this.delta += event.wheelDeltaY; | |
| if (this.delta > 50 || this.delta < -50) { | |
| this.wheel(this.delta) | |
| this.delta = 0; | |
| } | |
| } |
This makes it snappy fast and throttles the scrolling so it's controllable even with the trackpad.
| @@ -1,4 +1,5 @@ | |||
| import { action } from "@ember/object"; | |||
| import { debounceTask } from "ember-lifeline"; | |||
|
Or, we use the existing durationpicker in the https://github.com/adfinis/timed/blob/main/ember/ui-core/src/components/durationpicker.gts#L114-L120 |
fix: #36