Skip to content

fix(Camera): infinite range [YTFRONT-6029] - #146

Merged
SimbiozizV merged 6 commits into
mainfrom
YTFRONT-6029_2
Sep 16, 2026
Merged

SimbiozizV merged 6 commits into
mainfrom
YTFRONT-6029_2

Conversation

@SimbiozizV

@SimbiozizV SimbiozizV commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Enhance camera interactions and canvas rendering with bounded, configurable zoom, synchronized range updates, typography token support, and event hover cursors.

New Features:

  • Add configurable zoom sensitivity and minimum/maximum visible time ranges, including unlimited zoom-out by default.
  • Add shared canvas font configuration with CSS variable and inherited-font resolution for built-in and custom renderers.
  • Add event-specific hover cursors and a synchronous range-change event for synchronizing timelines.

Bug Fixes:

  • Prevent camera zoom from producing ranges outside the supported timestamp bounds.
  • Preserve the current range when debounced camera-change notifications are emitted.

Enhancements:

  • Improve trackpad zoom behavior by smoothing small pixel deltas while retaining full steps for line and page wheel events.
  • Support runtime view-configuration updates while preserving component-specific font overrides.
  • Expand Storybook examples and user-facing API documentation for zoom limits, synchronized timelines, cursors, and fonts.

Documentation:

  • Document zoom sensitivity and range limits, canvas font resolution, event cursors, and range synchronization in English and Russian guides and API references.

Tests:

  • Add coverage for zoom behavior and limits, range-change synchronization, cursor ownership, font resolution and caching, and dynamic font configuration.

Chores:

  • Add repository development and contribution guidance in AGENTS.md.

@sourcery-ai

sourcery-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Camera zoom limits are now configurable in milliseconds, defaulting to a 5-second minimum and unrestricted zoom-out, with directional handling that avoids collapsing externally wider ranges. Documentation, regression tests, and a Storybook demonstration cover the new behavior.

File-Level Changes

Change Details Files
Replace hard-coded zoom bounds with configurable camera range limits and preserve unrestricted zoom-out by default.
  • Add optional millisecond-based minRange and maxRange camera settings, with a 5-second minimum default and no maximum by default.
  • Compute zoom domains with directional boundary handling so externally initialized ranges above maxRange are not forcibly collapsed.
  • Document the new options and updated default behavior.
src/TimelineController.ts
src/types/configuration.ts
README.md
README-ru.md
docs/Timeline.md
docs/TimelineController.md
Add regression coverage for default, configured, and out-of-bounds zoom ranges.
  • Verify wide ranges can zoom in and out without default upper-limit collapse.
  • Verify configured maximums clamp only ranges at or below the limit and minimums prevent collapse below the configured threshold.
tests/TimelineController.test.ts
Add an interactive Storybook example for exploring zoom range limits.
  • Provide unlimited, 60-day, and one-year maximum modes with live visible-range reporting.
  • Initialize a 120-day timeline to demonstrate behavior for ranges beyond a configured maximum.
src/stories/Canvas.stories.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gravity-ui-bot

Copy link
Copy Markdown
Contributor

Preview is ready.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/TimelineController.ts" line_range="100-114" />
<code_context>
   ...interactions,
 });

+const getZoomDomain = (
+  domain: number,
+  factor: number,
+  minRange: number,
+  maxRange?: number,
+) => {
+  const nextDomain = domain * factor;
+
+  if (factor < 1) {
+    return domain <= minRange ? domain : Math.max(nextDomain, minRange);
+  }
+
+  if (maxRange === undefined) return nextDomain;
+
+  return domain >= maxRange ? domain : Math.min(nextDomain, maxRange);
+};
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The zoom limits are applied independently, so a configuration with `minRange` greater than `maxRange` produces ranges that violate one of the configured limits: zoom-in clamps to `minRange`, while zoom-out clamps to `maxRange`. The public configuration type accepts this invalid combination without validation.

**Triggers:** When callers configure `minRange` greater than `maxRange`.

**Suggested fix:** Validate that both ranges are positive and `minRange <= maxRange`, or normalize/reject the configuration before handling wheel events.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: src/TimelineController.ts:114


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/TimelineController.ts

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@SimbiozizV
SimbiozizV merged commit 88b23dc into main Sep 16, 2026
5 checks passed
@SimbiozizV
SimbiozizV deleted the YTFRONT-6029_2 branch September 16, 2026 09:36
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.

2 participants