Skip to content

Commit

Permalink
New: Setting to enable/disable go next/previous chapter with mouse sc…
Browse files Browse the repository at this point in the history
…roll (Vertical reading)
  • Loading branch information
ollm committed Jan 26, 2024
1 parent 2bbd49e commit 37612bf
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Now when applying Webtoon mode the vertical margin is 0 [`683a08a`](https://github.com/ollm/OpenComic/commit/683a08aad3a6d947004ad77476184d613718b098)
- Show the current reading title in app window [`9520faa`](https://github.com/ollm/OpenComic/commit/9520faa7486e4494bb878ffe2430e9fd198ee33a)
- Option to open file location of current reading from the file menu [`c9215dc`](https://github.com/ollm/OpenComic/commit/c9215dc5cb29a3b5a759d80d21f7ff734053f23c)
- Setting to enable/disable go next/previous chapter with mouse scroll (Vertical reading)

##### 🐛 Bug Fixes

Expand All @@ -23,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Using the first image as a poster does not work [`fd6c748`](https://github.com/ollm/OpenComic/commit/dfd6c748090088109416b847a5e7581d80e36ea7)
- Some errors in scroll reading [`a4887c3`](https://github.com/ollm/OpenComic/commit/a4887c3bfe3f0ec8b75d3cdceedfaae8684fe6df)
- 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)
- Next chapter button not work inscroll mode if last page is smaller than the window and "Adjust to width" is enabled
- 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)

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

Expand Down
1 change: 1 addition & 0 deletions languages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "Zoom global en comptes d'imatge a imatge (Lectura horitzontal)",
"moveZoomWithMouse": "Moure el zoom mitjançant el cursor (Desactiva moure mitjançant arrossegar i deixar anar)",
"scrollWithMouse": "Realitzar desplaçament movent el cursor per les vores de la pantalla (Desactiva desplaçament mitjançant arrossegar i deixar anar)",
"goNextPrevChapterWithScroll": "Anar al capítol següent/anterior amb el desplaçament del ratolí (Lectura vertical)",
"startReadingInFullScreen": "Començar la lectura a pantalla completa",
"trackingAtTheEnd": "Seguiment al final del capítol/tom"
},
Expand Down
1 change: 1 addition & 0 deletions languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "Global zoom instead of image by image (Slide reading)",
"moveZoomWithMouse": "Move zoom using cursor (Disables moving by drag and drop)",
"scrollWithMouse": "Scroll by moving the cursor along the edges of the screen (Disables drag and drop scrolling)",
"goNextPrevChapterWithScroll": "Go next/previous chapter with mouse scroll (Vertical reading)",
"startReadingInFullScreen": "Start reading in full screen",
"trackingAtTheEnd": "Tracking at the end of the chapter/volume"
},
Expand Down
1 change: 1 addition & 0 deletions languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "Zoom global en vez de imagen a imagen (Lectura horizontal)",
"moveZoomWithMouse": "Mover el zoom mediante el cursor (Desactiva mover mediante arrastrar y soltar)",
"scrollWithMouse": "Realizar desplazamiento moviendo el cursor por los bordes de la pantalla (Desactiva desplazamiento mediante arrastrar y soltar)",
"goNextPrevChapterWithScroll": "Ir al capítulo siguiente/anterior con el desplazamiento del mouse (Lectura vertical)",
"startReadingInFullScreen": "Empezar la lectura en pantalla completa",
"trackingAtTheEnd": "Seguimiento al final del capítulo/tomo"
},
Expand Down
1 change: 1 addition & 0 deletions languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
1 change: 1 addition & 0 deletions languages/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "ใช้การซูมที่ตั้งไว้แทนการซูมแบบภาพต่อภาพ (อ่านแบบเลื่อน)",
"moveZoomWithMouse": "ย้ายซูมโดยใช้เคอร์เซอร์ (ปิดการย้ายโดยลากวาง)",
"scrollWithMouse": "เลื่อนโดยย้ายเคอร์เซอร์ไปตามขอบจอ (ปิดการเลื่อนแบบลากและวาง)",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "เริ่มอ่านแบบเต็มจอ",
"trackingAtTheEnd": "ติดตามส่วนท้ายของตอน/เล่ม"
},
Expand Down
1 change: 1 addition & 0 deletions languages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "Thu phóng chung thay cho từng ảnh một (Trình đọc ngang)",
"moveZoomWithMouse": "Thay đổi thu phóng với con trỏ (tắt di chuyển bằng đúp chuột)",
"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)",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "Khởi động trình đọc trong chế độ toàn màn hình",
"trackingAtTheEnd": "Theo dõi tại đầu của chương/tập truyện"
},
Expand Down
1 change: 1 addition & 0 deletions languages/zh-hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "全局缩放而不是逐个图片(幻灯片阅读)",
"moveZoomWithMouse": "使用鼠标移动缩放(禁用通过拖放移动)",
"scrollWithMouse": "通过沿着屏幕边缘移动鼠标来滚动(禁用拖放滚动)",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "开始全屏阅读",
"trackingAtTheEnd": "在章节/卷末尾进行跟踪"
},
Expand Down
1 change: 1 addition & 0 deletions languages/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"globalZoomSlide": "",
"moveZoomWithMouse": "",
"scrollWithMouse": "",
"goNextPrevChapterWithScroll": "",
"startReadingInFullScreen": "",
"trackingAtTheEnd": ""
},
Expand Down
7 changes: 5 additions & 2 deletions scripts/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
reading.hideContent();
reading.music.pause();

generateAppMenu();
setWindowTitle();

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

let _indexLabel = prevIndexLabel = indexLabel;
let _indexLabel = prevIndexLabel = (indexLabel || false);
indexLabel = false;

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

generateAppMenu();

if(!fromSetOfflineMode)
fileManager.setServerInOfflineMode(false);

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

generateAppMenu();

handlebarsContext.comics = [];
handlebarsContext.comicsIndex = false;
handlebarsContext.comicsDeep2 = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep).length >= 2 ? true : false;
Expand Down
15 changes: 7 additions & 8 deletions scripts/opencomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,15 @@ var generateAppMenuData = {resetZoom: null, onReading: null};

function generateAppMenu(force = false)
{
if(force || generateAppMenuData.resetZoom !== electron.webFrame.getZoomFactor() || generateAppMenuData.onReading !== onReading)
let indexPathA = dom.indexPathA();

if(force || generateAppMenuData.resetZoom !== electron.webFrame.getZoomFactor() || generateAppMenuData.onReading !== onReading || generateAppMenuData.indexPathA !== indexPathA)
{
let currentWindow = electronRemote.getCurrentWindow();
generateAppMenuData = {resetZoom: electron.webFrame.getZoomFactor(), onReading: onReading};
generateAppMenuData = {resetZoom: electron.webFrame.getZoomFactor(), onReading: onReading, indexPathA: indexPathA};

let readingCurrentPath = reading.readingCurrentPath();
let readingFolder = (onReading && fs.existsSync(readingCurrentPath) && fs.statSync(readingCurrentPath).isDirectory()) ? true : false;
let currentPath = onReading ? reading.readingCurrentPath() : indexPathA;
let pathIsFolder = (currentPath && fs.existsSync(currentPath) && fs.statSync(currentPath).isDirectory()) ? true : false;

var menuTemplate = [
{
Expand All @@ -768,7 +770,7 @@ function generateAppMenu(force = false)
{label: language.menu.file.addFile, click: function(){addComic()}},
{label: language.menu.file.addFolder, click: function(){addComic(true)}},
{type: 'separator'},
{label: readingFolder ? language.global.contextMenu.openFolderLocation : language.global.contextMenu.openFileLocation, click: function(){electron.shell.showItemInFolder(fileManager.firstCompressedFile(readingCurrentPath))}},
{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))}},
{type: 'separator'},
{role: 'quit', label: language.menu.file.quit, click: function(){electronRemote.app.quit();}},
]
Expand Down Expand Up @@ -813,9 +815,6 @@ function generateAppMenu(force = false)
}
];

if(!onReading)
menuTemplate[0].submenu.splice(4, 2);

var menu = electronRemote.Menu.buildFromTemplate(menuTemplate);
currentWindow.setMenu(menu);

Expand Down
4 changes: 3 additions & 1 deletion scripts/reading.js
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,8 @@ var scrollNextOrPrevComicDelayed = false, scrollNextOrPrevComicST = false;

function scrollNextOrPrevComic(prev = false, delay = false)
{
if(!config.readingGoNextPrevChapterWithScroll) return;

if(delay && !scrollNextOrPrevComicDelayed && ((prev && scrollInStart) || (!prev && scrollInEnd)))
{
if(scrollNextOrPrevComicST) return;
Expand Down Expand Up @@ -4407,7 +4409,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
}
else
{
if(reading.scrollNextOrPrevComic(e.originalEvent.wheelDelta / 120 > 0))
if(reading.scrollNextOrPrevComic(e.originalEvent.wheelDelta / 120 > 0, true))
e.preventDefault();
}
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/storage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var changes = 77; // Update this if readingPagesConfig is updated
var changes = 78; // Update this if readingPagesConfig is updated

var readingPagesConfig = {
readingConfigName: '',
Expand Down Expand Up @@ -114,6 +114,7 @@ var storageDefault = {
readingGlobalZoomSlide: true,
readingMoveZoomWithMouse: false,
readingScrollWithMouse: false,
readingGoNextPrevChapterWithScroll: true,
readingStartReadingInFullScreen: false,
readingTrackingAtTheEnd: true,
readingImageInterpolationMethodDownscaling: 'lanczos3',
Expand Down
8 changes: 8 additions & 0 deletions templates/settings.content.right.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ <h2 class="headline-small">{{language.settings.reading.main}}</h2>
</div>
</div>

<div class="menu-simple-text gamepad-item">
<span>{{language.settings.reading.goNextPrevChapterWithScroll}}</span>
<div class="switch{{#if config.readingGoNextPrevChapterWithScroll}} a{{/if}}" on="settings.set('readingGoNextPrevChapterWithScroll', true)" off="settings.set('readingGoNextPrevChapterWithScroll', false)">
<div></div>
<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>
</div>
</div>

<div class="menu-simple-text gamepad-item">
<span>{{language.settings.reading.startReadingInFullScreen}}</span>
<div class="switch{{#if config.readingStartReadingInFullScreen}} a{{/if}}" on="settings.setStartReadingInFullScreen(true)" off="settings.setStartReadingInFullScreen(false)">
Expand Down

0 comments on commit 37612bf

Please sign in to comment.