feat(framework): core 座位↔视图转换

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 14:21:46 +08:00
co-authored by Claude Opus 4.8
parent bfd9339f64
commit c1be4dcb1e
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,9 @@
/** 绝对座位 → 以 mySeat 为视角的视图位(自己=0,其余环形顺延)。 */
export function toView(mySeat: number, targetSeat: number, seatCount: number): number {
return ((targetSeat - mySeat) % seatCount + seatCount) % seatCount;
}
/** 视图位 → 绝对座位(toView 的逆运算)。 */
export function fromView(mySeat: number, viewSeat: number, seatCount: number): number {
return ((viewSeat + mySeat) % seatCount + seatCount) % seatCount;
}