Skip to content

fix: zoom should be wrt the current scrubbers#178

Open
tibisabau wants to merge 2 commits intotrykimu:mainfrom
tibisabau:fix/zoom-wrt-current-scrubbers
Open

fix: zoom should be wrt the current scrubbers#178
tibisabau wants to merge 2 commits intotrykimu:mainfrom
tibisabau:fix/zoom-wrt-current-scrubbers

Conversation

@tibisabau
Copy link
Copy Markdown

Summary

Fixed zoom functionality to zoom relative to the current ruler position instead of from the left edge of the timeline. This provides a more intuitive zoom experience where the playhead stays centered during zoom operations.

Changes

  • Modified handleZoomIn, handleZoomOut, and handleZoomReset in useTimeline.ts to accept an optional centerPx parameter representing the zoom center point
  • Updated zoom calculations to apply an offset that keeps the zoom center point visually stable during zoom operations
  • Updated all zoom function calls in home.tsx to pass the current rulerPositionPx as the zoom center
  • Updated LLM handler zoom functions to support the new optional centerPx parameter for consistency

The zoom now uses the formula: newLeft = scrubber.left * zoomRatio + centerPx * (1 - zoomRatio), which ensures the timeline zooms toward/away from the ruler position rather than always from the left edge.

Testing

  • Verified ESLint passes with no warnings on modified files
  • Confirmed TypeScript type checking shows no errors in modified files
  • Tested zoom behavior matches expected behavior: zooming in/out now keeps the ruler position stable in the viewport

Screenshots / Recordings (if UI)

N/A

Related Issues

Closes #104

Breaking Changes

None. The zoom functions now accept an optional parameter with a default value of 0, maintaining backward compatibility.

Deployment Notes

None required.

The code in this pull request was generated by GitHub Copilot with the Claude Sonnet 4.5 model.

dependabot Bot and others added 2 commits February 24, 2026 15:07
Bumps the npm_and_yarn group with 1 update in the / directory: [ajv](https://github.com/ajv-validator/ajv).


Updates `ajv` from 6.12.6 to 6.14.0
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](ajv-validator/ajv@v6.12.6...v6.14.0)

---
updated-dependencies:
- dependency-name: ajv
  dependency-version: 6.14.0
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 of the timeline's zoom feature by making it relative to the current playhead position. Previously, zooming always occurred from the left edge, which could be disorienting. Now, the timeline zooms in and out around the user's current focus, providing a more natural and intuitive interaction. This change improves usability without introducing any breaking changes.

Highlights

  • Intuitive Zoom Functionality: Implemented zoom functionality that centers on the current ruler (playhead) position, providing a more natural and intuitive user experience instead of zooming from the timeline's left edge.
  • Updated Zoom Hooks: Modified handleZoomIn, handleZoomOut, and handleZoomReset in useTimeline.ts to accept an optional centerPx parameter, allowing zoom operations to pivot around a specified point.
  • Adjusted Zoom Calculations: Adjusted the internal zoom calculations to apply an offset, ensuring the visual stability of the zoom center during scaling operations.
  • UI Integration: Updated all zoom function calls in home.tsx (for both wheel events and UI buttons) to pass the current rulerPositionPx as the centerPx.
  • LLM Handler Consistency: Extended LLM handler zoom functions in llm-handler.ts to support the new optional centerPx parameter, maintaining API consistency.
Changelog
  • app/hooks/useTimeline.ts
    • Updated handleZoomIn, handleZoomOut, and handleZoomReset to accept an optional centerPx argument, defaulting to 0.
    • Introduced an offset calculation using centerPx * (1 - zoomRatio) to maintain the visual center during zoom operations.
    • Modified the left property calculation for scrubbers to scrubber.left * zoomRatio + offset.
  • app/routes/home.tsx
    • Modified calls to handleZoomIn, handleZoomOut, and handleZoomReset to pass the rulerPositionPx as the centerPx argument.
    • Added rulerPositionPx to the dependency array of the useEffect hook managing the wheel event listener.
  • app/utils/llm-handler.ts
    • Updated the signatures of llmZoomIn, llmZoomOut, and llmZoomReset to accept an optional centerPx parameter.
    • Passed the centerPx parameter to the corresponding handleZoom functions.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request since its creation.
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 correctly implements zooming relative to the ruler position, which provides a more intuitive user experience. The changes in useTimeline.ts, home.tsx, and llm-handler.ts are consistent and well-implemented. I've identified an opportunity to refactor the zoom handling logic in useTimeline.ts to reduce code duplication, which would improve maintainability.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zoom should be wrt the current scrubbers

1 participant