scrollTo()

in src/lib/spells/scroll-state.svelte.ts [257:271]


	scrollTo(x: number | undefined, y: number | undefined) {
		if (!window) return;

		(this.element instanceof Document ? window.document.body : this.element)?.scrollTo({
			top: y ?? this.y,
			left: x ?? this.x,
			behavior: this.behavior,
		});
		const scrollContainer =
			(this.element as Window)?.document?.documentElement ||
			(this.element as Document)?.documentElement ||
			(this.element as Element);
		if (x != null) this.internalX = scrollContainer.scrollLeft;
		if (y != null) this.internalY = scrollContainer.scrollTop;
	}