feat(framework): core 座位↔视图转换
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user