diff --git a/CHANGELOG.md b/CHANGELOG.md index a4460c7..bfafb97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- **Laser pointer** (v52, PDF app and HTML overlay). Tap the pen or highlighter color you already have selected, and its ring turns black, red, black. What you draw now stays for two seconds after you lift the pen, then fades away by itself. It is never saved, printed or added to Undo. Tap the color again, or pick another color or tool, to go back to writing. Your palm still erases. - **Blue toolbar and pink eraser** (v51, PDF app and HTML overlay). The toolbar, its menus, Settings, the Timer and the Chapters / Find panel are now dark navy with light sky-blue buttons and black text, instead of black and yellow, to match the boat icon. The Eraser button is eraser pink. A selected tool has a white ring. Pen, highlighter and cover colors are unchanged. - **New boat icon** (v48). The PDF app, the demo page and the "Board not working?" page now use the OverBoard sailboat icon in the browser tab, on the home screen and when installed. The PDF app's start screen shows it next to the OverBoard PDF title. The sail is a little smaller and sits a little higher than in the first version of the icon. - **"Save notebook…" for blank notebooks** (v46, PDF app). In a notebook started from the start screen, the button that reads **Save ink into PDF…** for other PDFs now reads **Save notebook…**, and its window explains that the notebook is only kept in this browser until you save it as a real file. The file keeps the notebook's own name (no `_board`). Reopened in OverBoard, it's still a notebook: your writing comes back and you can keep adding pages. Once saving is on, the button shows **Saving into PDF ✓** as before. diff --git a/README.md b/README.md index 61018a6..3415264 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ The ink tool that ships with a lot of classroom smartboards draws on a see-throu - **Highlighter** that sits behind the printed text, so words stay readable - **Cover**: tap the **▾** beside Highlighter and pick a cover to black out answers; wipe it away with your palm to reveal them. The same menu sets **highlight strength** (10–100%) - **Select**: circle ink with the pen (or tap one mark), then **send a copy to another class period**, copy and paste it onto another page, drag it somewhere else, or delete it. A dashed blue box shows what's selected, with its menu beside it (a right-click on the box opens it too) +- **Laser pointer**: tap the pen or highlighter color you already have selected (its ring turns black, red, black) and what you draw fades away by itself a few seconds later. Tap it again to go back to writing - **Undo and Redo** (↶ ↷ on the toolbar, or Ctrl/⌘+Z and Ctrl/⌘+Y, Ctrl/⌘+R or Ctrl/⌘+Shift+Z). Reloading from the keyboard is turned off, so a slip can't throw away the page - **8 colors + a custom color picker**, pen size and smoothing controls (hold − / + to repeat) - **Separate ink for each class period** on the same worksheet: P1–P4 to start, or set your own in **Settings & help ▸ Settings…** (1–12 periods, any names) diff --git a/app/index.html b/app/index.html index 64ec8cf..c6f06b1 100644 --- a/app/index.html +++ b/app/index.html @@ -5,7 +5,7 @@ OverBoard PDF - + @@ -47,7 +47,7 @@

Open again

Your PDF and your ink stay in this browser on this computer. Nothing is uploaded. Have a Word file? In Word, choose File → Save as PDF, then drop the PDF here. Have an HTML worksheet? Drop it here to get a _board.html copy you can write on. -
About OverBoard · Board not working? · v51

+
About OverBoard · Board not working? · v52

diff --git a/app/ink.js b/app/ink.js index 5ee2ef6..5f8dca6 100644 --- a/app/ink.js +++ b/app/ink.js @@ -4,7 +4,7 @@ // so zooming never moves ink. o: 1 marks a cover (an opaque highlighter stroke): it is drawn on the pen // layer, above the page and its text, instead of multiplied underneath. -import { textAt, selectTo, clearTextSel, copyTextSel, seeThrough, isNote, notesGone, pointerKind, paintStroke, liveStart, liveAdd, livePieces, liveEndPieces, paintPieces, liveLift } from '../shared/ink-core.js'; +import { makeLaser, textAt, selectTo, clearTextSel, copyTextSel, seeThrough, isNote, notesGone, pointerKind, paintStroke, liveStart, liveAdd, livePieces, liveEndPieces, paintPieces, liveLift } from '../shared/ink-core.js'; import { GUTTER } from './viewer.js'; export const PT_PER_UNIT = 0.75; // toolbar sizes are in 1/96 in (CSS px at 100%), like the overlay; ink is stored in points @@ -25,6 +25,8 @@ export class Ink { this.typing = null; // the Type tool (makeTyping), set by main.js this.selP = null; // the page a Select gesture started on this.pv = null; // { page, hide, add }: a selection being dragged, drawn in its new spot + this.laser = makeLaser(); // laser pointer marks: they fade away and are never ink + this.pointing = false; // a laser mark is being drawn } /* for a moment, let the PDF's text be found under the pen (Type: drag on text to select it) */ @@ -167,6 +169,11 @@ export class Ink { if (typing) { clearTextSel(); this.drag.text = textAt(e.clientX, e.clientY, this.unblock); } // starting on the PDF's text: select it e.preventDefault(); return; } + if (T.laser && kind !== 'palm') { // the palm still erases + this.pointing = true; + this.laser.down(e.clientX, e.clientY, T.hiliting ? T.hlInk() : T.color, (T.hiliting ? T.hlWidth : T.width) * PT_PER_UNIT * this.v.zoom, T.hiliting); + e.preventDefault(); return; + } const el = e.target.closest('.pg'); if (!el) { this.active = null; return; } const P = el._P, q = this.pt(e, P), z = this.v.zoom; @@ -201,6 +208,12 @@ export class Ink { this.drag.x = e.screenX; this.drag.y = e.screenY; e.preventDefault(); return; } + if (this.pointing) { + let evs = e.getCoalescedEvents ? e.getCoalescedEvents() : null; + if (!evs || !evs.length) evs = [e]; + for (const ev of evs) this.laser.move(ev.clientX, ev.clientY); + e.preventDefault(); return; + } if (this.selP) { let evs = e.getCoalescedEvents ? e.getCoalescedEvents() : null; if (!evs || !evs.length) evs = [e]; @@ -235,6 +248,7 @@ export class Ink { if (a) a.click(); return; } + if (this.pointing) { this.pointing = false; this.laser.up(); return; } if (this.selP) { const P = this.selP; this.selP = null; if (e.type === 'pointerup') { const q = this.pt(e, P); this.sel.up(q[0], q[1], e.clientX, e.clientY); } else this.sel.cancel(); diff --git a/app/main.js b/app/main.js index 9d51826..0d17060 100644 --- a/app/main.js +++ b/app/main.js @@ -2,7 +2,7 @@ // Everything runs in this browser tab. Nothing is uploaded. import { obLangs, obLang, obT, obTranslate } from '../shared/strings.js'; -import { makeTimer, paletteColors, setPalette, fitTools, makePopMenu, historyKey, hlInk, makeHlMenu, holdRepeat, confirmTap, flashBtn, makePeriodPicker, makeSettings, loadPeriods, startPen, remapPeriods, makeSelect, makeTyping } from '../shared/ink-core.js'; +import { showLaser, makeTimer, paletteColors, setPalette, fitTools, makePopMenu, historyKey, hlInk, makeHlMenu, holdRepeat, confirmTap, flashBtn, makePeriodPicker, makeSettings, loadPeriods, startPen, remapPeriods, makeSelect, makeTyping } from '../shared/ink-core.js'; import { loadPdfjs, PDFJS_CMAPS_URL, PDFJS_FONTS_URL } from './libs.js'; import { Viewer } from './viewer.js'; import { Ink, PT_PER_UNIT } from './ink.js'; @@ -45,6 +45,7 @@ const isHex = (c) => /^#[0-9a-f]{6}$/i.test(c || ''); /* ---------- tool state (read by the ink layer) ---------- */ const T = { typing: false, erasing: false, hiliting: false, covering: false, // covering: the highlighter is in Cover mode + laser: false, // laser pointer: tap the selected color again, and marks fade away by themselves selecting: false, // the Select tool: the pen circles ink instead of writing penColor: PEN_COLOR, hlColor: HIGHLIGHT_COLOR, coverColor: COVER_COLOR, // pen, highlighter and cover each remember their own color color: PEN_COLOR, width: 2.5, hlWidth: HIGHLIGHT_W, smooth: SMOOTHING, fingerScrolls: FINGER_SCROLLS, @@ -592,10 +593,10 @@ const settings = makeSettings({ return true; }, tools: () => ({ finger: T.fingerScrolls, width: T.width, smooth: T.smooth, hlColor: T.hlColor, hlStrength: T.hlStrength }), - setPen(c) { T.penColor = c; if (!T.hiliting) T.color = c; T.erasing = false; if (T.typing) typing.restyle(); refresh(); }, + setPen(c) { T.penColor = c; if (!T.hiliting) T.color = c; T.erasing = false; T.laser = false; if (T.typing) typing.restyle(); refresh(); }, resetTools() { Object.assign(T, { width: 2.5, hlWidth: HIGHLIGHT_W, hlColor: HIGHLIGHT_COLOR, customColor: '', covering: false, hlStrength: HIGHLIGHT_STRENGTH, - coverColor: COVER_COLOR, smooth: SMOOTHING, fingerScrolls: FINGER_SCROLLS, penColor: PEN_COLOR, erasing: false }); + coverColor: COVER_COLOR, smooth: SMOOTHING, fingerScrolls: FINGER_SCROLLS, penColor: PEN_COLOR, erasing: false, laser: false }); T.color = toolColor(); refresh(); }, onOpen: () => { closeMenus(); timer.syncSound(); }, @@ -626,6 +627,7 @@ const isPreset = (c) => !!bar.querySelector('[data-color="' + c + '"]'); function refresh() { setPalette(bar, T.hiliting ? (T.covering ? 'cover' : 'hl') : 'pen', tr); // the swatches change with the tool for (const b of bar.querySelectorAll('[data-color]')) b.classList.toggle('on', !T.erasing && b.dataset.color === T.color); + showLaser(bar, T.laser, laserReady(), tr); $('[data-act="custom"]', bar).classList.toggle('on', !T.erasing && !!T.customColor && T.color === T.customColor && !isPreset(T.color)); customFill.style.background = T.customColor || 'transparent'; const w = T.hiliting ? T.hlWidth : T.width, shown = T.hiliting && !T.covering ? T.hlInk() : T.color; @@ -652,8 +654,15 @@ function typeOn() { } function selectOff() { if (T.selecting) { T.selecting = false; ink.dropSel(); } } function toolColor() { return T.hiliting ? (T.covering ? T.coverColor : T.hlColor) : T.penColor; } +function laserReady() { return !T.erasing && !T.selecting && !T.typing && !(T.hiliting && T.covering); } // pen and highlighter colors only +/* a tap on a color swatch: the color you already have selected turns the laser pointer on or off; any other color just picks it */ +function tapColor(c) { + const again = c === T.color && laserReady(), was = T.laser; + pickColor(c); + if (again) { T.laser = !was; setStatus(tr(T.laser ? 'st_laser_on' : 'st_laser_off')); } +} function pickColor(c) { - T.color = c; + T.color = c; T.laser = false; if (T.hiliting && T.covering) { T.coverColor = c; setLS('ink-cover-color', c); } else if (T.hiliting) { T.hlColor = c; setLS('ink-hl-color', c); } else T.penColor = c; T.erasing = false; selectOff(); if (T.typing) typing.restyle(); refresh(); @@ -703,7 +712,7 @@ const hlMenu = makeHlMenu(bar, T, () => { setLS('ink-hl-mode', T.covering ? 'cover' : 'hl'); setLS('ink-hl-strength', T.hlStrength); if (T.covering) setLS('ink-cover-color', T.coverColor); - typeOff(); T.hiliting = true; T.erasing = false; selectOff(); T.color = toolColor(); refresh(); + typeOff(); T.hiliting = true; T.erasing = false; T.laser = false; selectOff(); T.color = toolColor(); refresh(); }, () => closeMenus('hl')); for (const m of [fileMenu, clearMenu.el]) m.addEventListener('click', (e) => { const b = e.target.closest('button'); if (!b) return; @@ -717,7 +726,8 @@ for (const m of [fileMenu, clearMenu.el]) m.addEventListener('click', (e) => { bar.addEventListener('click', onToolbarClick); function onToolbarClick(e) { const b = e.target.closest('button'); if (!b) return; - if (b.dataset.color) pickColor(b.dataset.color); + if (/^(type|erase|hilite|select)$/.test(b.dataset.act)) T.laser = false; // another tool puts the laser pointer away + if (b.dataset.color) tapColor(b.dataset.color); else if (b.dataset.period !== undefined) { if (ink.switchTo(b.dataset.period)) renderPeriods(); } else switch (b.dataset.act) { case 'type': if (T.typing) typeOff(); else typeOn(); break; diff --git a/app/report/index.html b/app/report/index.html index b579265..b8a9a57 100644 --- a/app/report/index.html +++ b/app/report/index.html @@ -98,7 +98,7 @@

Is OverBoard not working on your board?

If something doesn't work the way the page asks, that's fine. That's exactly what I need to know. Just keep going.

Nothing is sent until you press Send at the very end, and you'll see everything first. No worksheets, PDFs or ink are ever included.

-

OverBoard v51

+

OverBoard v52

diff --git a/app/sw.js b/app/sw.js index 0fdb5d6..1e17543 100644 --- a/app/sw.js +++ b/app/sw.js @@ -1,10 +1,10 @@ // ===== GENERATED by tools/build.py: every file the app needs, with the start of its SHA-256. Do not edit by hand. ===== -const VERSION = '8db00c515759'; +const VERSION = '67235d4523b7'; const FILES = { - "../overlay/ink_overlay.html": "c55fd5171f4aab60", - "../shared/ink-core.js": "bd0ac55dbae6a3ea", - "../shared/strings.js": "4c0c63493dd62532", - "../shared/toolbar.css": "3d62c20ea472966f", + "../overlay/ink_overlay.html": "b36e22b0b1502928", + "../shared/ink-core.js": "272a7bb3b465f4fe", + "../shared/strings.js": "b247836e7165abf0", + "../shared/toolbar.css": "a611595b897560c5", "app.css": "01f9300545b535ad", "embed.js": "ea50a9ff4e960dd4", "export.js": "eaec8736ffed97b7", @@ -17,14 +17,14 @@ const FILES = { "icons/icon-512.png": "46ca8bd2d6a32612", "icons/maskable-512.png": "c7d41ed2fa4ad874", "image.js": "d396b7d4f5aced4e", - "index.html": "ce988a0e5e7c1229", - "ink.js": "76142d82f12d37ca", + "index.html": "abcc33cde11b1fdf", + "ink.js": "3dc693cb202efe0c", "libs.js": "c09f60186ab9029a", - "main.js": "fa607d2ba7d7680b", + "main.js": "8275dced3e07837c", "manifest.json": "416c107c34c8610b", "notebook.js": "7346e40dda6ff149", "offline.js": "6504935b2738711a", - "report/index.html": "8363f612fa99d807", + "report/index.html": "6bee078f59f66287", "store.js": "155ec064f6ffe569", "textlayer.js": "383ad22e91afb648", "vendor/pdf-lib@1.17.1/LICENSE.md": "f2c9fc00fdb66eb9", @@ -217,7 +217,7 @@ const FILES = { "vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-BoldItalic.ttf": "a224075ac17495ad", "vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-Italic.ttf": "832b4406dbef2362", "vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-Regular.ttf": "f8ace1f892b2bd9d", - "version.json": "69825a788032a52b", + "version.json": "e055ceb95d13e895", "viewer.js": "1cffd9d5c7158958" }; // ===== END GENERATED ===== diff --git a/app/version.json b/app/version.json index f8f2ae8..f25279b 100644 --- a/app/version.json +++ b/app/version.json @@ -1,5 +1,5 @@ { - "v": "1f191617e962", + "v": "5b083e233d69", "js": [ "embed.js", "export.js", diff --git a/index.html b/index.html index 452d6ef..a77e209 100644 --- a/index.html +++ b/index.html @@ -58,7 +58,7 @@

Exit ticket

OverBoard · page 2 / 2 · Your ink saves in this browser only. Nothing is uploaded.
-