Skip to content

Commit 6c3b503

Browse files
obiotclaude
andcommitted
Clean up TODO/FIXME/XXX comments across codebase
- Replace vague XXX comments with proper TODOs or issue references - Accept Vector3d type in vector3d/observableVector3d rotate methods - Remove stale TODOs for memoization (camera2d, color) and recursion (container) - Remove resolved TODO in draggable (z is correctly preserved) - Reference tickets for items needing future work: - #1180 (text offscreenCanvas) - #1277 (color memoization) - #1278 (createPattern texture leak) - #1279 (setAntiAlias texture filtering) - #1280 (texture cache overflow) - #1281 (atlas region refactor) - Add .claude to .gitignore Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 67dc9e3 commit 6c3b503

14 files changed

Lines changed: 18 additions & 38 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# IDE
22
.idea
33
*.sw*
4+
.claude
45

56
# OS
67
.DS_Store

‎packages/melonjs/src/camera/camera2d.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ export default class Camera2d extends Renderable {
587587
* @returns {Vector2d}
588588
*/
589589
localToWorld(x, y, v) {
590-
// TODO memoization for one set of coords (multitouch)
591590
v = v || vector2dPool.get();
592591
v.set(x, y).add(this.pos).sub(game.world.pos);
593592
if (!this.currentTransform.isIdentity()) {
@@ -604,7 +603,6 @@ export default class Camera2d extends Renderable {
604603
* @returns {Vector2d} a vector with the converted local coordinates
605604
*/
606605
worldToLocal(x, y, v) {
607-
// TODO memoization for one set of coords (multitouch)
608606
v = v || vector2dPool.get();
609607
v.set(x, y);
610608
if (!this.currentTransform.isIdentity()) {

‎packages/melonjs/src/level/tiled/TMXTileMap.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,8 @@ export default class TMXTileMap {
454454
settings.tint.parseHex(settings.tintcolor, true);
455455
}
456456

457-
/// XXX Clean/rewrite all this part to remove object
458-
/// specific instantiation logic/details from here
457+
// TODO: clean/rewrite this part to remove object-specific
458+
// instantiation logic from here (see getObjects refactoring plan)
459459

460460
// groups can contains either text, objects or layers
461461
if (settings instanceof TMXLayer) {

‎packages/melonjs/src/math/color.ts‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ export class Color {
561561
* @returns Reference to this object for method chaining
562562
*/
563563
parseRGB(rgbColor: string) {
564-
// TODO : Memoize this function by caching its input
565-
566564
const match = rgbaRx.exec(rgbColor);
567565
if (!match) {
568566
return this.parseHex(rgbColor as `#${string}`);
@@ -583,8 +581,6 @@ export class Color {
583581
* @returns Reference to this object for method chaining
584582
*/
585583
parseHex(hexColor: `#${string}`, argb = false) {
586-
// TODO : Memoize this function by caching its input
587-
588584
let match: RegExpExecArray | null;
589585
if ((match = hex8Rx.exec(hexColor))) {
590586
// #AARRGGBB or #RRGGBBAA
@@ -663,9 +659,6 @@ export class Color {
663659
* @returns The color in "#RRGGBB" format
664660
*/
665661
toHex() {
666-
// TODO : Memoize this function by caching its result until any of
667-
// the r,g,b,a values are changed
668-
669662
return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;
670663
}
671664

@@ -675,9 +668,6 @@ export class Color {
675668
* @returns The color in "#RRGGBBAA" format
676669
*/
677670
toHex8(alpha = this.alpha) {
678-
// TODO : Memoize this function by caching its result until any of
679-
// the r,g,b,a values are changed
680-
681671
return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}${toHex(alpha * 255)}`;
682672
}
683673

@@ -686,9 +676,6 @@ export class Color {
686676
* @returns The color in "rgb(R,G,B)" format
687677
*/
688678
toRGB() {
689-
// TODO : Memoize this function by caching its result until any of
690-
// the r,g,b,a values are changed
691-
692679
return `rgb(${this.r},${this.g},${this.b})` as const;
693680
}
694681

@@ -698,9 +685,6 @@ export class Color {
698685
* @returns The color in "rgba(R,G,B,A)" format
699686
*/
700687
toRGBA(alpha = this.alpha) {
701-
// TODO : Memoize this function by caching its result until any of
702-
// the r,g,b,a values are changed
703-
704688
return `rgba(${this.r},${this.g},${this.b},${alpha})` as const;
705689
}
706690
}

‎packages/melonjs/src/math/observableVector3d.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,10 @@ export class ObservableVector3d {
393393
/**
394394
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
395395
* @param angle - The angle to rotate (in radians)
396-
* @param [v] - an optional point to rotate around (on the same z axis)
396+
* @param [v] - an optional point to rotate around
397397
* @returns Reference to this object for method chaining
398398
*/
399-
rotate(angle: number, v?: Vector2d | Point) {
399+
rotate(angle: number, v?: Vector2d | Point | Vector3d) {
400400
let cx = 0;
401401
let cy = 0;
402402

@@ -405,7 +405,6 @@ export class ObservableVector3d {
405405
cy = v.y;
406406
}
407407

408-
// TODO also rotate on the z axis if the given vector is a 3d one
409408
const x = this.x - cx;
410409
const y = this.y - cy;
411410

‎packages/melonjs/src/math/vector3d.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ export class Vector3d {
308308
/**
309309
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
310310
* @param angle - The angle to rotate (in radians)
311-
* @param [v] - an optional point to rotate around (on the same z axis)
311+
* @param [v] - an optional point to rotate around
312312
* @returns Reference to this object for method chaining
313313
*/
314-
rotate(angle: number, v?: XYPoint) {
314+
rotate(angle: number, v?: XYPoint | Vector3d) {
315315
let cx = 0;
316316
let cy = 0;
317317

@@ -320,7 +320,6 @@ export class Vector3d {
320320
cy = v.y;
321321
}
322322

323-
// TODO also rotate on the z axis if the given vector is a 3d one
324323
const x = this.x - cx;
325324
const y = this.y - cy;
326325

‎packages/melonjs/src/renderable/container.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ export default class Container extends Renderable {
270270
// if the child is a container
271271
if (child instanceof Container) {
272272
// add all container child bodies
273-
// TODO: make it recursive ?
274273
child.forEach((cchild) => {
275274
if (cchild.body instanceof Body) {
276275
worldContainer.addBody(cchild.body);
@@ -342,7 +341,6 @@ export default class Container extends Renderable {
342341
// if the child is a container
343342
if (child instanceof Container) {
344343
// add all container child bodies
345-
// TODO: make it recursive ?
346344
child.forEach((cchild) => {
347345
if (cchild.body instanceof Body) {
348346
worldContainer.addBody(cchild.body);

‎packages/melonjs/src/renderable/draggable.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class Draggable extends Renderable {
8888
*/
8989
dragMove(e) {
9090
if (this.dragging === true) {
91-
this.pos.set(e.gameX, e.gameY, this.pos.z); //TODO : z ?
91+
this.pos.set(e.gameX, e.gameY, this.pos.z);
9292
this.pos.sub(this.grabOffset);
9393
}
9494
}

‎packages/melonjs/src/renderable/renderable.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ export default class Renderable extends Rect {
648648
if (typeof this._absPos === "undefined") {
649649
this._absPos = vector2dPool.get();
650650
}
651-
// XXX Cache me or something
651+
// TODO: cache the absolute position and invalidate when pos or ancestor changes
652652
this._absPos.set(this.pos.x, this.pos.y);
653653
if (
654654
typeof this.ancestor !== "undefined" &&

‎packages/melonjs/src/renderable/sprite.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export default class Sprite extends Renderable {
406406
const frameObjectName = frameObject.name;
407407
if (typeof frameObjectName === "number") {
408408
if (typeof this.textureAtlas[frameObjectName] !== "undefined") {
409-
// TODO: adding the cache source coordinates add undefined entries in webGL mode
409+
// see https://github.com/melonjs/melonJS/issues/1281
410410
this.anim[name].frames[i] = Object.assign(
411411
{},
412412
this.textureAtlas[frameObjectName],

0 commit comments

Comments
 (0)