feat: manhwa scroll
This commit is contained in:
@@ -22,7 +22,9 @@ export class ScaleImageComponent implements AfterViewInit, OnDestroy {
|
||||
if (this.resizeSubscription) this.resizeSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
onImageLoad() {}
|
||||
onImageLoad() {
|
||||
this.scaleImage();
|
||||
}
|
||||
|
||||
private setupResizeListener() {
|
||||
this.resizeSubscription = fromEvent(window, "resize")
|
||||
@@ -53,8 +55,13 @@ export class ScaleImageComponent implements AfterViewInit, OnDestroy {
|
||||
newWidth = Math.min(newWidth, img.naturalWidth);
|
||||
newHeight = Math.min(newHeight, img.naturalHeight);
|
||||
|
||||
img.style.width = `${newWidth}px`;
|
||||
img.style.height = `${newHeight}px`;
|
||||
if (img.naturalHeight / img.naturalWidth >= 5) {
|
||||
img.style.width = "100%";
|
||||
img.style.height = "auto";
|
||||
} else {
|
||||
img.style.width = `${newWidth}px`;
|
||||
img.style.height = `${newHeight}px`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user