Skip to content

Commit

Permalink
prevent reload when typing, option to select variable width
Browse files Browse the repository at this point in the history
  • Loading branch information
mienaiyami committed Dec 10, 2021
1 parent 68f9f09 commit e7de64e
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mangareader",
"productName": "Manga Reader",
"version": "2.1.8",
"version": "2.1.9",
"description": "App to read manga on desktop",
"main": "./.webpack/main/index.js",
"author": {
Expand Down
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if (!window.fs.existsSync(settingsPath)) {
historyLimit: 60,
locationListSortType: "normal",
readerWidth: 60,
variableImageSize:true,
};
window.fs.writeFileSync(settingsPath, JSON.stringify(settingsData));
}
Expand Down
1 change: 1 addition & 0 deletions src/Components/LocationsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const LocationsTab = forwardRef(
title="Type to Search"
data-tooltip="Type to Search"
tabIndex={-1}
onKeyDown={(e)=>e.stopPropagation()}
onChange={(e) => {
const val = e.target.value;
let filter = "";
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ const Reader = () => {
}}
onLoad={(ev) => {
setImagesLoaded((init) => init + 1);
if (ev.currentTarget.offsetHeight / ev.currentTarget.offsetWidth <= 1.2) {
if (appSettings.variableImageSize && ev.currentTarget.offsetHeight / ev.currentTarget.offsetWidth <= 1.2) {
setWideImages((init) => [...init, e]);
}
}}
Expand Down
1 change: 1 addition & 0 deletions src/Components/ReaderSideList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const ReaderSideList = () => {
setfilter(filter);
}}
onKeyDown={(e) => {
e.stopPropagation()
if (e.key === "Escape") {
e.currentTarget.blur();
}
Expand Down
15 changes: 15 additions & 0 deletions src/Components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const Settings = ({ promptSetDefaultLocation }: { promptSetDefaultLocation: () =
defaultValue={appSettings.historyLimit}
ref={historyInputRef}
onKeyDown={(e) => {
e.stopPropagation();
if (e.key === "Enter") {
historyBtnRef.current?.click();
}
Expand Down Expand Up @@ -230,6 +231,20 @@ const Settings = ({ promptSetDefaultLocation }: { promptSetDefaultLocation: () =
<span>{window.electron.app.getVersion()}</span>
</div>
</div>
<div className="settingItem defaultLocation">
<div className="name">Other settings</div>
<div className="current">
<label className={appSettings.variableImageSize?'selected':''}>
<input type="checkbox" defaultChecked={appSettings.variableImageSize} onChange={(e)=>{
setAppSettings((init)=>{
init.variableImageSize=e.currentTarget.checked;
return {...init};
})
}}/>
<p>Variable image size depending on width(prefered for manga where some images consist of 2 pages).</p>
</label>
</div>
</div>
<div className="settingItem issue">
<div className="name">Issues? :</div>
<div className="current">
Expand Down
1 change: 1 addition & 0 deletions src/Components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const TopBar = forwardRef((props, forwaredRef: React.ForwardedRef<HTMLInputEleme
setPageNumChangeDisabled(false);
}}
onKeyDown={(e) => {
e.stopPropagation();
if (
!(
/[0-9]/gi.test(e.key) ||
Expand Down
1 change: 1 addition & 0 deletions src/MainImports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ declare global {
historyLimit: number;
locationListSortType: "normal" | "inverse";
readerWidth: number;
variableImageSize:boolean;
}
interface ListItem {
mangaName: string;
Expand Down
20 changes: 14 additions & 6 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ body {
cursor: pointer;
}
}
input {
input[type="text"],
input[type="number"] {
background: var(--input-bg);
overflow: scroll;
cursor: text;
Expand Down Expand Up @@ -592,6 +593,15 @@ body {
height: 100%;
border-radius: 3px;
}
label {
display: flex;
cursor: pointer;
background-color: var(--input-bg);
padding: 5px;
gap: 5px;
border-radius: 3px;

}
p {
font-size: 12px;
width: 100%;
Expand All @@ -605,11 +615,9 @@ body {
.enabled {
background-color: #f003;
}
}
}
.themeSelector {
.selected {
background-color: var(--btn-color2);
.selected {
background-color: var(--btn-color2);
}
}
}
}
Expand Down

0 comments on commit e7de64e

Please sign in to comment.