Zoom: fix wheeling
This commit is contained in:
parent
b54ca7021c
commit
89200faaf8
@ -234,13 +234,6 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
|
|||||||
|
|
||||||
this.moversContainer = document.createElement('div');
|
this.moversContainer = document.createElement('div');
|
||||||
this.moversContainer.classList.add(MEDIA_VIEWER_CLASSNAME + '-movers');
|
this.moversContainer.classList.add(MEDIA_VIEWER_CLASSNAME + '-movers');
|
||||||
this.moversContainer.addEventListener('wheel', (e) => {
|
|
||||||
if(this.ctrlKeyDown) {
|
|
||||||
cancelEvent(e);
|
|
||||||
const scrollingUp = e.deltaY < 0;
|
|
||||||
this.changeZoom(!!scrollingUp);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.wholeDiv.append(this.overlaysDiv, this.buttons.prev, this.buttons.next, this.topbar, this.moversContainer);
|
this.wholeDiv.append(this.overlaysDiv, this.buttons.prev, this.buttons.next, this.topbar, this.moversContainer);
|
||||||
|
|
||||||
@ -438,6 +431,7 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
|
|||||||
|
|
||||||
window.removeEventListener('keydown', this.onKeyDown);
|
window.removeEventListener('keydown', this.onKeyDown);
|
||||||
window.removeEventListener('keyup', this.onKeyUp);
|
window.removeEventListener('keyup', this.onKeyUp);
|
||||||
|
window.removeEventListener('wheel', this.onWheel);
|
||||||
|
|
||||||
promise.finally(() => {
|
promise.finally(() => {
|
||||||
this.wholeDiv.remove();
|
this.wholeDiv.remove();
|
||||||
@ -525,6 +519,14 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onWheel = (e: WheelEvent) => {
|
||||||
|
if(this.ctrlKeyDown) {
|
||||||
|
cancelEvent(e);
|
||||||
|
const scrollingUp = e.deltaY < 0;
|
||||||
|
this.changeZoom(!!scrollingUp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected async setMoverToTarget(target: HTMLElement, closing = false, fromRight = 0) {
|
protected async setMoverToTarget(target: HTMLElement, closing = false, fromRight = 0) {
|
||||||
if(this.videoPlayer) { // there could be a better place for it
|
if(this.videoPlayer) { // there could be a better place for it
|
||||||
this.wholeDiv.classList.remove('has-video-controls');
|
this.wholeDiv.classList.remove('has-video-controls');
|
||||||
@ -1209,6 +1211,7 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
|
|||||||
} else {
|
} else {
|
||||||
window.addEventListener('keydown', this.onKeyDown);
|
window.addEventListener('keydown', this.onKeyDown);
|
||||||
window.addEventListener('keyup', this.onKeyUp);
|
window.addEventListener('keyup', this.onKeyUp);
|
||||||
|
if(!isTouchSupported) window.addEventListener('wheel', this.onWheel, {passive: false});
|
||||||
const mainColumns = this.pageEl.querySelector('#main-columns');
|
const mainColumns = this.pageEl.querySelector('#main-columns');
|
||||||
this.pageEl.insertBefore(this.wholeDiv, mainColumns);
|
this.pageEl.insertBefore(this.wholeDiv, mainColumns);
|
||||||
void this.wholeDiv.offsetLeft; // reflow
|
void this.wholeDiv.offsetLeft; // reflow
|
||||||
|
Loading…
Reference in New Issue
Block a user