Skip to content

Commit 37612bf

Browse files
committed
New: Setting to enable/disable go next/previous chapter with mouse scroll (Vertical reading)
1 parent 2bbd49e commit 37612bf

21 files changed

+42
-13
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1313
- Now when applying Webtoon mode the vertical margin is 0 [`683a08a`](https://github.com/ollm/OpenComic/commit/683a08aad3a6d947004ad77476184d613718b098)
1414
- Show the current reading title in app window [`9520faa`](https://github.com/ollm/OpenComic/commit/9520faa7486e4494bb878ffe2430e9fd198ee33a)
1515
- Option to open file location of current reading from the file menu [`c9215dc`](https://github.com/ollm/OpenComic/commit/c9215dc5cb29a3b5a759d80d21f7ff734053f23c)
16+
- Setting to enable/disable go next/previous chapter with mouse scroll (Vertical reading)
1617

1718
##### 🐛 Bug Fixes
1819

@@ -23,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2324
- Using the first image as a poster does not work [`fd6c748`](https://github.com/ollm/OpenComic/commit/dfd6c748090088109416b847a5e7581d80e36ea7)
2425
- Some errors in scroll reading [`a4887c3`](https://github.com/ollm/OpenComic/commit/a4887c3bfe3f0ec8b75d3cdceedfaae8684fe6df)
2526
- Stuck in a loop trying to read an epub file when the epub or zip is corrupt [`6388a9e`](https://github.com/ollm/OpenComic/commit/6388a9ef8eb118e1d337fb6becd68ec64b5defc3)
26-
- Next chapter button not work inscroll mode if last page is smaller than the window and "Adjust to width" is enabled
27+
- Next chapter button not work inscroll mode if last page is smaller than the window and "Adjust to width" is enabled [`2bbd49e`](https://github.com/ollm/OpenComic/commit/2bbd49e43f9bb96c2dc00f21494acd7a92820331)
2728

2829
## [v1.1.0](https://github.com/ollm/OpenComic/releases/tag/v1.1.0) (13-01-2024)
2930

languages/ca.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "Zoom global en comptes d'imatge a imatge (Lectura horitzontal)",
194194
"moveZoomWithMouse": "Moure el zoom mitjançant el cursor (Desactiva moure mitjançant arrossegar i deixar anar)",
195195
"scrollWithMouse": "Realitzar desplaçament movent el cursor per les vores de la pantalla (Desactiva desplaçament mitjançant arrossegar i deixar anar)",
196+
"goNextPrevChapterWithScroll": "Anar al capítol següent/anterior amb el desplaçament del ratolí (Lectura vertical)",
196197
"startReadingInFullScreen": "Començar la lectura a pantalla completa",
197198
"trackingAtTheEnd": "Seguiment al final del capítol/tom"
198199
},

languages/cs.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/de.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "Global zoom instead of image by image (Slide reading)",
194194
"moveZoomWithMouse": "Move zoom using cursor (Disables moving by drag and drop)",
195195
"scrollWithMouse": "Scroll by moving the cursor along the edges of the screen (Disables drag and drop scrolling)",
196+
"goNextPrevChapterWithScroll": "Go next/previous chapter with mouse scroll (Vertical reading)",
196197
"startReadingInFullScreen": "Start reading in full screen",
197198
"trackingAtTheEnd": "Tracking at the end of the chapter/volume"
198199
},

languages/es.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "Zoom global en vez de imagen a imagen (Lectura horizontal)",
194194
"moveZoomWithMouse": "Mover el zoom mediante el cursor (Desactiva mover mediante arrastrar y soltar)",
195195
"scrollWithMouse": "Realizar desplazamiento moviendo el cursor por los bordes de la pantalla (Desactiva desplazamiento mediante arrastrar y soltar)",
196+
"goNextPrevChapterWithScroll": "Ir al capítulo siguiente/anterior con el desplazamiento del mouse (Lectura vertical)",
196197
"startReadingInFullScreen": "Empezar la lectura en pantalla completa",
197198
"trackingAtTheEnd": "Seguimiento al final del capítulo/tomo"
198199
},

languages/fr.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/hu.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/it.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/ja.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/pt-br.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/ru.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

languages/th.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "ใช้การซูมที่ตั้งไว้แทนการซูมแบบภาพต่อภาพ (อ่านแบบเลื่อน)",
194194
"moveZoomWithMouse": "ย้ายซูมโดยใช้เคอร์เซอร์ (ปิดการย้ายโดยลากวาง)",
195195
"scrollWithMouse": "เลื่อนโดยย้ายเคอร์เซอร์ไปตามขอบจอ (ปิดการเลื่อนแบบลากและวาง)",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "เริ่มอ่านแบบเต็มจอ",
197198
"trackingAtTheEnd": "ติดตามส่วนท้ายของตอน/เล่ม"
198199
},

languages/vi.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "Thu phóng chung thay cho từng ảnh một (Trình đọc ngang)",
194194
"moveZoomWithMouse": "Thay đổi thu phóng với con trỏ (tắt di chuyển bằng đúp chuột)",
195195
"scrollWithMouse": "Cuộn khi di chuyển con trỏ theo viền màn hình (tắt cuộn bằng đúp chuột)",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "Khởi động trình đọc trong chế độ toàn màn hình",
197198
"trackingAtTheEnd": "Theo dõi tại đầu của chương/tập truyện"
198199
},

languages/zh-hans.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "全局缩放而不是逐个图片(幻灯片阅读)",
194194
"moveZoomWithMouse": "使用鼠标移动缩放(禁用通过拖放移动)",
195195
"scrollWithMouse": "通过沿着屏幕边缘移动鼠标来滚动(禁用拖放滚动)",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "开始全屏阅读",
197198
"trackingAtTheEnd": "在章节/卷末尾进行跟踪"
198199
},

languages/zh-hant.json

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"globalZoomSlide": "",
194194
"moveZoomWithMouse": "",
195195
"scrollWithMouse": "",
196+
"goNextPrevChapterWithScroll": "",
196197
"startReadingInFullScreen": "",
197198
"trackingAtTheEnd": ""
198199
},

scripts/dom.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
370370
reading.hideContent();
371371
reading.music.pause();
372372

373-
generateAppMenu();
374373
setWindowTitle();
375374

376375
currentPathScrollTop[currentPath === false ? 0 : currentPath] = template.contentRight().children().scrollTop();
@@ -384,7 +383,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
384383
if(currentPathScrollTop[path === false ? 0 : path])
385384
keepScroll = currentPathScrollTop[path === false ? 0 : path];
386385

387-
let _indexLabel = prevIndexLabel = indexLabel;
386+
let _indexLabel = prevIndexLabel = (indexLabel || false);
388387
indexLabel = false;
389388

390389
currentPath = path;
@@ -398,6 +397,8 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
398397
dom.fromLibrary(true);
399398
dom.indexPathControl(false);
400399

400+
generateAppMenu();
401+
401402
if(!fromSetOfflineMode)
402403
fileManager.setServerInOfflineMode(false);
403404

@@ -663,6 +664,8 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
663664
if(!fromGoBack)
664665
indexPathControl(path, mainPath);
665666

667+
generateAppMenu();
668+
666669
handlebarsContext.comics = [];
667670
handlebarsContext.comicsIndex = false;
668671
handlebarsContext.comicsDeep2 = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep).length >= 2 ? true : false;

scripts/opencomic.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -751,13 +751,15 @@ var generateAppMenuData = {resetZoom: null, onReading: null};
751751

752752
function generateAppMenu(force = false)
753753
{
754-
if(force || generateAppMenuData.resetZoom !== electron.webFrame.getZoomFactor() || generateAppMenuData.onReading !== onReading)
754+
let indexPathA = dom.indexPathA();
755+
756+
if(force || generateAppMenuData.resetZoom !== electron.webFrame.getZoomFactor() || generateAppMenuData.onReading !== onReading || generateAppMenuData.indexPathA !== indexPathA)
755757
{
756758
let currentWindow = electronRemote.getCurrentWindow();
757-
generateAppMenuData = {resetZoom: electron.webFrame.getZoomFactor(), onReading: onReading};
759+
generateAppMenuData = {resetZoom: electron.webFrame.getZoomFactor(), onReading: onReading, indexPathA: indexPathA};
758760

759-
let readingCurrentPath = reading.readingCurrentPath();
760-
let readingFolder = (onReading && fs.existsSync(readingCurrentPath) && fs.statSync(readingCurrentPath).isDirectory()) ? true : false;
761+
let currentPath = onReading ? reading.readingCurrentPath() : indexPathA;
762+
let pathIsFolder = (currentPath && fs.existsSync(currentPath) && fs.statSync(currentPath).isDirectory()) ? true : false;
761763

762764
var menuTemplate = [
763765
{
@@ -768,7 +770,7 @@ function generateAppMenu(force = false)
768770
{label: language.menu.file.addFile, click: function(){addComic()}},
769771
{label: language.menu.file.addFolder, click: function(){addComic(true)}},
770772
{type: 'separator'},
771-
{label: readingFolder ? language.global.contextMenu.openFolderLocation : language.global.contextMenu.openFileLocation, click: function(){electron.shell.showItemInFolder(fileManager.firstCompressedFile(readingCurrentPath))}},
773+
{label: pathIsFolder ? language.global.contextMenu.openFolderLocation : language.global.contextMenu.openFileLocation, enabled: currentPath, click: function(){pathIsFolder ? electron.shell.openPath(currentPath) : electron.shell.showItemInFolder(fileManager.firstCompressedFile(currentPath))}},
772774
{type: 'separator'},
773775
{role: 'quit', label: language.menu.file.quit, click: function(){electronRemote.app.quit();}},
774776
]
@@ -813,9 +815,6 @@ function generateAppMenu(force = false)
813815
}
814816
];
815817

816-
if(!onReading)
817-
menuTemplate[0].submenu.splice(4, 2);
818-
819818
var menu = electronRemote.Menu.buildFromTemplate(menuTemplate);
820819
currentWindow.setMenu(menu);
821820

scripts/reading.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,8 @@ var scrollNextOrPrevComicDelayed = false, scrollNextOrPrevComicST = false;
13811381

13821382
function scrollNextOrPrevComic(prev = false, delay = false)
13831383
{
1384+
if(!config.readingGoNextPrevChapterWithScroll) return;
1385+
13841386
if(delay && !scrollNextOrPrevComicDelayed && ((prev && scrollInStart) || (!prev && scrollInEnd)))
13851387
{
13861388
if(scrollNextOrPrevComicST) return;
@@ -4407,7 +4409,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
44074409
}
44084410
else
44094411
{
4410-
if(reading.scrollNextOrPrevComic(e.originalEvent.wheelDelta / 120 > 0))
4412+
if(reading.scrollNextOrPrevComic(e.originalEvent.wheelDelta / 120 > 0, true))
44114413
e.preventDefault();
44124414
}
44134415
}

scripts/storage.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var changes = 77; // Update this if readingPagesConfig is updated
1+
var changes = 78; // Update this if readingPagesConfig is updated
22

33
var readingPagesConfig = {
44
readingConfigName: '',
@@ -114,6 +114,7 @@ var storageDefault = {
114114
readingGlobalZoomSlide: true,
115115
readingMoveZoomWithMouse: false,
116116
readingScrollWithMouse: false,
117+
readingGoNextPrevChapterWithScroll: true,
117118
readingStartReadingInFullScreen: false,
118119
readingTrackingAtTheEnd: true,
119120
readingImageInterpolationMethodDownscaling: 'lanczos3',

templates/settings.content.right.html

+8
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ <h2 class="headline-small">{{language.settings.reading.main}}</h2>
8484
</div>
8585
</div>
8686

87+
<div class="menu-simple-text gamepad-item">
88+
<span>{{language.settings.reading.goNextPrevChapterWithScroll}}</span>
89+
<div class="switch{{#if config.readingGoNextPrevChapterWithScroll}} a{{/if}}" on="settings.set('readingGoNextPrevChapterWithScroll', true)" off="settings.set('readingGoNextPrevChapterWithScroll', false)">
90+
<div></div>
91+
<svg viewBox="0 0 52 32"><path d="M 8,0 C 3.58,0 0,3.58 0,8 0,12.42 3.58,16 8,16 8,16 8,16 8,16 12.42,16 16,12.42 16,8 16,3.58 12.42,0 8,0 8,0 8,0 8,0 Z"></path></svg>
92+
</div>
93+
</div>
94+
8795
<div class="menu-simple-text gamepad-item">
8896
<span>{{language.settings.reading.startReadingInFullScreen}}</span>
8997
<div class="switch{{#if config.readingStartReadingInFullScreen}} a{{/if}}" on="settings.setStartReadingInFullScreen(true)" off="settings.setStartReadingInFullScreen(false)">

0 commit comments

Comments
 (0)