Skip to content

Commit 9c242c5

Browse files
committed
update engine
1 parent 6e06d85 commit 9c242c5

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

public/litecanvas.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
var assert = (condition, message = "Assertion failed") => {
2828
if (!condition) throw new Error(message);
2929
};
30-
var version = "0.88.1";
30+
var version = "0.89.0";
3131
function litecanvas(settings = {}) {
3232
const root = window, math = Math, TWO_PI = math.PI * 2, raf = requestAnimationFrame, _browserEventListeners = [], on = (elem, evt, callback) => {
3333
elem.addEventListener(evt, callback, false);
@@ -1068,12 +1068,16 @@
10681068
*/
10691069
(id, x, y) => {
10701070
const tap = {
1071+
// current x
10711072
x,
1073+
// current y
10721074
y,
1073-
startX: x,
1074-
startY: y,
1075+
// initial x
1076+
xi: x,
1077+
// initial y
1078+
yi: y,
10751079
// timestamp
1076-
ts: performance.now()
1080+
t: performance.now()
10771081
};
10781082
_taps.set(id, tap);
10791083
return tap;
@@ -1091,10 +1095,15 @@
10911095
}
10921096
), _checkTapped = (
10931097
/**
1094-
* @param {{ts: number}} tap
1098+
* @param {{t: number}} tap
10951099
*/
1096-
(tap) => tap && performance.now() - tap.ts <= 300
1097-
), preventDefault = (ev) => ev.preventDefault();
1100+
(tap) => tap && performance.now() - tap.t <= 300
1101+
), preventDefault = (
1102+
/**
1103+
* @param {Event} ev
1104+
*/
1105+
(ev) => ev.preventDefault()
1106+
);
10981107
let _pressingMouse = false;
10991108
on(
11001109
_canvas,
@@ -1124,7 +1133,7 @@
11241133
const tap = _taps.get(0);
11251134
const [x, y] = _getXY(ev.pageX, ev.pageY);
11261135
if (_checkTapped(tap)) {
1127-
instance.emit("tapped", tap.startX, tap.startY, 0);
1136+
instance.emit("tapped", tap.xi, tap.yi, 0);
11281137
}
11291138
instance.emit("untap", x, y, 0);
11301139
_taps.delete(0);
@@ -1191,7 +1200,7 @@
11911200
for (const [id, tap] of _taps) {
11921201
if (existing.includes(id)) continue;
11931202
if (_checkTapped(tap)) {
1194-
instance.emit("tapped", tap.startX, tap.startY, id);
1203+
instance.emit("tapped", tap.xi, tap.yi, id);
11951204
}
11961205
instance.emit("untap", tap.x, tap.y, id);
11971206
_taps.delete(id);
@@ -1312,6 +1321,7 @@
13121321
if (!_canvas.parentNode) {
13131322
document.body.appendChild(_canvas);
13141323
}
1324+
_canvas.oncontextmenu = () => false;
13151325
}
13161326
function resizeCanvas() {
13171327
DEV: assert(

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

44
const precacheResources = [
55
"/",

0 commit comments

Comments
 (0)