All files / player-browser/src/skins/pixi-kit wheel.ts

100% Statements 4/4
100% Branches 6/6
100% Functions 1/1
100% Lines 3/3

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                9x 2x 9x    
import type { BeMusicLaneKind } from '@be-music/player-skin-sdk';
 
/**
 * The outline (`[x0, y0, x1, y1, x2, y2]`) of the arrow a skin draws on a 24 / 48 KEY wheel lane: a triangle centred
 * on `(cx, cy)`, `size` px from its centre to the tip, pointing up for a `'wheel-up'` lane and down for a
 * `'wheel-down'` one. `undefined` for every other lane kind, so callers can pass any lane through.
 */
export function wheelArrowPoints(kind: BeMusicLaneKind, cx: number, cy: number, size: number): number[] | undefined {
  if (kind !== 'wheel-up' && kind !== 'wheel-down') return undefined;
  const tip = kind === 'wheel-up' ? -size : size;
  return [cx, cy + tip, cx - size, cy - tip, cx + size, cy - tip];
}