Fix the effect not being called

This commit is contained in:
Amelia 2025-06-11 01:23:09 +02:00
parent b6e46e2f2d
commit 3eb7f43908
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA

View file

@ -246,7 +246,6 @@ export class InfiniteScrollerComponent implements OnInit, OnChanges, OnDestroy,
// Automatically updates when the breakpoint changes, or when reader settings changes
this.widthOverride = computed(() => {
//console.log("updating widthOverride")
const breakpoint = this.utilityService.activeUserBreakpoint();
const value = this.readerSettings().widthSlider;
@ -258,12 +257,11 @@ export class InfiniteScrollerComponent implements OnInit, OnChanges, OnDestroy,
//perform jump so the page stays in view (NOT WORKING)
effect(() => {
//console.log("width changing!")
const width = this.widthOverride(); // needs to be at the top for effect to work
this.currentPageElem = this.document.querySelector('img#page-' + this.pageNum);
if(!this.currentPageElem)
return;
const width = this.widthOverride();
let images = Array.from(document.querySelectorAll('img[id^="page-"]')) as HTMLImageElement[];
images.forEach((img) => {
this.renderer.setStyle(img, "width", width);