mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 04:57:09 +03:00
Now handeling deltaY=0 and shrunk down code
This commit is contained in:
@@ -251,8 +251,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
const step = 0.01;
|
const step = 0.01;
|
||||||
const sponsorTimeEdits = this.state.sponsorTimeEdits;
|
const sponsorTimeEdits = this.state.sponsorTimeEdits;
|
||||||
let timeAsNumber = utils.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[index]);
|
let timeAsNumber = utils.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[index]);
|
||||||
if (timeAsNumber !== null) {
|
if (timeAsNumber !== null && e.deltaY != 0) {
|
||||||
if (this.isWheelScrollingUp(e)){
|
if (e.deltaY < 0){
|
||||||
timeAsNumber += step;
|
timeAsNumber += step;
|
||||||
}else if (timeAsNumber >= step){
|
}else if (timeAsNumber >= step){
|
||||||
timeAsNumber -= step;
|
timeAsNumber -= step;
|
||||||
@@ -266,17 +266,6 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isWheelScrollingUp(e: React.WheelEvent): boolean {
|
|
||||||
console.log("wheelUpOrDown")
|
|
||||||
if (e.deltaY < 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (e.deltaY > 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getCategoryOptions(): React.ReactElement[] {
|
getCategoryOptions(): React.ReactElement[] {
|
||||||
const elements = [(
|
const elements = [(
|
||||||
<option value={DEFAULT_CATEGORY}
|
<option value={DEFAULT_CATEGORY}
|
||||||
|
|||||||
Reference in New Issue
Block a user