|
1995 | 1995 | var wt = 2 * Math.PI;
|
1996 | 1996 | var oe = Math.PI / 2;
|
1997 | 1997 | var Z = { warnings: true };
|
1998 |
| - function g(a, c = {}) { |
| 1998 | + function v(a, c = {}) { |
1999 | 1999 | if (c = Object.assign({}, Z, c), a.stat(1)) throw 'Plugin Migrate should be loaded before the "init" event';
|
2000 | 2000 | let l = a.stat(0);
|
2001 | 2001 | function s(t, e, r = "") {
|
|
2009 | 2009 | s("textstyle()", "the 5th param of text()"), f = t;
|
2010 | 2010 | }
|
2011 | 2011 | let w = a.text;
|
2012 |
| - function v(t, e, r, i = 3, p = f) { |
| 2012 | + function g(t, e, r, i = 3, p = f) { |
2013 | 2013 | w(t, e, r, i, p);
|
2014 | 2014 | }
|
2015 | 2015 | function E(t, e, r, i) {
|
2016 |
| - s("print()", "text()"), v(t, e, r, i); |
| 2016 | + s("print()", "text()"), g(t, e, r, i); |
2017 | 2017 | }
|
2018 | 2018 | function M(t, e) {
|
2019 | 2019 | s("textmetrics()", "ctx().measureText()");
|
|
2103 | 2103 | 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);
|
2104 | 2104 | }
|
2105 | 2105 | 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 | + }); |
2109 | 2111 | }
|
2110 | 2112 | function O(t) {
|
2111 | 2113 | return s("path()", "`new Path2D`", "See https://developer.mozilla.org/en-US/docs/Web/API/Path2D"), new Path2D(t);
|
|
2130 | 2132 | function B(t) {
|
2131 | 2133 | s("clip(path)", "clip(callback)", "E.g: `clip((ctx) => ctx.rect(0, 0, 200, 200))`"), t instanceof Path2D ? a.ctx().clip(t) : W(t);
|
2132 | 2134 | }
|
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 }; |
2134 | 2136 | }
|
2135 |
| - window.pluginMigrate = g; |
| 2137 | + window.pluginMigrate = v; |
2136 | 2138 | })();
|
2137 | 2139 | (() => {
|
2138 | 2140 | function _() {
|
|
0 commit comments