commit e043445816c7a7da34ee07bf861fa85c538a4ed6
parent 16df5991b214b07a9b4997becdbe212929f88f9a
Author: Hunter
Date:   Thu, 16 Jul 2026 16:21:29 -0400

improve browser/OS compatibility

Diffstat:
Mindex.html | 17+++++++++++++----
Mreadme.md | 12++++++------
2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/index.html b/index.html @@ -899,15 +899,24 @@ const k = e.key.toLowerCase(); const wasDown = keys[k]; keys[k] = true; - if (e.key === 'Meta') { metaSeq = ++seqCounter; startDragMode('roundness'); } - else if (e.key === 'Shift') { shiftSeq = ++seqCounter; startDragMode('brush'); } + // keep Firefox from focusing the menu bar on a bare Alt tap + if (e.key === 'Alt') e.preventDefault(); + // z/x are drag modifiers; block browser undo/cut when cmd is also held + if (k === 'z' || k === 'x') e.preventDefault(); + if (e.key === 'Meta' || k === 'x') { metaSeq = ++seqCounter; startDragMode('roundness'); } + else if (e.key === 'Shift' || k === 'z') { shiftSeq = ++seqCounter; startDragMode('brush'); } else if (!wasDown && (k === 'r' || k === 'g' || k === 'b')) startDragMode('color'); }); window.addEventListener('keyup', (e) => { const k = e.key.toLowerCase(); keys[k] = false; - if (e.key === 'Meta') { metaSeq = 0; endDragMode('roundness'); } - else if (e.key === 'Shift') { shiftSeq = 0; endDragMode('brush'); } + if (e.key === 'Alt') e.preventDefault(); + if (e.key === 'Meta' || k === 'x') { + if (!keys['meta'] && !keys['x']) { metaSeq = 0; endDragMode('roundness'); } + } + else if (e.key === 'Shift' || k === 'z') { + if (!keys['shift'] && !keys['z']) { shiftSeq = 0; endDragMode('brush'); } + } else if (k === 'r' || k === 'g' || k === 'b') { if (!keys['r'] && !keys['g'] && !keys['b']) endDragMode('color'); else { diff --git a/readme.md b/readme.md @@ -20,10 +20,10 @@ an infinite canvas for radical digital painting. ### mark-making - click and drag to make marks -- hold `shift` and move your cursor up/down to resize the brush -- hold `⌘` and move your cursor up/down to change the shape of the brush +- hold `shift` (or `Z`) and move your cursor up/down to resize the brush +- hold `⌘` (or `X`) and move your cursor up/down to change the shape of the brush - hold any of the ![R](readme_images/R.svg), ![G](readme_images/G.svg), and/or ![B](readme_images/B.svg) keys and move your cursor up/down to change the ![Redness](readme_images/Redness.svg), ![Greenness](readme_images/Greenness.svg), and/or ![Blueness](readme_images/Blueness.svg) of the active color -- hold `option` and click anywhere to pick up the color underneath your brush +- hold `option` (or `alt`) and click anywhere to pick up the color underneath your brush - pinch with two fingers to zoom in/out - drag with two fingers to pan around the canvas @@ -38,5 +38,5 @@ an infinite canvas for radical digital painting. - you can continue painting while the canvas animates ### importing / exporting -- hold `⌘` and press `S` to save your painting as a .GIF file -- hold `⌘` and press `O` to open an existing painting from your filesystem (will clear the current canvas) -\ No newline at end of file +- hold `⌘` (or `ctrl`) and press `S` to save your painting as a .GIF file +- hold `⌘` (or `ctrl`) and press `O` to open an existing painting from your filesystem (will clear the current canvas) +\ No newline at end of file