Refactors edge scroll start detection
Improves edge scroll detection by listening for actual scroll events instead of relying on mouse position. This change ensures that the 'edgescroll:started' event is only emitted when scrolling has actually begun, preventing false positives and improving the accuracy of scroll compensation. It also removes the unnecessary scroll listener from the DragDropManager, consolidating scroll handling in the EdgeScrollManager.
This commit is contained in:
parent
faf8b50593
commit
d259620371
2 changed files with 41 additions and 28 deletions
|
|
@ -182,7 +182,7 @@ export class DragDropManager {
|
|||
* Optimized mouse move handler with consolidated position calculations
|
||||
*/
|
||||
private handleMouseMove(event: MouseEvent): void {
|
||||
|
||||
console.log('handleMouseMove', event)
|
||||
if (this.isScrollCompensating) return;
|
||||
//this.currentMouseY = event.clientY;
|
||||
// this.lastMousePosition = { x: event.clientX, y: event.clientY };
|
||||
|
|
@ -305,7 +305,6 @@ export class DragDropManager {
|
|||
*/
|
||||
private handleMouseUp(event: MouseEvent): void {
|
||||
this.stopDragAnimation();
|
||||
this.removeScrollListener();
|
||||
|
||||
if (this.originalElement) {
|
||||
|
||||
|
|
@ -376,7 +375,6 @@ export class DragDropManager {
|
|||
console.log('🚫 DragDropManager: Cancelling drag - mouse left grid container');
|
||||
|
||||
this.cleanupAllClones();
|
||||
this.removeScrollListener();
|
||||
|
||||
this.originalElement.style.opacity = '';
|
||||
this.originalElement.style.cursor = '';
|
||||
|
|
@ -486,19 +484,6 @@ export class DragDropManager {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove scroll listener
|
||||
*/
|
||||
private removeScrollListener(): void {
|
||||
if (this.scrollListener && this.scrollableContent) {
|
||||
this.scrollableContent.removeEventListener('scroll', this.scrollListener);
|
||||
this.scrollListener = null;
|
||||
}
|
||||
this.isScrollCompensating = false;
|
||||
this.initialScrollTop = 0;
|
||||
this.initialCloneTop = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop drag animation
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue