Skip to content

Refactor dock splitter resizing logic#246

Open
PieterjanDeClippel wants to merge 1 commit intomasterfrom
codex/refactor-splitter-logic-in-dock-component
Open

Refactor dock splitter resizing logic#246
PieterjanDeClippel wants to merge 1 commit intomasterfrom
codex/refactor-splitter-logic-in-dock-component

Conversation

@PieterjanDeClippel
Copy link
Copy Markdown
Member

Summary

  • refactor the dock web component splitter resizing to mirror the Angular splitter behaviour
  • normalise pointer tracking with axis-specific deltas and guard against invalid resize values
  • improve touch support by preventing default gestures on the splitter divider

Testing

  • nx lint mintplayer-ng-bootstrap (fails: Nx Cloud client cannot be downloaded in the execution environment)

https://chatgpt.com/codex/tasks/task_e_69049b5b74108323802b2a449308bdac

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Refactored Resizing Logic: The dock splitter resizing logic has been refactored to align with the behavior of Angular splitters, ensuring more consistent and predictable resizing.
  • Normalized Pointer Tracking: Pointer tracking now uses axis-specific deltas (startX, startY) for more accurate calculations during resizing.
  • Improved Resize Value Validation: The resizing mechanism now includes robust guards against invalid resize values, such as non-finite numbers or negative sizes, ensuring stability.
  • Enhanced Touch Support: Touch support for splitter dividers has been improved by preventing default browser gestures, leading to a smoother user experience on touch devices.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +1477 to 1485
if (newBefore < 0) {
newBefore = 0;
newAfter = pairTotal;
}

if (newAfter < 0) {
newAfter = 0;
newBefore = pairTotal;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant