1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Merge pull request #836 from veroxzik/feature/lightbox-mousewheel-improvements

Lightbox: fix mouse wheel behavior and add horizontal scroll feature. fixes #835
This commit is contained in:
Patrik J. Braun 2024-03-02 22:24:32 +01:00 committed by GitHub
commit 7f3056158a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,13 +146,25 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges {
} }
} }
wheel($event: { deltaY: number }): void { wheel($event: { deltaX: number, deltaY: number }): void {
if (!this.activePhoto || this.activePhoto.gridMedia.isVideo()) { if (!this.activePhoto) {
return;
}
if ($event.deltaX < 0) {
if (this.navigation.hasPrev) {
this.previousPhoto.emit();
}
} else if ($event.deltaX > 0) {
if (this.navigation.hasNext) {
this.nextMediaManuallyTriggered();
}
}
if (this.activePhoto.gridMedia.isVideo()) {
return; return;
} }
if ($event.deltaY < 0) { if ($event.deltaY < 0) {
this.zoomIn(); this.zoomIn();
} else { } else if ($event.deltaY > 0) {
this.zoomOut(); this.zoomOut();
} }
} }
@ -537,4 +549,3 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges {
} }
} }