show confirmation dialog when navigating away if painting exists
Hunter
Thursday, April 16th, 2026 at 3:16 PM
245 let painting = false;
246 let picking = false;
247 let lastPaintX = null, lastPaintY = null;
248 + let dirty = false;
249
250 function resize() {
251 const firstResize = cssW === 0;
270 }
271
272 function paintAt(cx, cy) {
273 + dirty = true;
274 const tl = brushTopLeft(cx, cy);
275 if (roundness === 0) {
276 paintRect(tl.x, tl.y, brush, brush, 'rgb(' + r + ',' + g + ',' + b + ')');
712 requestDraw();
713 }, { passive: false });
714
715 + window.addEventListener('beforeunload', (e) => {
716 + if (dirty) { e.preventDefault(); }
717 + });
718 +
719 window.addEventListener('contextmenu', (e) => e.preventDefault());
720
721 // block the OS pinch gesture events too (Safari)