Skip to content

Commit 4d776e7

Browse files
committed
fix(mangacopy): fixed logic of displaying white page and landscape image
1 parent 3d6aa42 commit 4d776e7

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/monkey/copymanga-enhance/scripts/new-vue-mixin/image.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@ const ImageMixin = (info: PageInfo) => ({
3030
const that = (this as any)
3131
const rawImageList: string[] = that.images || []
3232
const curList = rawImageList.map((imageUrl, index) => ({ index, url: imageUrl, type: that.imageInfos[index]?.type ?? PageType.LOADING }))
33-
const hasWhitePage = that.canWhitePage
33+
const hasWhitePage = that.hasWhitePage
3434
let useWhitePage = !hasWhitePage
3535
const groups: any[][] = []
3636
function addImage (obj: any) {
3737
if (
38+
// First image group
3839
groups.length === 0 ||
40+
// Last image group is full
3941
groups[groups.length - 1].length === 2 ||
40-
groups[groups.length - 1][0].type === PageType.LANDSCAPE
42+
// Last image group has a landscape image
43+
groups[groups.length - 1][0].type === PageType.LANDSCAPE ||
44+
// Last image group has a some site but the current image is landscape
45+
groups[groups.length - 1].length === 1 && obj.type === PageType.LANDSCAPE
4146
) groups.push([])
4247
groups[groups.length - 1].push(obj)
4348
}

src/monkey/copymanga-enhance/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,27 @@
5151
#app .images {
5252
width: 100vw;
5353
justify-content: space-evenly;
54+
column-gap: 10px;
55+
}
56+
57+
#app .images > div {
58+
min-width: calc((100% - 10px) / 4);
59+
}
60+
61+
#app .images > div:has(.landscape),
62+
#app .images > div:has(.portrait + .portrait),
63+
#app .images > div:has(.white_page + .portrait) {
64+
min-width: calc((100% - 10px) / 2);
5465
}
5566

5667
#app .images.rtl > div {
5768
flex-direction: row-reverse;
5869
}
5970

71+
#app .images.rtl img, #app .images.ltr img {
72+
height: 100%;
73+
}
74+
6075
#app .images div > div {
6176
height: var(--image-max-height);
6277
}

0 commit comments

Comments
 (0)