Skip to content

Commit 4c46dc7

Browse files
committed
update engine
1 parent 37476a6 commit 4c46dc7

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

public/app.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/litecanvas.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,22 +307,27 @@
307307
},
308308
/** BASIC GRAPHICS API */
309309
/**
310-
* Clear the game screen
310+
* Clear the game screen with an optional color
311311
*
312312
* @param {number?} color The background color (index) or null (for transparent)
313313
*/
314314
cls(color) {
315315
if (true) {
316316
assert(
317317
null == color || isFinite(color) && color >= 0,
318-
"cls: 1st param must be a number"
318+
"cls: 1st param must be a positive number or zero or null"
319319
);
320320
}
321-
let width = _ctx.canvas.width, height = _ctx.canvas.height;
322321
if (null == color) {
323-
_ctx.clearRect(0, 0, width, height);
322+
_ctx.clearRect(0, 0, _ctx.canvas.width, _ctx.canvas.height);
324323
} else {
325-
instance.rectfill(0, 0, width, height, color);
324+
instance.rectfill(
325+
0,
326+
0,
327+
_ctx.canvas.width,
328+
_ctx.canvas.height,
329+
color
330+
);
326331
}
327332
},
328333
/**
@@ -667,8 +672,8 @@
667672
/**
668673
* Get or set the canvas context 2D
669674
*
670-
* @param {CanvasRenderingContext2D} [context]
671-
* @returns {CanvasRenderingContext2D}
675+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
676+
* @returns {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}
672677
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
673678
*/
674679
ctx(context) {
@@ -852,7 +857,7 @@
852857
return false;
853858
}
854859
zzfxParams = zzfxParams || instance.DEFAULT_SFX;
855-
if (pitchSlide > 0 || volumeFactor !== 1) {
860+
if (pitchSlide !== 0 || volumeFactor !== 1) {
856861
zzfxParams = zzfxParams.slice();
857862
zzfxParams[0] = volumeFactor * (zzfxParams[0] || 1);
858863
zzfxParams[10] = ~~zzfxParams[10] + pitchSlide;
@@ -919,7 +924,7 @@
919924
assert(isFinite(y2), "colcirc: 5th param must be a number");
920925
assert(isFinite(r2), "colcirc: 6th param must be a number");
921926
}
922-
return (x2 - x1) ** 2 + (y2 - y1) ** 2 <= (r1 + r2) ** 2;
927+
return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) <= (r1 + r2) * (r1 + r2);
923928
},
924929
/** PLUGINS API */
925930
/**

public/sw.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const cacheName = "luizbills.litecanvas-editor-v1";
2-
const version = "2.67.2";
2+
const version = "2.68.0";
33

44
const precacheResources = [
55
"/",
@@ -29,7 +29,7 @@ const precacheResources = [
2929

3030
self.addEventListener("install", (event) => {
3131
event.waitUntil(
32-
caches.open(cacheName).then((cache) => cache.addAll(precacheResources))
32+
caches.open(cacheName).then((cache) => cache.addAll(precacheResources)),
3333
);
3434
});
3535

@@ -42,7 +42,7 @@ self.addEventListener("fetch", (event) => {
4242
return cachedResponse;
4343
}
4444
return fetch(event.request);
45-
})
45+
}),
4646
);
4747
});
4848

0 commit comments

Comments
 (0)