mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 09:59:48 +02:00
* corrects overscroll issue inside scrollable containers; another fix for #1032 * fix(#1032) - set scrollers offset if within scrollable container
This commit is contained in:
committed by
Ian Storm Taylor
parent
038de22b43
commit
b973580c54
@@ -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
|
||||||
|
Reference in New Issue
Block a user