Skip to content

fix(drag): exclude empty glyph bboxes from out-of-bounds check - #1393

Merged
zih-syuan merged 3 commits into
developfrom
zih-syuan/fix-hufnagel-ligature-drag
Aug 12, 2026
Merged

fix(drag): exclude empty glyph bboxes from out-of-bounds check#1393
zih-syuan merged 3 commits into
developfrom
zih-syuan/fix-hufnagel-ligature-drag

Conversation

@zih-syuan

@zih-syuan zih-syuan commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Hufnagel connector glyphs for ascending intervals (E9B4-E9B8) have zero-sized bboxes that collapse to the SVG origin, which isDragOutOfBounds() always read as out of bounds, permanently locking ligature dragging after the first attempt.

Fixes #1389

Summary by CodeRabbit

  • Bug Fixes

    • Improved dragging for ligatures containing connector glyphs.
    • Prevented valid selections from being incorrectly flagged as out of bounds.
  • Tests

    • Added regression coverage for dragging ascending Hufnagel ligatures.

Hufnagel connector glyphs for ascending intervals (E9B4-E9B8) have
zero-sized bboxes that collapse to the SVG origin, which
isDragOutOfBounds() always read as out of bounds, permanently locking
ligature dragging after the first attempt.

Fixes #1389
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@zih-syuan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 711a10fd-1478-474d-837e-b2c91dc07a7e

📥 Commits

Reviewing files that changed from the base of the PR and between 49beef2 and 3946591.

📒 Files selected for processing (1)
  • cypress/e2e/drag/hufnagel-ligature.cy.ts
📝 Walkthrough

Walkthrough

The change excludes zero-sized connector glyphs from drag bounds checks. A Cypress test verifies that an ascending Hufnagel ligature can be created, dragged within bounds, and remains selected.

Changes

Hufnagel ligature dragging

Layer / File(s) Summary
Drag bounds fix and regression coverage
src/utils/DragHandler.ts, cypress/e2e/drag/hufnagel-ligature.cy.ts
isDragOutOfBounds ignores zero-sized glyph bounding boxes. The Cypress test verifies bounded dragging and selection retention for an ascending Hufnagel ligature.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: excluding empty glyph bounding boxes from drag boundary checks.
Linked Issues check ✅ Passed The code excludes zero-sized connector glyphs and adds a regression test for Hufnagel ligature dragging, meeting issue #1389.
Out of Scope Changes check ✅ Passed The changes are limited to the drag-boundary fix and its focused Cypress regression test.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zih-syuan/fix-hufnagel-ligature-drag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cypress/e2e/drag/hufnagel-ligature.cy.ts`:
- Around line 52-57: Strengthen the “safe: move ligature within bounds” test by
asserting an observable drag outcome after drag(), such as a changed rendered
position, updated persisted coordinates, or the expected editor request. Keep
the existing failure-notification check, but do not rely on FIRST_NC and
SECOND_NC selection assertions because those are already true before dragging.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e4eda02e-b17f-4d34-88eb-63d4521959fc

📥 Commits

Reviewing files that changed from the base of the PR and between c4fde83 and 49beef2.

📒 Files selected for processing (2)
  • cypress/e2e/drag/hufnagel-ligature.cy.ts
  • src/utils/DragHandler.ts

Comment thread cypress/e2e/drag/hufnagel-ligature.cy.ts Outdated
Neon's click handler reads metaKey on Mac and ctrlKey elsewhere. The
test only set metaKey, so multi-select silently failed on Linux CI
runners and #toggle-ligature never appeared.
Addresses CodeRabbit feedback on PR#1393: the prior assertions could
pass even if drag() never started a d3 drag or submitted an edit
action. Now also checks the element's rendered position changed.
@zih-syuan
zih-syuan merged commit 5738d9f into develop Aug 12, 2026
4 of 5 checks passed
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.

Ligature dragging becomes unusable after an out-of-bounds error

1 participant