Skip to content

Commit 7a49d94

Browse files
committed
update fps meter
1 parent d1d08f7 commit 7a49d94

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

public/litecanvas.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,21 +1970,21 @@
19701970
window.pluginMigrate = p;
19711971
})();
19721972
(() => {
1973-
function A() {
1974-
let o = 0, a = true, i = document.createElement("div"), r = [], p = () => (performance || Date).now();
1973+
function _() {
1974+
let u = 0, a = true, i = document.createElement("div"), r = [], p = () => (performance || Date).now();
19751975
i.style.cssText = "position:absolute;top:0;right:0;cursor:pointer;opacity:0.8;z-index:10000", i.addEventListener("click", function(e) {
1976-
e.preventDefault(), l(++o % i.children.length);
1976+
e.preventDefault(), o(++u % i.children.length);
19771977
}, false);
1978-
function u(e, n, _, t) {
1979-
let w = new P(e, n, _, i, t);
1978+
function l(e, n, v, t) {
1979+
let w = new P(e, n, v, i, t);
19801980
return r.push(w), w;
19811981
}
1982-
function l(e) {
1982+
function o(e) {
19831983
for (let n = 0; n < i.children.length; n++) i.children[n].style.display = n === e ? "block" : "none";
1984-
o = e;
1984+
u = e;
19851985
}
19861986
function f() {
1987-
o++, o >= i.children.length && (o = 0), l(o);
1987+
u++, u >= i.children.length && (u = 0), o(u);
19881988
}
19891989
function s(e = "all") {
19901990
if (e === "all") for (let n = 0; n < r.length; n++) r[n].reset();
@@ -1994,8 +1994,8 @@
19941994
function g(e = true) {
19951995
a = !!e, i.style.display = a ? "" : "none";
19961996
}
1997-
let b = p(), h = b, y2 = 0, c = u("FPS", "#0ff", "#002"), d = u("MS", "#0f0", "#020"), m;
1998-
return self.performance && self.performance.memory && (m = u("MB", "#f08", "#201")), l(0), { dom: i, addPanel: u, showPanel: l, nextPanel: f, resetPanel: s, display: g, get hidden() {
1997+
let b = p(), h = b, y2 = 0, c = l("FPS", "#0ff", "#002"), d = l("MS", "#0f0", "#020"), m;
1998+
return self.performance && self.performance.memory && (m = l("MB", "#f08", "#201")), o(0), { dom: i, addPanel: l, showPanel: o, nextPanel: f, resetPanel: s, display: g, get hidden() {
19991999
return !a;
20002000
}, begin: function() {
20012001
b = p();
@@ -2011,39 +2011,39 @@
20112011
b = this.end();
20122012
} };
20132013
}
2014-
function P(o, a, i, r, p = {}) {
2015-
let u = Math.round, l = 1 / 0, f = 0, s = u(window.devicePixelRatio || 1), g = (p.width || 80) * s, b = 48 * s, h = 3 * s, y2 = 2 * s, c = 3 * s, d = 15 * s, m = (g - 6) * s, e = 30 * s, n = document.createElement("canvas");
2014+
function P(u, a, i, r, p = {}) {
2015+
let l = Math.round, o = 1 / 0, f = 0, s = l(window.devicePixelRatio || 1), g = (p.width || 80) * s, b = 48 * s, h = 3 * s, y2 = 2 * s, c = 3 * s, d = 15 * s, m = (g - 6) * s, e = 30 * s, n = document.createElement("canvas");
20162016
n.width = g, n.height = b;
2017-
let _ = r.children.length;
2017+
let v = r.children.length;
20182018
r.appendChild(n);
20192019
let t = n.getContext("2d");
20202020
t.font = "bold " + 9 * s + "px Helvetica,Arial,sans-serif", t.textBaseline = "top";
20212021
function w() {
2022-
t.fillStyle = i, t.fillRect(0, 0, g, b), t.fillStyle = a, t.fillText(o, h, y2), t.fillRect(c, d, m, e), t.fillStyle = i, t.globalAlpha = 0.9, t.fillRect(c, d, m, e);
2022+
t.fillStyle = i, t.fillRect(0, 0, g, b), t.fillStyle = a, t.fillText(u, h, y2), t.fillRect(c, d, m, e), t.fillStyle = i, t.globalAlpha = 0.9, t.fillRect(c, d, m, e);
20232023
}
2024-
return w(), { id: _, dom: n, reset: w, update: function(x2, E) {
2025-
l = Math.min(l, x2), f = Math.max(f, x2), t.fillStyle = i, t.globalAlpha = 1, t.fillRect(0, 0, g, d), t.fillStyle = a;
2026-
let T = [u(x2), o];
2027-
p.labelBefore && T.reverse(), t.fillText(T.join(" ") + " (" + u(l) + "-" + u(f) + ")", h, y2), t.drawImage(n, c + s, d, m - s, e, c, d, m - s, e), t.fillRect(c + m - s, d, s, e), t.fillStyle = i, t.globalAlpha = 0.9, t.fillRect(c + m - s, d, s, u((1 - x2 / E) * e));
2024+
return w(), { id: v, dom: n, reset: w, update: function(x2, E) {
2025+
o = Math.min(o, x2), f = Math.max(f, x2), t.fillStyle = i, t.globalAlpha = 1, t.fillRect(0, 0, g, d), t.fillStyle = a;
2026+
let T = [l(x2), u];
2027+
p.labelBefore && T.reverse(), t.fillText(T.join(" ") + " (" + l(o) + "-" + l(f) + ")", h, y2), t.drawImage(n, c + s, d, m - s, e, c, d, m - s, e), t.fillRect(c + m - s, d, s, e), t.fillStyle = i, t.globalAlpha = 0.9, t.fillRect(c + m - s, d, s, l((1 - x2 / E) * e));
20282028
} };
20292029
}
20302030
var S = { hotkeyShow: "F1", hotkeyNext: "F2", css: {}, hidden: false, id: "" };
2031-
function v(o, a = {}) {
2031+
function A(u, a = {}) {
20322032
a = Object.assign({}, S, a);
2033-
let i = o.stat(0), r = new A(), p = r.display, u = (l = true) => {
2034-
console.log("display", l), a.hidden = !l, p(l), r.resetPanel();
2033+
let i = u.stat(0), r = new _(), p = r.display, l = (o = true) => {
2034+
a.hidden = !o, p(o), r.resetPanel();
20352035
};
20362036
a.id && (r.dom.id = a.id);
2037-
for (let [l, f] of Object.entries(a.css || {})) r.dom.style[l] = f;
2038-
return o.CANVAS.parentElement.appendChild(r.dom), u(!a.hidden), i.keyboardEvents && listen("update", () => {
2039-
a.hotkeyShow && o.iskeypressed(a.hotkeyShow) && u(a.hidden), a.hotkeyNext && o.iskeypressed(a.hotkeyNext) && r.nextPanel();
2040-
}), listen("before:update", (l, f = 1) => {
2037+
for (let [o, f] of Object.entries(a.css || {})) r.dom.style[o] = f;
2038+
return u.CANVAS.parentElement.appendChild(r.dom), l(!a.hidden), i.keyboardEvents && listen("update", () => {
2039+
a.hotkeyShow && u.iskeypressed(a.hotkeyShow) && l(a.hidden), a.hotkeyNext && u.iskeypressed(a.hotkeyNext) && r.nextPanel();
2040+
}), listen("before:update", (o, f = 1) => {
20412041
a.hidden || f === 1 && r.begin();
20422042
}), listen("after:draw", () => {
20432043
a.hidden || r.end();
2044-
}), r.display = u, { FPS_METER: r };
2044+
}), r.display = l, { FPS_METER: r };
20452045
}
2046-
window.pluginFrameRateMeter = v;
2046+
window.pluginFrameRateMeter = A;
20472047
})();
20482048
})();
20492049
/*! @litecanvas/utils by Luiz Bills | MIT Licensed */

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.06.13.1";
2+
const version = "2025.06.15.0";
33

44
const precacheResources = [
55
"/",

0 commit comments

Comments
 (0)