1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 09:59:48 +02:00

corrects overscroll issue inside scrollable containers (#1032) (#1383)

* corrects overscroll issue inside scrollable containers; another fix for #1032

* fix(#1032) - set scrollers offset if within scrollable container
This commit is contained in:
Robert Dale Smith
2017-11-13 13:49:26 -06:00
committed by Ian Storm Taylor
parent 038de22b43
commit b973580c54

View File

@@ -71,10 +71,11 @@ function scrollToSelection(selection) {
xOffset = pageXOffset xOffset = pageXOffset
} else { } else {
const { offsetWidth, offsetHeight, scrollTop, scrollLeft } = scroller const { offsetWidth, offsetHeight, scrollTop, scrollLeft } = scroller
const scrollerRect = scroller.getBoundingClientRect()
width = offsetWidth width = offsetWidth
height = offsetHeight height = offsetHeight
yOffset = scrollTop yOffset = scrollTop - scrollerRect.top
xOffset = scrollLeft xOffset = scrollLeft - scrollerRect.left
} }
const top = (backward ? rect.top : rect.bottom) + yOffset const top = (backward ? rect.top : rect.bottom) + yOffset