diff --git a/src/Utils.ts b/src/Utils.ts index 99674d926..8203014a7 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -1452,6 +1452,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be if (!element) { return } + console.log("Scrolling into view:", element) // Is the element completely in the view? const parentRect = Utils.findParentWithScrolling(element)?.getBoundingClientRect() if (!parentRect) { @@ -1462,7 +1463,9 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be // Check if the element is within the vertical bounds of the parent element const topIsVisible = elementRect.top >= parentRect.top const bottomIsVisible = elementRect.bottom <= parentRect.bottom - const inView = topIsVisible && bottomIsVisible + const leftIsVisible = elementRect.left >= parentRect.left + const rightIsVisible = elementRect.right <= parentRect.right + const inView = topIsVisible && bottomIsVisible && leftIsVisible && rightIsVisible if (inView) { return }