Skip to content

Fix move animation clipping beneath board border#191

Open
Copilot wants to merge 10 commits into
mainfrom
copilot/fix-animation-position
Open

Fix move animation clipping beneath board border#191
Copilot wants to merge 10 commits into
mainfrom
copilot/fix-animation-position

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

  • Move <MoveAnimation> to be last child of #board — paint order fix
  • Raise dialog { z-index } from 1 → 100
  • Raise .move-animation-overlay { z-index } from 0 → 10 — above board pieces, below dialog
  • Expand overlay to board border-box (inset: calc(-1 * var(--board-border)), width: auto, height: auto, overflow: hidden) so animated pieces can paint over the visual border
  • Revert coordinate origin back to padding-box edge (boardRect + borderWidth) per review feedback
  • Fix wrong animation size when a piece is on the bar — scope samplePiece query to .point .piece so bar pieces (which are narrower) are not used for size sampling
Original prompt

The animation is appearing underneath the border. I want it to be above the border but below the dialogue


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: ProLoser <67395+ProLoser@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix animation position above border and below dialogue Fix move animation clipping beneath board border Mar 20, 2026
Copilot AI requested a review from ProLoser March 20, 2026 01:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 20, 2026

PR Preview Action v1.8.1

🚀 View preview at
https://ProLoser.github.io/PeaceInTheMiddleEast/preview/pr-191/

Built to branch gh-pages at 2026-03-28 03:29 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ProLoser ProLoser marked this pull request as ready for review March 21, 2026 20:17
@ProLoser
Copy link
Copy Markdown
Owner

@copilot when moving from one side to the other side the piece starting animation position is off the edge of the screen

@ProLoser
Copy link
Copy Markdown
Owner

@copilot some of the points are animating off the right edge of the screen now I don't think it was doing that before and now the animation is showing up below the pieces. İncrease the dialogue Z index

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot when moving from one side to the other side the piece starting animation position is off the edge of the screen

The root cause was that inset: calc(-1 * var(--board-border)) on an absolutely-positioned child of a CSS Grid container produces a smaller overlay than the full board (1212×652 vs 1280×720 in testing), so overflow: hidden was clipping pieces near the bottom/right edges more aggressively than before — this is what made pieces appear to start off the edge.

Fixed in 592e9ad by:

  • Reverting inset back to 0 and the JS coordinate calculation to the original
  • Removing overflow: hidden — pieces now render fully up to the board's content edge and can paint naturally over the border (since #board has overflow: visible)

The z-index fix (10 → 0, keeping animation below the dialog) is preserved.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot some of the points are animating off the right edge of the screen now I don't think it was doing that before and now the animation is showing up below the pieces. İncrease the dialogue Z ind...

Fixed in cad0af6 with three changes:

  1. Off right edge — Added overflow: clip; overflow-clip-margin: var(--board-border, 5vmin) to the overlay. This clips animated pieces at the board's outer edge (border box), preventing them from going off-screen while still allowing them to visually cross the border during animation.

  2. Animation below pieces — Moved <MoveAnimation> to be the last child inside #board (after all 24 <Point> elements). Both the overlay (z-index: 0) and .point (position: relative; z-index: auto) share the same CSS stacking step, where document order determines paint order — being last ensures the overlay paints on top.

  3. Dialog z-index — Raised from 1100.

board

@ProLoser
Copy link
Copy Markdown
Owner

@copilot animating piece should be higher z index than regular board pieces but lower than dialogue

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot animating piece should be higher z index than regular board pieces but lower than dialogue

Done in 5ff2963.move-animation-overlay is now z-index: 10. Board pieces use position: relative; z-index: auto (CSS stacking step 6), so the overlay at step 7 (z-index: 10) paints above them, while the dialog at z-index: 100 remains on top of everything.

@ProLoser
Copy link
Copy Markdown
Owner

@copilot animation does not appear above border

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot animation does not appear above border

Fixed in 26dbae4. The overlay was positioned with inset: 0 (inside the border), so overflow: clip was clipping pieces before they could paint in the border zone. Changed to inset: calc(-1 * var(--board-border)) so the overlay expands to cover the full border-box, with overflow: hidden clipping at the outer edge. Updated the JS coordinate origin from the padding-box edge (boardRect + borderWidth) to the border-box edge (boardRect.left/top) to keep piece positions correct.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the board move animation overlay so animated pieces can render above the board border (without being clipped) while keeping the dialog UI layered above the animation.

Changes:

  • Introduces --board-border and uses it for the board border width.
  • Expands the move animation overlay to the board border-box area and updates coordinate calculations accordingly.
  • Moves <MoveAnimation> to the end of #board children and raises dialog z-index to keep dialogs above the overlay.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/index.tsx Moves <MoveAnimation> to the end of the board DOM for paint order.
src/Dialogues/Dialogues.css Raises dialog z-index to stay above the overlay.
src/Board/MoveAnimation.tsx Aligns animation coordinate origin with the overlay’s new placement.
src/Board/MoveAnimation.css Expands overlay via negative inset and sets overlay z-index/overflow.
src/Board/Board.css Extracts border width into --board-border and uses it for the board border.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Board/MoveAnimation.css
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/Board/MoveAnimation.tsx Outdated
Comment on lines +40 to +41
const boardStyle = getComputedStyle(board);
const overlayLeft = boardRect.left + parseFloat(boardStyle.borderLeftWidth);
const overlayTop = boardRect.top + parseFloat(boardStyle.borderTopWidth);
const overlayLeft = boardRect.left;
const overlayTop = boardRect.top;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot revert this change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f7bcc02 — reverted to boardRect.left + parseFloat(boardStyle.borderLeftWidth) / boardRect.top + parseFloat(boardStyle.borderTopWidth).

Copilot AI requested a review from ProLoser March 22, 2026 19:29
@ProLoser
Copy link
Copy Markdown
Owner

@copilot when a piece is on the bar (hit) the animations for the opposite color of the piece on the bar looks the wrong size. if a black piece is on the bar, the white pieces are too big in the animation. same for the opposite scenario

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 28, 2026

@copilot when a piece is on the bar (hit) the animations for the opposite color of the piece on the bar looks the wrong size. if a black piece is on the bar, the white pieces are too...

Fixed in cc12102. The root cause: bar pieces come before point pieces in the DOM, so when a piece is on the bar, querySelector('.piece:not(.ghost):not(.moved) img') was sampling the bar piece (which is narrower than a point column) and using its smaller width as pieceSize for all animations. Changed the selector to .point .piece:not(.ghost):not(.moved) img to only sample from regular point pieces.

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.

3 participants