Refactor dock splitter resizing logic#246
Conversation
Summary of ChangesHello @PieterjanDeClippel, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience and stability of the dock splitter component. The core resizing mechanism has been overhauled to be more robust and consistent, particularly in how it handles user input and calculates new panel dimensions. This ensures a smoother and more reliable interaction when users adjust panel sizes, especially across different input methods like touch. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly refactors the dock splitter resizing logic, making it more robust and improving touch support. The changes mirror the behavior of the Angular splitter, normalize pointer tracking, and add crucial guards against invalid resize values. The addition of touch-action: none is a great enhancement for touch devices. The logic for calculating new sizes during a resize operation is now clearer and handles edge cases better. I've found a small area with redundant code that can be cleaned up, but overall this is an excellent improvement.
| if (newBefore < 0) { | ||
| newBefore = 0; | ||
| newAfter = pairTotal; | ||
| } | ||
|
|
||
| if (newAfter < 0) { | ||
| newAfter = 0; | ||
| newBefore = pairTotal; | ||
| } |
There was a problem hiding this comment.
These checks for negative sizes appear to be redundant. The effectiveMin variable is calculated on line 1458 and is guaranteed to be positive because pairTotal is checked to be positive on line 1454. The code block on lines 1466-1475 ensures that both newBefore and newAfter are clamped to be at least effectiveMin, so they can never be negative. You can safely remove these blocks to simplify the code.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_69049b5b74108323802b2a449308bdac