✨ Improve readability of scroll position calculation logic in GamemasterExplorer component
This commit is contained in:
@@ -768,7 +768,11 @@ function scrollToResult() {
|
|||||||
const elementRect = lineElement.getBoundingClientRect();
|
const elementRect = lineElement.getBoundingClientRect();
|
||||||
|
|
||||||
// Calculate scroll position to center element in container
|
// Calculate scroll position to center element in container
|
||||||
const scrollOffset = elementRect.top - containerRect.top - (containerRect.height / 2) + (elementRect.height / 2);
|
const scrollOffset =
|
||||||
|
elementRect.top -
|
||||||
|
containerRect.top -
|
||||||
|
containerRect.height / 2 +
|
||||||
|
elementRect.height / 2;
|
||||||
container.scrollBy({ top: scrollOffset, behavior: 'smooth' });
|
container.scrollBy({ top: scrollOffset, behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user