-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto scroll not working when you are dragging a widget and at bottom or top of the screen. #2585
Labels
Comments
Boyce Dach said: I am using this method to solve the problem for the time being. let startElPos = 0
myGridStack.on('dragstart', (event, el) => {
startElPos = el.getBoundingClientRect().top
})
myGridStack.on('drag', (event, el) => {
let currentElPos = el.getBoundingClientRect().top
let top = el.offsetTop * 2
/* if (currentElPos > startElPos) {
top = el.offsetTop * 2
} else if (currentElPos < startElPos) {
top = -(el.offsetTop * 2)
}*/
// Scroll up
if (currentElPos < startElPos) {
top = -(el.offsetTop * 2)
}
// document.querySelector(`.${props.parentCls}`).scrollTop = top
document.querySelector(`.${props.parentCls}`).scrollTo({
top,
behavior: 'smooth',
})
}) |
Is there any fix for this? @adumesny @tamilselvan-stratforge |
not unless someone wants to sponsor this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bcda637f-5b79-49cd-9544-8e9d3fd2f567.mp4
Subject: Auto scroll not working when you are dragging a widget and at bottom or top of the screen.
Pre-requisite:
Make the height of one of the items inside the grid bigger than the actual grid then drag an item from the outside of the grid to place it at the bottom, the screen does not scroll automatically.
Expected Behavior: Screen should scroll to the bottom of the screen
https://github.com/gridstack/gridstack.js/assets/106658141/9baf629f-0cd6-48a5-bbf0-d25cbd3116c9
The text was updated successfully, but these errors were encountered: