Skip to content

Commit

Permalink
Prevent page scrolling when using wheel on flatpickr
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulmim committed Apr 29, 2024
1 parent e33342a commit 205024c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions frontend/app/src/components/partials/AlpineScripts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,24 @@ export const UtilitiesXData = `
return 'https://images.evetech.net/types/'+id+'/'+(size <= 64 ? 'icon' : 'render')+'?size='+size;
},`
export const InitXData = `
init() {
document.addEventListener('wheel', event => {
const el = document.querySelector('.flatpickr-hour')
if (el && el.contains(event.target)) {
event.stopPropagation()
event.preventDefault()
if (event.deltaY < 0)
el.stepUp();
else
el.stepDown();
}
}, { passive: false })
},`
export const RifterAnimationXData = `
rifter_animation: false,
rifter_animation_init() {
Expand Down
4 changes: 3 additions & 1 deletion frontend/app/src/layouts/Viewport.astro
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ import {
CorporationFinderXData,
AllianceFinderXData,
UtilitiesXData,
RifterAnimationXData
RifterAnimationXData,
InitXData,
} from '@components/partials/AlpineScripts.astro';
import type { ViewportComponents } from '@dtypes/layout_components'
Expand Down Expand Up @@ -128,6 +129,7 @@ import RifterIcon from '@components/icons/RifterIcon.astro';
${FittingFinderXData}
${UtilitiesXData}
${RifterAnimationXData}
${InitXData}
}`}
x-init="rifter_animation_init"
>
Expand Down

0 comments on commit 205024c

Please sign in to comment.