Skip to content

Commit 2cacdc4

Browse files
obiotclaude
andcommitted
Fix no-this-alias lint error: use gradient ID instead of this reference
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cce31e0 commit 2cacdc4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/melonjs/src/video/gradient.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import CanvasRenderTarget from "./rendertarget/canvasrendertarget.js";
1111
* @ignore
1212
*/
1313
let sharedRenderTarget = null;
14-
let sharedLastGradient = null;
14+
let sharedLastId = -1;
1515
let sharedLastX = NaN;
1616
let sharedLastY = NaN;
17+
let nextGradientId = 0;
1718

1819
/**
1920
* A Gradient object representing a linear or radial gradient fill.
@@ -30,6 +31,9 @@ export class Gradient {
3031
* gradient type
3132
* @type {"linear"|"radial"}
3233
*/
34+
/** @ignore */
35+
this._id = nextGradientId++;
36+
3337
this.type = type;
3438

3539
/**
@@ -150,7 +154,7 @@ export class Gradient {
150154
// skip if this gradient already rendered to the shared target at these coords
151155
if (
152156
sharedRenderTarget &&
153-
sharedLastGradient === this &&
157+
sharedLastId === this._id &&
154158
!this._dirty &&
155159
sharedLastX === x &&
156160
sharedLastY === y &&
@@ -206,7 +210,7 @@ export class Gradient {
206210
ctx.fillRect(0, 0, tw, th);
207211

208212
this._dirty = false;
209-
sharedLastGradient = this;
213+
sharedLastId = this._id;
210214
sharedLastX = x;
211215
sharedLastY = y;
212216
this._renderTarget.invalidate(renderer);

0 commit comments

Comments
 (0)