Skip to content

Juice Squeeze: fix irrational tile reordering across rows during drag#177

Merged
skyl merged 1 commit intocorpora-inc:mainfrom
Umanistan:juice-squeeze-best
Feb 18, 2026
Merged

Juice Squeeze: fix irrational tile reordering across rows during drag#177
skyl merged 1 commit intocorpora-inc:mainfrom
Umanistan:juice-squeeze-best

Conversation

@Umanistan
Copy link
Contributor

Summary

  • Replace index-based row assignment (Math.floor(globalIndex / blocksPerRow)) with width-based greedy packing in reflowSentenceBlocks() for correct final layout after drop
  • Use row-preserving grouping by existing sentenceRow in reflowSentenceBlocksAnimated() to prevent unrelated tiles from jumping between rows during drag preview
  • Simplify calculateSentenceRows() and fix tap-to-place row-full check to use actual block widths instead of fixed counts
  • Remove unused getSentenceBlocksPerRow() and associated constants

Problem

In multi-row phrases, dragging a tile from row 0 caused unrelated blocks from row 1 to irrationally jump up to row 0, scrambling the word order. This was caused by a fixed-count index-based row assignment algorithm that ignored actual block widths.

Test plan

  • Test single-row phrases — drag and drop should work normally
  • Test multi-row phrases — dragging a tile should NOT cause unrelated tiles to jump between rows
  • Test RTL languages with multi-row phrases
  • Test tap-to-place with full rows (should overflow to next row)
  • Test on mobile (Android/iOS) layouts

🤖 Generated with Claude Code

Replace index-based row assignment (Math.floor(globalIndex / blocksPerRow))
with width-based greedy packing in reflowSentenceBlocks() and row-preserving
grouping in reflowSentenceBlocksAnimated(). This prevents unrelated tiles from
jumping between rows during drag-and-drop in multi-row phrases.

Also simplifies calculateSentenceRows() and fixes tap-to-place row-full check
to use actual block widths instead of fixed counts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@skyl skyl merged commit cc7a0d0 into corpora-inc:main Feb 18, 2026
1 check 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.

2 participants

Comments