Skip to content

Commit cbc131f

Browse files
committed
feat(monkey): pad trailing white pages and refine column layout
1 parent 5969b01 commit cbc131f

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

src/monkey/copymanga-enhance/scripts/newPage/component/AppBody/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ export default defineComponent({
9797
props: { key: `white-page-group-${groupIndex}`, class: 'auto', pageType: PageType.PORTRAIT },
9898
})
9999
}
100+
if (
101+
tempList[tempList.length - 1][0].props.pageType === PageType.PORTRAIT &&
102+
tempList[tempList.length - 1].length % 4 !== 0
103+
) {
104+
const groupIndex = tempList.length - 1
105+
const group = tempList[groupIndex]
106+
Array.from({ length: 4 - (group.length % 4) }).forEach((_, index) => {
107+
group.push({
108+
component: WhitePage,
109+
props: { key: `white-page-group-${groupIndex + index}-end`, class: 'auto end', pageType: PageType.PORTRAIT },
110+
})
111+
})
112+
}
100113
return tempList.flat();
101114
}
102115
const injectDataIndex = (list: ImageItem[]): ImageItem[] => {

src/monkey/copymanga-enhance/scripts/newPage/component/AppBody/style.css

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,30 @@
1111
display: flex;
1212
flex-basis: 100%;
1313
justify-content: center;
14-
padding-top: 1px;
15-
padding-bottom: 1px;
1614
order: attr(data-index number)
1715
}
1816

1917
:is(.ltr, .rtl).direction-wrapper {
2018
scroll-snap-type: y mandatory;
2119
}
2220
:is(.ltr, .rtl) .wrapper {
21+
height: var(--body-height);
2322
scroll-snap-align: center;
2423
}
2524

26-
/* #region 单行时 */
25+
*:not(:is(.ltr, .rtl)) > .wrapper:has(> .white-page) {
26+
display: none;
27+
}
28+
29+
/* #region 单列时 */
2730
@media (max-aspect-ratio: 5 / 3) {
2831
.wrapper:has(> .white-page) {
2932
display: none;
3033
}
3134
}
32-
/* #endregion 单行时 */
35+
/* #endregion 单列时 */
3336

34-
/* #region 多行时 */
37+
/* #region 多列时 */
3538
@media (min-aspect-ratio: 5 / 3) {
3639
:is(.ltr, .rtl) .wrapper:has(> .portrait) {
3740
flex-basis: 50%;
@@ -47,10 +50,22 @@
4750
padding-right: 5px;
4851
}
4952
}
53+
/* #endregion 多列时 */
54+
55+
/* #region 两列时 */
56+
@media (min-aspect-ratio: 5 / 3) and (max-aspect-ratio: 9 / 3) {
57+
:is(.ltr, .rtl) .wrapper:has(> .white-page):nth-last-child(2),
58+
:is(.ltr, .rtl) .wrapper:has(> .white-page):nth-last-child(2) + .wrapper:has(> .white-page) {
59+
display: none;
60+
}
61+
}
62+
/* #endregion 两列时 */
63+
64+
/* #region 四列时 */
5065
@media (min-aspect-ratio: 9 / 3) {
5166
:is(.ltr, .rtl) .wrapper:has(> .portrait) {
5267
flex-basis: 25%;
5368
}
5469
}
55-
/* #endregion 多行时 */
70+
/* #endregion 四列时 */
5671

0 commit comments

Comments
 (0)