diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-13 20:49:56 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-13 20:49:56 +0100 |
| commit | 896163d7961d86b4e023a50ce4f6e19a30006a3f (patch) | |
| tree | 9a2266a1120f8913616991d9350fa6667c248f0e /static/modules/k1c.js | |
| parent | 69e6ce2bf7272797cf08ee4fbe0ff9fe0fc3b1f4 (diff) | |
| download | deck-it-896163d7961d86b4e023a50ce4f6e19a30006a3f.tar.gz deck-it-896163d7961d86b4e023a50ce4f6e19a30006a3f.zip | |
feat(vm): tablet tiles with screen, trends and a power button
Each VM is a tile: its screen from virsh screenshot (JPEG through
ffmpeg, every 5s while the tab shows), booting until sshd answers at
the ssh -G host and port, CPU and RAM trends, and a big power button,
tap for the gentle action and hold to force off. A tap on the tile
opens a sheet with every action as an icon and the snapshots as a
timeline with their age. hold.js is now the one press and hold, K1C's
stop included, and vibrates the tablet when it fires; the Windows
long-press buzzes too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/modules/k1c.js')
| -rw-r--r-- | static/modules/k1c.js | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/static/modules/k1c.js b/static/modules/k1c.js index 261ef4d..6b41a01 100644 --- a/static/modules/k1c.js +++ b/static/modules/k1c.js @@ -15,10 +15,11 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import { offline } from "../offline.js"; +import { hold } from "../hold.js"; -// Holding the stop for this long fires it: fast in an emergency, but a +// Holding the stop (hold.js's 800 ms) fires it: fast in an emergency, but a // stray touch on an always-on tablet cannot kill a print. -const HOLD_MS = 800; +const armHold = (btn) => hold(btn, () => emergencyStop(btn)); const STATES = { printing: ["Printing", "good"], @@ -64,28 +65,6 @@ async function emergencyStop(btn) { }, 4000); } -// Press and hold: the ring fills over HOLD_MS, releasing early cancels. -function armHold(btn) { - let timer = null; - const cancel = () => { - clearTimeout(timer); - timer = null; - btn.classList.remove("holding"); - }; - btn.addEventListener("pointerdown", (e) => { - e.preventDefault(); - btn.setPointerCapture(e.pointerId); - btn.classList.add("holding"); - timer = setTimeout(() => { - cancel(); - emergencyStop(btn); - }, HOLD_MS); - }); - btn.addEventListener("pointerup", cancel); - btn.addEventListener("pointercancel", cancel); - btn.style.setProperty("--hold", `${HOLD_MS}ms`); -} - // The dashboard's running slot: file, percent, time left, layer and // temperatures, the press-and-hold stop and a progress bar. Wide slots show // the slicer thumbnail in place of the icon (deck.css container query). |
