feat(shortcut): add ctrl + mouse wheel to zoom in/out, closes #2011 (#2533)

This commit is contained in:
Huang Xin
2025-11-25 00:19:28 +08:00
committed by GitHub
parent fa66e6fca6
commit a54daaaa90
5 changed files with 113 additions and 6 deletions
@@ -3,6 +3,7 @@ import { useReaderStore } from '@/store/readerStore';
import { useBookDataStore } from '@/store/bookDataStore';
import { debounce } from '@/utils/debounce';
import { ScrollSource } from './usePagination';
import { eventDispatcher } from '@/utils/event';
export const useMouseEvent = (
bookKey: string,
@@ -19,7 +20,15 @@ export const useMouseEvent = (
debounceScroll('mouse', -msg.data.deltaY, 0);
}
if (msg.data.type === 'iframe-wheel') {
debounceFlip(msg);
if (msg.data.ctrlKey) {
if (msg.data.deltaY > 0) {
eventDispatcher.dispatch('zoom-out', { factor: Math.abs(msg.data.deltaY) / 100 });
} else if (msg.data.deltaY < 0) {
eventDispatcher.dispatch('zoom-in', { factor: Math.abs(msg.data.deltaY) / 100 });
}
} else {
debounceFlip(msg);
}
} else {
handlePageFlip(msg);
}