Skip to content

Commit bdeb9bd

Browse files
author
DavidQ
committed
Correct alias collision
1 parent 486c8df commit bdeb9bd

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

games/Asteroids/utils/math.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@ David Quesenberry
44
03/22/2026
55
math.js
66
*/
7-
import { wrap as sharedWrap } from '../../../src/shared/utils/mathUtils.js';
8-
97
export { randomRange } from '../../../src/shared/utils/mathUtils.js';
108

119
export const TAU = Math.PI * 2;
1210

1311
export function wrap(value, max) {
14-
return sharedWrap(value, 0, max);
12+
const low = Math.min(0, max);
13+
const high = Math.max(0, max);
14+
const span = high - low;
15+
if (span === 0) {
16+
return low;
17+
}
18+
19+
if (value >= low && value <= high) {
20+
return value;
21+
}
22+
23+
return ((((value - low) % span) + span) % span) + low;
1524
}

tools/dev/intentionalAliasLedger.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,6 @@
117117
"import { CANONICAL_WORLD_TO_SCREEN_SCALE, combineObjectVectorBounds, inverseTransformObjectVectorShapePoint, normalizeObjectVectorOrigin, normalizeRotationDegrees as normalizeSharedRotationDegrees, objectVectorBoundsCornerPoints, objectVectorSvgTransformAttribute, rotatePointAround as rotateSharedPointAround, transformedObjectVectorShapeBounds, transformObjectVectorShapePoint, ObjectVectorRuntimeAssetService } from \"../../../src/engine/rendering/index.js\";"
118118
],
119119
"reason": "Object Vector Studio V2 keeps local method names for editor actions while delegating to shared transform helpers."
120-
},
121-
{
122-
"id": "asteroids-wrap-adapter",
123-
"files": [
124-
"games/Asteroids/utils/math.js"
125-
],
126-
"statements": [
127-
"import { wrap as sharedWrap } from '../../../src/shared/utils/mathUtils.js';"
128-
],
129-
"reason": "Asteroids preserves its local wrap(value, max) gameplay API while delegating to the shared wrap(value, min, max) helper."
130120
}
131121
]
132122
}

0 commit comments

Comments
 (0)