Skip to content

Commit 5f0f9a2

Browse files
committed
update engine
1 parent d1629c5 commit 5f0f9a2

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

public/about.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -464,22 +464,21 @@ <h2><a id="drawing">Functions for Drawing</a></h2>
464464
// draw a image
465465
image(x, y, image: Image|HTMLCanvasElement): void
466466

467-
// create a offcanvas and to make an image on it
467+
// create an OffscreenCanvas and draw on it to make an image
468468
// data can be a array of strings (to draw pixel art)
469469
// see: https://github.com/litecanvas/game-engine/blob/main/samples/pixelart/pixelart.js
470470
// or data can be a function with drawing operations
471471
// see: https://github.com/litecanvas/game-engine/blob/main/samples/paint/paint.js
472472
// the options are:
473473
// * scale?: default = 1.
474-
// * canvas?: by default creates a new canvas.
474+
// * canvas?: by default creates a new offscreen canvas.
475475
paint(width, height, data: string[]|function, options?): OffscreenCanvas
476476

477477
/**
478478
* ADVANCED DRAWING-RELATED FUNCTIONS
479479
*/
480480

481-
// Set or get the current canvas context 2D
482-
// see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
481+
// get the current canvas context 2D or set a newly
483482
ctx(context?: CanvasRenderingContext2D): CanvasRenderingContext2D
484483

485484
// save the canvas state

public/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/litecanvas.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@
580580
_ctx.drawImage(source, ~~x, ~~y);
581581
},
582582
/**
583-
* Creates a offscreen canvas to draw on it
583+
* Draw in an OffscreenCanvas and returns its image.
584584
*
585585
* @param {number} width
586586
* @param {number} height
587587
* @param {string[]|drawCallback} drawing
588588
* @param {object} [options]
589589
* @param {number} [options.scale=1]
590590
* @param {OffscreenCanvas | HTMLCanvasElement} [options.canvas]
591-
* @returns {OffscreenCanvas}
591+
* @returns {ImageBitmap}
592592
* @see https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
593593
*/
594594
paint(width, height, drawing, options = {}) {
@@ -624,7 +624,7 @@
624624
drawing(_ctx);
625625
}
626626
_ctx = contextOriginal;
627-
return canvas;
627+
return canvas.transferToImageBitmap();
628628
},
629629
/** ADVANCED GRAPHICS API */
630630
/**

public/sw.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const cacheName = "luizbills.litecanvas-editor-v1";
2-
const version = "2.79.2";
2+
const version = "2.79.3";
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

src/completions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export default function customCompletions(context) {
133133
type: "function",
134134
apply: "paint(",
135135
detail: "(width, height, callback|array, options)",
136-
info: "Creates a offscreen canvas to draw on it",
136+
info: "Creates an image in offscreencanvas",
137137
},
138138
{
139139
label: "translate",

0 commit comments

Comments
 (0)