Skip to content

Commit 90558e0

Browse files
committed
update plugin Migrate
1 parent 2027170 commit 90558e0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

public/litecanvas.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@
19951995
var wt = 2 * Math.PI;
19961996
var oe = Math.PI / 2;
19971997
var Z = { warnings: true };
1998-
function g(a, c = {}) {
1998+
function v(a, c = {}) {
19991999
if (c = Object.assign({}, Z, c), a.stat(1)) throw 'Plugin Migrate should be loaded before the "init" event';
20002000
let l = a.stat(0);
20012001
function s(t, e, r = "") {
@@ -2009,11 +2009,11 @@
20092009
s("textstyle()", "the 5th param of text()"), f = t;
20102010
}
20112011
let w = a.text;
2012-
function v(t, e, r, i = 3, p = f) {
2012+
function g(t, e, r, i = 3, p = f) {
20132013
w(t, e, r, i, p);
20142014
}
20152015
function E(t, e, r, i) {
2016-
s("print()", "text()"), v(t, e, r, i);
2016+
s("print()", "text()"), g(t, e, r, i);
20172017
}
20182018
function M(t, e) {
20192019
s("textmetrics()", "ctx().measureText()");
@@ -2103,9 +2103,11 @@
21032103
s("resize()", null, "Avoid changing the canvas dimensions at runtime."), a.CANVAS.width = t, u("W", t), u("CX", t / 2), a.CANVAS.height = e, u("H", e), u("CY", e / 2), a.emit("resized", 1);
21042104
}
21052105
for (let t of ["W", "H", "T", "CX", "CY", "MX", "MY"]) a[t] != null && u(t, a[t]);
2106-
if (s("FPS", "", "but you can use our plugin to measure the fps: https://github.com/litecanvas/plugin-frame-rate-meter"), n("FPS", ""), l.fps && a.framerate(l.fps), l.background >= 0) {
2107-
let t = stat(5);
2108-
a.CANVAS.style.backgroundColor = t[~~l.background % t.length];
2106+
if (s("FPS", "", "but you can use our plugin to measure the fps: https://github.com/litecanvas/plugin-frame-rate-meter"), n("FPS", ""), l.fps && a.framerate(l.fps), l.background != null) {
2107+
let t = a.listen("before:draw", () => {
2108+
let e = stat(5);
2109+
a.canvas().style.background = e[~~l.background % e.length], t();
2110+
});
21092111
}
21102112
function O(t) {
21112113
return s("path()", "`new Path2D`", "See https://developer.mozilla.org/en-US/docs/Web/API/Path2D"), new Path2D(t);
@@ -2130,9 +2132,9 @@
21302132
function B(t) {
21312133
s("clip(path)", "clip(callback)", "E.g: `clip((ctx) => ctx.rect(0, 0, 200, 200))`"), t instanceof Path2D ? a.ctx().clip(t) : W(t);
21322134
}
2133-
return l.antialias && s('"antialias" option', '"pixelart" option'), { def: u, seed: h, print: E, clear: R, setfps: k, setvar: L, textstyle: b, textmetrics: M, text: v, cliprect: I, clipcirc: A, blendmode: P, transform: C, getcolor: T, mousepos: S, resize: N, path: O, fill: F, stroke: H, clip: B, colrect: _, colcirc: x };
2135+
return l.antialias && s('"antialias" option', '"pixelart" option'), { def: u, seed: h, print: E, clear: R, setfps: k, setvar: L, textstyle: b, textmetrics: M, text: g, cliprect: I, clipcirc: A, blendmode: P, transform: C, getcolor: T, mousepos: S, resize: N, path: O, fill: F, stroke: H, clip: B, colrect: _, colcirc: x };
21342136
}
2135-
window.pluginMigrate = g;
2137+
window.pluginMigrate = v;
21362138
})();
21372139
(() => {
21382140
function _() {

public/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const cacheName = "luizbills.litecanvas-editor-v1";
2-
const version = "2025.7.21.1";
2+
const version = "2025.7.21.2";
33

44
const precacheResources = [
55
"/",

0 commit comments

Comments
 (0)