Frontmatter
| id | 8915 |
| title | Refactor GridDragScroll to use unified event handlers |
| state | Closed |
| labels | developer-experienceairefactoringperformance |
| assignees | tobiu |
| createdAt | Jan 30, 2026, 2:17 PM |
| updatedAt | Jan 30, 2026, 2:21 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8915 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 30, 2026, 2:21 PM |
Refactor GridDragScroll to use unified event handlers
tobiu assigned to @tobiu on Jan 30, 2026, 2:21 PM

tobiu
Jan 30, 2026, 2:21 PM
Input from Gemini 3 Pro:
✦ I have successfully refactored
Neo.main.addon.GridDragScrollto use unified event handlers, significantly reducing code duplication.Refactoring Details
1. Unified Logic:
- Replaced separate
onMouseDown/onTouchStartwith a singleonDragStart.- Replaced separate
onMouseMove/onTouchMovewith a singleonDragMove.- Replaced separate
onMouseUp/onTouchEndwith a singleonDragEnd.2. Coordinate Normalization:
- Implemented
getEventCoordinates(event)to abstract away the differences betweenMouseEvent(clientX/Y) andTouchEvent(touches[0].clientX/Y).3. Streamlined Registration:
- The
registerandunregistermethods now share the same handler references, with only minor conditional logic to determine which DOM event type (mousedown vs touchstart) to listen for based onNeo.config.hasTouchEvents.Outcome: The addon is now more concise (removed ~57 lines) and easier to maintain, with a single source of truth for drag logic regardless of the input device. Behavior remains identical to the previous implementation.
tobiu closed this issue on Jan 30, 2026, 2:21 PM
Problem: The newly created
Neo.main.addon.GridDragScrollcontains significant code duplication between its mouse (onMouseDown,onMouseMove,onMouseUp) and touch (onTouchStart,onTouchMove,onTouchEnd) event handlers. The logic for delta calculation, registration lookup, and drag state management is nearly identical.Solution: Refactor the addon to use unified event handlers for both input types.
Tasks:
onDragStart,onDragMove, andonDragEndmethods that handle bothMouseEventandTouchEventtypes.clientXandclientYuniformly from either event type (usingevent.touches[0]for touch).registerandunregisterto attach these unified listeners based onNeo.config.hasTouchEvents.Benefits: