Fix single click turns pages on all views

This commit is contained in:
chrox
2024-11-25 18:00:10 +01:00
parent a9485c39a7
commit cb8f4669e8
2 changed files with 14 additions and 9 deletions
@@ -82,16 +82,16 @@ const FoliateViewer: React.FC<{
if (detail.doc) {
if (!detail.doc.isEventListenersAdded) {
detail.doc.isEventListenersAdded = true;
detail.doc.addEventListener('keydown', handleKeydown);
detail.doc.addEventListener('mousedown', handleMousedown);
detail.doc.addEventListener('mouseup', handleMouseup);
detail.doc.addEventListener('click', handleClick);
detail.doc.addEventListener('keydown', handleKeydown.bind(null, bookKey));
detail.doc.addEventListener('mousedown', handleMousedown.bind(null, bookKey));
detail.doc.addEventListener('mouseup', handleMouseup.bind(null, bookKey));
detail.doc.addEventListener('click', handleClick.bind(null, bookKey));
}
}
};
const handleClickTurnPage = (msg: MessageEvent) => {
if (msg.data && msg.data.type === 'iframe-single-click') {
if (msg.data && msg.data.type === 'iframe-single-click' && msg.data.bookKey === bookKey) {
const viewElement = containerRef.current;
if (viewElement) {
const rect = viewElement.getBoundingClientRect();