Skip to content

Commit 264609b

Browse files
committed
fix: 🐛 增加卷轴模式下的「滚动翻页时对齐边缘」选项
#277
1 parent bee2cbc commit 264609b

14 files changed

Lines changed: 105 additions & 68 deletions

File tree

locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"option": {
130130
"abreast_duplicate": "Column duplicates ratio",
131131
"abreast_mode": "Abreast scroll mode",
132+
"align_edge": "Align to edge when turning page",
132133
"always_load_all_img": "Always load all images",
133134
"autoFullscreen": "Auto fullscreen",
134135
"autoHiddenMouse": "Auto hide mouse",

locales/hu.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"option": {
130130
"abreast_duplicate": "每列重复比例",
131131
"abreast_mode": "并排卷轴模式",
132+
"align_edge": "Lapozáskor élhez igazítás",
132133
"always_load_all_img": "始终加载所有图片",
133134
"autoFullscreen": "Automatikus teljes képernyő",
134135
"autoHiddenMouse": "自动隐藏鼠标",

locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"option": {
130130
"abreast_duplicate": "Коэффициент дублирования столбцов",
131131
"abreast_mode": "Режим прокрутки в ряд",
132+
"align_edge": "Выравнивание по краю при перелистывании страницы",
132133
"always_load_all_img": "Всегда загружать все изображения",
133134
"autoFullscreen": "Авто полный экран",
134135
"autoHiddenMouse": "Автоматически скрывать курсор мыши",

locales/ta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"option": {
130130
"abreast_duplicate": "ஒவ்வொரு நெடுவரிசை நகல் விகிதம்",
131131
"abreast_mode": "இணை சுருள் பயன்முறை",
132+
"align_edge": "பக்கத்தைத் திருப்பும்போது விளிம்பில் சீரமை",
132133
"always_load_all_img": "எப்போதும் எல்லா படங்களையும் ஏற்றவும்",
133134
"autoFullscreen": "தானியங்கி முழுத்திரை",
134135
"autoHiddenMouse": "தானியங்கி மறைக்கும் சுட்டி",

locales/zh.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"option": {
130130
"abreast_duplicate": "每列重复比例",
131131
"abreast_mode": "并排卷轴模式",
132+
"align_edge": "滚动翻页时对齐边缘",
132133
"always_load_all_img": "始终加载所有图片",
133134
"autoFullscreen": "自动全屏",
134135
"autoHiddenMouse": "自动隐藏鼠标",
@@ -314,7 +315,7 @@
314315
"module_download_complete": "图片放大模型下载完成",
315316
"module_download_failed": "图片放大模型下载失败",
316317
"module_downloading": "图片放大模型下载中...",
317-
"title": "放大图片",
318+
"title": "无损放大图片",
318319
"upscaled": "已放大",
319320
"upscaling": "放大中",
320321
"webgpu_tip": "无法使用 WebGPU 放大图片,处理速度将变慢"

src/components/Manga/actions/operate.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ const scrollViewTurnPage = (offset: number) => {
6161
const dir = offset > 0 ? 'next' : 'prev';
6262
if (handleEndTurnPage(dir)) return;
6363

64+
if (!store.option.scrollMode.alignEdge) return scrollBy(offset, true);
65+
6466
const viewBottom = scrollTop() + store.rootSize.height;
6567
let viewBottomPage = findTopPage(viewBottom);
6668
// 如果底页只露出了一点点,就当它没显示出来,避免小数滚动的误差

src/components/Manga/components/Setting.module.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,12 @@
107107
margin-top: 1em;
108108
}
109109

110-
button[disabled] {
111-
cursor: not-allowed;
110+
&[data-disabled] {
112111
opacity: 0.5;
112+
113+
button {
114+
cursor: not-allowed;
115+
}
113116
}
114117
}
115118

src/components/Manga/components/SettingPanel.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Component, ParentComponent } from 'solid-js';
22

3-
import { createSignal, For } from 'solid-js';
3+
import { createSignal, For, Show } from 'solid-js';
44

55
import { createEffectOn, lang } from 'helper';
66

@@ -34,14 +34,15 @@ export const SettingPanel: Component = () => (
3434
on:click={stopPropagation}
3535
>
3636
<For each={store.prop.editSettingList(defaultSettingList())}>
37-
{([name, SettingItem, initShow], i) => {
37+
{([name, SettingItem, options], i) => {
38+
const initShow = options?.initShow;
3839
const [show, setShwo] = createSignal(Boolean(initShow));
3940

4041
if (typeof initShow === 'function')
4142
createEffectOn(initShow, (val) => setShwo(Boolean(val)));
4243

4344
return (
44-
<>
45+
<Show when={options?.hidden ? !options.hidden() : true}>
4546
{i() ? <hr /> : null}
4647
<div class={classes.SettingBlock} data-show={show()}>
4748
<SettingBlockSubtitle onClick={() => setShwo((prev) => !prev)}>
@@ -52,7 +53,7 @@ export const SettingPanel: Component = () => (
5253
<SettingItem />
5354
</div>
5455
</div>
55-
</>
56+
</Show>
5657
);
5758
}}
5859
</For>

src/components/Manga/components/SettingsItem.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import type { Component, JSX } from 'solid-js';
22

3+
import { boolDataVal } from 'helper';
4+
35
import classes from '../index.module.css';
46

57
export type SettingsItemProps = {
68
name: string;
7-
children?: JSX.Element | JSX.Element[];
9+
disabled?: boolean;
810

11+
children?: JSX.Element | JSX.Element[];
912
class?: string;
1013
classList?: ClassList;
1114
style?: JSX.CSSProperties;
@@ -24,6 +27,7 @@ export const SettingsItem: Component<SettingsItemProps> = (props) => (
2427
...props.classList,
2528
}}
2629
style={props.style}
30+
data-disabled={boolDataVal(props.disabled)}
2731
>
2832
<div class={classes.SettingsItemName}> {props.name} </div>
2933
{props.children}

src/components/Manga/components/SettingsItemSwitch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export const SettingsItemSwitch: Component<SettingsItemSwitchProps> = (
2222
name={props.name}
2323
class={props.class}
2424
classList={props.classList}
25+
disabled={props.disabled}
2526
>
2627
<button
2728
class={classes.SettingsItemSwitch}
2829
type="button"
2930
on:click={handleClick}
3031
data-checked={props.value}
31-
disabled={props.disabled}
3232
>
3333
<div class={classes.SettingsItemSwitchRound} />
3434
</button>

0 commit comments

Comments
 (0)