All files / app/component/chess chess.component.html

60% Statements 15/25
60% Branches 12/20
0% Functions 0/3
85.71% Lines 12/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 252x 128x 128x     64x   128x   128x 64x 64x         64x 64x   128x     64x    
@for (p of pieces; track i; let i = $index) {
  <div class="tile {{ color(i) }}"
       [class.from]="getCoord(white ? i : 63 - i) === from"
       [class.move]="moves.includes(getCoord(white ? i : 63 - i))"
       [class.last-move]="getCoord(white ? i : 63 - i) === lastMoveTo"
       (click)="clickSquare(white ? i : 63 - i)"
       cdkDropList
       [cdkDropListData]="white ? i : 63 - i"
       (cdkDropListDropped)="drop($any($event))">
    @if (white ? p : pieces[63-i]; as rp) {
      <div class="chess-piece {{ rp?.color }}"
           [class.translate]="translate.includes(rp.square)"
           [class.disabled]="!writeAccess || turn !== rp.color"
           cdkDrag
           cdkDragBoundary=".chess-board"
           (cdkDragStarted)="setPieceSize()"
           [cdkDragData]="rp"
           [cdkDragDisabled]="config.mobile || turn !== rp.color">{{ drawPiece(rp) }}</div>
    }
    @if (capturedPiece && getCoord(white ? i : 63 - i) === capturedPiece.square) {
      <div class="chess-piece {{ capturedPiece.piece.color }} captured">{{ drawPiece(capturedPiece.piece) }}</div>
    }
  </div>
}