Video as code: canvas scenes rendered with WebCodecs in headless Chrome, a review viewer, and agent skills that build the video from your references.
Viewer: a player bar in full screen; move, resize and clear notes (#5)
Stanyslaus Hary5173e3b7b2d5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bc45515..d15dd10 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,9 @@ Changes are listed by release, newest first. The sections dated before 0.1.0 rec### Added- `--skill hermes` for setup and the installer puts the skills where Hermes Agent reads them: `skills/` in its home, which is `HERMES_HOME` when that is set, else `~/.hermes`, or `%LOCALAPPDATA%\hermes` on Windows. Hermes does not read `~/.agents/skills` unless it is added to its config. `--skill muse` is another name for `agents`, because Muse Code reads `~/.agents/skills`. The README and the install docs list both agents. Checked on the Windows laptop with a test home: setup copied both skills to the two folders, and `motlab uninstall` removed them again. Neither agent was installed here, so neither has loaded the skills yet.+- Full screen in the viewer has a player bar. Before, it showed the preview alone. Now one white card runs along the bottom of the full-screen preview, as in the cinema viewer of DaVinci Resolve or Frame.io: a scrub bar split into the scenes, with the open notes' numbers above it and a range as a blue band, then the time and the scene on the left, previous, play and next in the middle of the screen, and a button on the right that leaves full screen. Click or drag the scrub bar to move in time, rest on it to see the time, click a note's number to open it; the arrows step a frame anywhere in full screen. The timeline and its range, zoom and timeline buttons stay out. So that it covers no part of the frame, the bar stays hidden, also while paused, and comes up while the pointer is in the bottom 120 px of the screen, like an auto-hidden taskbar; it also shows for 2.5 s on entering full screen and after Space, the arrows, Home or End, and never while a note is drawn or moved. While the video plays and the pointer rests, the cursor hides too. `F` opens and closes full screen, tooltips show there too, and the full-screen button no longer keeps the focus, so Space plays instead of leaving full screen. Checked in a windowed Chrome on the Windows laptop over the DevTools protocol, on a 1920x1080 screen: a click at the middle of the scrub bar went to 00:04.50 of 9 s, a drag to 80% to 00:07.20 and the scene name followed, the play button sat at the middle of the screen whatever the scene name, the arrows stepped one frame, a note's number opened that note, the bar hid 2.5 s after entering while paused, came up with the pointer near the bottom and stayed there, went when the pointer left, showed after an arrow key, stayed down while a box was drawn to 40 px above the bottom edge, and hid with the cursor while playing, a note could be drawn and moved, and the exit button brought the timeline back. Headless Chrome refuses full screen, so this has no automated test.+- An open note's box can be moved by dragging inside it and resized by dragging a corner or an edge, and an open point can be dragged. Before, a box in the wrong place had to be deleted and drawn again. The box stays inside the frame and keeps its number, text and frame, and its picture in `selection/` is drawn again.+- Delete all done notes, under the unfolded done notes, deletes the open version's done notes and their pictures in one go, after a second click within 4 s. Both note changes were checked in headless Chrome on the example project: moving, resizing from a corner, flipping a box by dragging a corner past the other one, dragging it off the frame, moving a point, the cursors over each part, a new box drawn over a closed one, and clearing two done notes while an open one stayed.### Fixeddiff --git a/DESIGN.md b/DESIGN.mdindex d0ceb18..bef6e36 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -14,6 +14,7 @@ This covers `src/editor.html`. The viewer is only for looking at a project and p- One header across both panes, after the Claude app header: the panel toggle on the left, `project / scene` in the middle (project name grey, current scene black), Export on the right. The project name and the version after it are buttons with a small chevron. Each opens a menu centred under it: projects with the folder name and its path in muted text, versions with the name and file name. The project menu ends with the other language, named in that language ("English" or "Bahasa Indonesia", with EN or ID in muted text), so someone who cannot read the current one still finds it. The open one has the selected-row grey. The version menu ends with "Versi baru dari ini", which turns into a name field and a small dark "Buat" button like Export.- Two panes under the header, because the scene list and the preview need to be visible together. The grey canvas `#ececec` holds the preview, the play toolbar, the full-screen pill in the top right and the timeline card at the bottom.- The play toolbar ends with two magnifier buttons that zoom the timeline, and a button that hides or shows the timeline (a frame with a bottom bar, like the panel icon with a side bar). Hidden, the preview fills the canvas up to the sidebar, and the zoom buttons are hidden too. It shows and hides at once, without a slide, and the browser remembers it. Zoomed in, the timeline scrolls sideways with a native scrollbar, and its canvas stays put (sticky) and draws only what is in view.+- Full screen is for watching, laid out like the player bar of DaVinci Resolve's cinema viewer or Frame.io but in the viewer's own style: the preview fills the screen on `#111`, and one white card like the timeline's (12 px radius, the menu shadow, 12 px from the screen's edges) runs along the bottom. Its top is a scrub bar: a 4 px track per scene in `#dcdcda`, 2 px apart at each cut, dark `#1f1f1e` up to the playhead, with a 12 px dark knob, the open notes' numbers as the timeline's light blue tags above it, and a range as a 16% blue band. A hover shows the time in a small dark label like a tooltip. Under it the row has three columns like the header: the time and the scene's name in muted text on the left, previous, play and next in the middle of the screen, as under the preview in the window, and on the right the button that leaves full screen (its arrows pointing in). A long scene name ends in an ellipsis, so the middle never moves. The timeline, the range bar, the range, zoom and timeline buttons and the full-screen pill are left out. The card is hidden unless the pointer is in the bottom 120 px, like an auto-hidden taskbar, so the whole frame shows while it is looked at; it fades in and out over 0.26 s, shows for 2.5 s on entering full screen and after a transport key, and never comes up while a note is being drawn. The cursor hides while it plays and the pointer rests.- The timeline is at most 35% of the window height and scrolls, so a project with many audio files does not push the preview out. The preview area is at least 150 px including padding.- The timeline's final height is set as soon as `project.json` is read, so it does not jump when the scenes finish loading.- Below 720 px the sidebar floats over the canvas instead of squeezing it, and it closes when the window becomes that narrow. On touch screens buttons grow to 44 px.@@ -24,7 +25,8 @@ This covers `src/editor.html`. The viewer is only for looking at a project and p- White and neutral greys, so the colours in the scene preview are the only strong colours on screen.- Blue `#2c6fe0` appears only on the timeline (the selected clip, the selection line, and a range as a 10% band with a 1 px edge on each side and an 8 by 14 px head at the top of each edge, like the playhead's), on the range button while it waits for a drag, on the bracket icon of the range bar, on the play button while the video is playing, and on the notes drawn on the preview. A note's box follows the selection box of the Claude canvas: a 1 px blue line, a light blue fill at 14% (22% for the open note), square corners. A point is a 16 px circle in the same style with a 5 px blue dot in the middle. Each has its number in a 16 px blue tag with white text above its top left corner (top right for a point). They sit over the preview as outline elements, so the line stays 1 px and sharp at any preview size. `selection/<n>.png` draws them the same, scaled to the frame. On the timeline the note numbers are tags in a row under the time labels: light blue `#dfe9fb` with blue text, solid blue with white text for the open note. A range note draws a 2 px line to the end of its range with a short end cap. All lines are drawn first and every tag over them with a 2 px margin in the colour behind it, so no line runs through a number.- A range gets a second pill next to the play toolbar, in the same style: the bracket icon, "00:03.00", an arrow icon, "00:06.50" (the same everywhere a range is written, with "sampai" for screen readers), a thin divider and the length in muted text, a "Catatan" button and ×. The two wrap onto two rows when they do not fit. Below 480 px the toolbars drop the total length, the range length and the zoom buttons, so they fit a phone.-- The open note is a card like the menus (white, 12 px radius, the menu shadow) under its box, or above the timeline for a range note, with the number tag and where it is, a text field, a quiet "Hapus" and a small dark "Simpan" like Export. In the side panel the notes are rows like the audio rows, with the number in the grey tile; an empty note reads "Tanpa catatan" in muted text. The card's footer has a quiet "Tandai selesai" with a check icon between them ("Buka lagi" with a rotate icon on a done note, whose head then ends with a muted check and "Selesai"). Done notes fold under a muted "Selesai N" row with a chevron at the end of the list; unfolded, their number and text are muted and the text struck through. They are not drawn on the preview or the timeline unless one is open.+- The open note is a card like the menus (white, 12 px radius, the menu shadow) under its box, or above the timeline for a range note, with the number tag and where it is, a text field, a quiet "Hapus" and a small dark "Simpan" like Export. In the side panel the notes are rows like the audio rows, with the number in the grey tile; an empty note reads "Tanpa catatan" in muted text. The card's footer has a quiet "Tandai selesai" with a check icon between them ("Buka lagi" with a rotate icon on a done note, whose head then ends with a muted check and "Selesai"). Done notes fold under a muted "Selesai N" row with a chevron at the end of the list; unfolded, their number and text are muted and the text struck through. They are not drawn on the preview or the timeline unless one is open. Unfolded, the done list ends with a muted "Hapus semua yang selesai" row with a × icon, which reads "Klik lagi untuk menghapus N catatan" for 4 s after the first click.+- The open note's box has a 7 px white square with a 1 px blue line on each corner, like a selected box in a design tool, and the cursor over it shows a move or a resize arrow.- Selected rows in the sidebar and in the Export menu use a grey background `#ebebea` and a bold name, like the active item in the Claude sidebar. No borders or accent bars. The Export button names the resolution it will export, so the menu needs no check mark. While an export runs, that button is disabled and faded like any disabled control, with a spinner and "Mengekspor 4K…". A full-width "Batalkan" button appears under it, tinted like the blue play button: red text `#b8322a` on `#fbe4e2` (4.90:1; hover `#f8d9d6`, 4.50:1). The resolution list cannot be changed meanwhile. Red is used for nothing else.- Muted text `#666561` stays above 4.5:1 on every background it sits on (white, hover, selected row, canvas). The lowest is 4.78:1 on the selected row. The waveform `#85847f` is 3.31:1 against its clip, and the selected waveform in blue is 3.86:1.diff --git a/ROADMAP.md b/ROADMAP.mdindex 59dd2aa..c2a3cc3 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -10,13 +10,13 @@ What is not built, what has not been tested, and ideas that came up while using- The viewer on a VPS with a domain. That needs security in front of it, or access only through Tailscale, which is also worth considering. From there, work could be run remotely on the personal laptop (when it is on) or on the VPS (when there is one).- Custom GLSL transitions from a file in the project. A transition as a layer over the cut (a swish of shapes) already exists as the asset skill's `transition.js`, but each of the two scene pages has to draw its half by hand; `project.json` has no option for it.- A cut list that splits one recording over several scenes by section, with captions placed from a transcript. `cuts.js` has the time map (`toOut`), but each section page still picks its part of the list by hand.-- Moving or resizing a note's box after it is drawn. Today the note has to be deleted and drawn again.-- Clearing done notes in one go. They fold under Done, but `selection.json` keeps every one until it is deleted by hand.+- Bringing up the viewer's full-screen player bar on a touch screen. The bar comes up when the pointer is near the bottom edge, and a finger has no pointer to rest there, so on a touch screen only the keys (Space, the arrows, Home and End) show it. A tap in the bottom strip could, as long as it still leaves a note drawn there alone.+- A dark mode for the viewer. Its colours are written into the CSS and the timeline's canvas code, so they need to become tokens with dark values checked for contrast first.## Not tested yet- The benchmark against Remotion and HyperFrames on macOS and Linux, with their own downloaded browsers, and on scenes heavy on text, images or footage. It was one scene on Windows, at 1080p and 4K.-- The npm package on macOS and Linux. On Windows it was installed from the registry, and with nvm for Windows 2.0 it needs npm's prefix moved to a folder on PATH (docs/install.md).+- The npm package on macOS. It was installed on Windows, from the registry and with nvm for Windows 2.0 (where setup writes its own launcher), and on a Linux VPS from a packed tarball (docs/install.md).- macOS, and Linux beyond the tests, including `motlab update` there. On Linux, CI renders the end-to-end tests on an Ubuntu runner; no real video has been made there. On macOS the Chrome paths and the Metal flag are in the code, but nothing has run.- Renders longer than 10 minutes, and a 10-minute render on a machine that is doing nothing else.- A machine without a GPU beyond the tests. CI runs the end-to-end tests on Linux and Windows runners without a GPU, and the benchmark ran with Chrome drawing on SwiftShader on the test laptop (1080p and 4K, in `docs/rendering.md`), but no real video has been rendered on such a machine, and no 3D (WebGL) scene.@@ -29,7 +29,8 @@ What is not built, what has not been tested, and ideas that came up while using- MPFB, which was not installed on the test laptop.- The asset skill's FBX and OBJ files in programs other than Blender (Unity, Unreal, Maya, Cinema 4D).- `svgparts.js` and `transition.js` in the viewer. They were checked with stills and a video render.-- Notes on a real touch screen. Touch was emulated in Chrome over the DevTools protocol.+- Notes on a real touch screen. Touch was emulated in Chrome over the DevTools protocol. Moving and resizing a box was tried with the mouse only.+- The viewer's full screen outside Chrome on Windows.- The skills in agents other than Claude Code. The installer was run with `--dry-run` for every target, and the folders come from each agent's docs, but no other agent has loaded the skills or made a video with them yet. That includes Muse Code and Hermes Agent, added from their docs in November 2026.## Questions about speeddiff --git a/docs/install.md b/docs/install.mdindex ef3e1bb..8f657fc 100644--- a/docs/install.md+++ b/docs/install.md@@ -52,7 +52,7 @@ npm config set prefix "%APPDATA%\npm"In PowerShell write `"$env:APPDATA\npm"`. `%APPDATA%\npm` is npm's usual global folder on Windows and is often on PATH from an earlier Node install; `where npm` lists it if so, otherwise add it to PATH. This changes where every global package goes, not only motlab, and the packages there are shared by all Node versions. `motlab update` keeps working, because its `npm install -g` follows the same setting. The clone below also works there, since its installer writes its own launcher.-This was tested on Windows 11, from the registry and from a packed tarball, each installed into a separate npm folder: `setup`, `update`, `uninstall` and a render of the example. It was also installed globally with nvm for Windows 2.0: `npx @motlab/cli` ran the installed package from the nvm folder, setup wrote the launcher when that folder was off PATH and none when it was on PATH, and with the prefix in `%APPDATA%\npm` the command was found without one. It has not been tried on macOS or Linux.+This was tested on Windows 11, from the registry and from a packed tarball, each installed into a separate npm folder: `setup`, `update`, `uninstall` and a render of the example. It was also installed globally with nvm for Windows 2.0: `npx @motlab/cli` ran the installed package from the nvm folder, setup wrote the launcher when that folder was off PATH and none when it was on PATH, and with the prefix in `%APPDATA%\npm` the command was found without one. On a Linux VPS (Ubuntu, 2 cores, no GPU, npm's prefix in `~/.npm-global`), a packed tarball installed globally ran `setup` without writing a launcher, `which motlab` found npm's own command, `motlab doctor` was ready and the example rendered. It has not been tried on macOS.## With the installerdiff --git a/docs/viewer.md b/docs/viewer.mdindex 9f59f97..e09eaf1 100644--- a/docs/viewer.md+++ b/docs/viewer.md@@ -44,12 +44,14 @@ The name after the project in the header is the version menu. It lists every pro| A note on a range | mark the range, then Note in the range bar || Save and close a note | Enter, Save, Escape, or a click on the empty grey space around the preview (Shift+Enter is a new line) || Open a note | its row under Notes, its number on the timeline, or a click on its box |+| Move or resize a note's box | open the note, then drag inside its box to move it, or a corner or an edge to resize it; a point moves the same way || Delete a note | Delete in the open note || Mark a note done | Mark done in the open note; Reopen opens it again || See the done notes | Done at the end of the Notes list |+| Delete all done notes | Delete all done notes, under the unfolded done notes, then click it again within 4 s || Hide the timeline | the last button in the play toolbar || Hide the side panel | the button in the top left |-| Full screen | the button in the top right of the preview |+| Full screen | the button in the top right of the preview, or `F`; Escape, `F` or the button on the right of the player bar to leave |Every button in the toolbars has a tooltip with its shortcut, and resting the pointer on the timeline for a second lists the timeline's keys.@@ -121,6 +123,12 @@ A note that has been dealt with can be marked done, by the user with Mark done iThe agent writes `done` into the file while the page is open. So the viewer keeps the file's `done` for every note it did not change itself, and the server sends back which notes are done after each save. The page also reads the file again when it gets focus back, so a note the agent marked done moves under Done without a reload. A note the agent deletes from the file is gone from the page then too.+An open note's box has a small square on each corner. Dragging inside the box moves it, and dragging a corner or an edge resizes it; the cursor shows which. An open point can be dragged too. The box stays inside the frame, keeps its number, text and frame, and its picture in `selection/` is drawn again. A drag on the preview with no note open still draws a new box, even over an old one, so a box has to be opened before it can be moved.++The done notes can be deleted in one go with Delete all done notes, the last row under the unfolded done notes. The first click turns the row into "Click again to delete 2 notes" for 4 seconds, and a second click deletes them and their pictures, as Delete does one by one. It deletes the done notes of the open version only.++Full screen shows the preview on the whole screen with a player bar along its bottom edge. The bar has a scrub bar across its width, split into the scenes and dark up to the playhead: click or drag it to move in time, and rest the pointer on it to see the time there. The open notes' numbers sit above it, and a click on one opens that note; a range shows as a light blue band. Under it, the time and the scene's name are on the left, previous, play and next in the middle of the screen, and a button on the right leaves full screen. The Left and Right arrows step one frame anywhere in full screen (one second with Shift), and Home and End jump to the start and the end. The timeline, the range bar and the range, zoom and timeline buttons stay out of full screen; `R` does nothing there, while `I`, `O` and `X` still mark a range at the playhead. The bar stays hidden so that it covers nothing, also while the video is paused, and comes up like an auto-hidden taskbar while the pointer is in the bottom 120 px of the screen. It also shows for 2.5 seconds on entering full screen and after Space, the arrows, Home or End. Drawing or moving a note never brings it up, so a box can be drawn down to the bottom of the frame. While the video plays and the pointer rests for 2.5 seconds with the bar hidden, the cursor hides too.+Notes work in full screen too: the card opens over the full-screen preview and takes typing, and Save writes the note. On a touch screen a finger drag draws a box like the mouse does, and a tap on Save saves it (tried in a windowed Chrome over the DevTools protocol, with touch emulated).Two tabs on the same project can both take notes. A save names the notes the tab deleted instead of leaving them out, so notes made in the other tab are kept, and a new note whose number the other tab took first moves to the next free number, with its picture drawn again. After every save, and when a tab gets focus back, the page takes in the file's notes: the other tab's new ones, the ones it deleted, and done marks. Tried in a windowed Chrome over the DevTools protocol with two tabs: tab B's first note became 2 next to tab A's 1, each tab listed the other's notes after a focus change, a note deleted in B stayed deleted when A saved again, and every picture showed its own number. Two tabs editing the text of the same note still keep whichever saved last.diff --git a/src/editor.html b/src/editor.htmlindex eb46ea9..f3084a8 100644--- a/src/editor.html+++ b/src/editor.html@@ -74,13 +74,39 @@#stage { flex: 1; min-height: 150px; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 60px 24px 14px; font-size: 13px; color: var(--muted); }#msg { max-width: 46ch; text-align: center; user-select: text; }#stage { position: relative; }- #stage:fullscreen { padding: 0; background: #111; }+ /* full screen: the preview fills the screen and a player bar floats along its bottom edge, as #dock: a white card like+ the timeline's, with a scrub bar split into scenes (note numbers above it, a range as a light blue band), then the+ play buttons, the time, the scene and the button that leaves full screen. The timeline, the range, zoom and timeline+ buttons, the range bar and the full-screen pill are left out. The bar is hidden ('bar-off') unless the pointer is near+ the bottom edge, so it covers nothing while the frame is looked at */+ #dock { display: contents; }+ #scrubWrap, #fsScene, #fullExit { display: none; }+ #canvas:fullscreen { overflow: hidden; background: #111; }+ #canvas:fullscreen #stage { position: absolute; inset: 0; padding: 0; }+ #canvas:fullscreen #dock { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3; display: flex; flex-direction: column; padding: 6px 6px 4px;+ background: #fff; border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.12); transition: opacity var(--slide) var(--ease); }+ #canvas:fullscreen :is(#lane, #rangeBtn, #zout, #zin, #laneBtn, #rangeBar, #pillFull) { display: none; }+ #canvas:fullscreen #scrubWrap { display: block; position: relative; }+ #scrub { display: block; width: 100%; height: 34px; cursor: pointer; touch-action: none; }+ #scrubTip { position: absolute; bottom: calc(100% + 2px); translate: -50% 0; padding: 4px 6px; border-radius: 6px; background: var(--text); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none; }+ #canvas:fullscreen #bar { justify-content: flex-start; padding: 0; margin: 0; }+ /* three columns as in the header: the time and the scene on the left, previous, play and next in the middle of the+ screen, the exit button on the right */+ #canvas:fullscreen #tools { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr); padding: 0; border: 0; background: none; box-shadow: none; }+ #canvas:fullscreen #time { grid-area: 1 / 1; justify-self: start; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* a long scene name ends in an ellipsis */+ #canvas:fullscreen #prev { grid-area: 1 / 2; } #canvas:fullscreen #play { grid-area: 1 / 3; } #canvas:fullscreen #next { grid-area: 1 / 4; }+ #canvas:fullscreen #fsScene { display: inline; margin-left: 10px; }+ #canvas:fullscreen #fullExit { grid-area: 1 / 5; justify-self: end; display: flex; }+ #canvas.idle:fullscreen, #canvas.idle:fullscreen #view { cursor: none; }+ #canvas.bar-off:fullscreen #dock { opacity: 0; pointer-events: none; }/* notes on the preview, after the Claude canvas selection box: a 1 px blue line and a light blue fill, squarecorners, and the note's number in a small blue tag above the top left corner */#marks { position: absolute; inset: 0; pointer-events: none; }.mk { position: absolute; border: 1px solid var(--blue); background: rgba(44,111,224,.14); }.mk.on { background: rgba(44,111,224,.22); }.mk.point { border-radius: 50%; }+ /* the open note's box has a small white square on each corner: drag a corner or an edge to resize it, the inside to move it */+ .mk .hd { position: absolute; width: 7px; height: 7px; margin: -4px; background: #fff; border: 1px solid var(--blue); }.mk.point::after { content: ""; position: absolute; inset: 0; margin: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }.mk i, .tag { min-width: 16px; height: 16px; padding: 0 5px; border-radius: 4px; background: var(--blue); color: #fff; font: 600 11px/16px var(--font); font-style: normal; text-align: center; font-variant-numeric: tabular-nums; }.mk i { position: absolute; left: -1px; bottom: calc(100% + 2px); }@@ -102,7 +128,8 @@/* done notes: folded under "Selesai" (Done) at the end of the list, muted and struck through, and off the preview and thetimeline unless one is open */#doneBtn { color: var(--muted); font-size: 13px; }- #doneBtn .ic { background: none; box-shadow: none; }+ #doneBtn .ic, #clearDone .ic { background: none; box-shadow: none; }+ #clearDone { color: var(--muted); font-size: 13px; }#doneBtn svg { transition: rotate var(--fast) var(--ease); }#doneBtn[aria-expanded="true"] svg { rotate: 180deg; }.row.done .ic.n, .row.done .name > span { color: var(--muted); }@@ -118,7 +145,7 @@#view { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 3v18M3 12h18' stroke='%23fff' stroke-opacity='.4' stroke-width='3.5'/%3E%3Cpath d='M12 3v18M3 12h18' stroke='%231f1f1e' stroke-width='1.5'/%3E%3C/svg%3E") 12 12, crosshair; }#view.on-dark { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 3v18M3 12h18' stroke='%23000' stroke-opacity='.4' stroke-width='3.5'/%3E%3Cpath d='M12 3v18M3 12h18' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 12 12, crosshair; }#view { max-width: 100%; max-height: 100%; touch-action: none; background: #fff; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 2px 10px rgba(0,0,0,.06); }- #stage:fullscreen #view { border-radius: 0; box-shadow: none; }+ #canvas:fullscreen #view { border-radius: 0; box-shadow: none; }#bar { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 12px; margin-bottom: 10px; }#tools, #rangeBar { height: 40px; padding: 0 6px; border-radius: 12px; }/* with a range: what it covers and what can be done with it, next to the play toolbar */@@ -264,7 +291,7 @@</aside><main><div id="canvas">- <div class="pill" id="pillFull"><button class="sq" id="full" data-i="full" data-label="full"></button></div>+ <div class="pill" id="pillFull"><button class="sq" id="full" data-i="full" data-label="full" data-key="F"></button></div><div class="toast" id="note" role="status" hidden></div><div id="stage"><span id="msg" data-t="loadingProject"></span><canvas id="view" hidden></canvas><div id="marks"></div><div class="pop" id="pop" role="dialog" aria-labelledby="popWhere" hidden>@@ -272,16 +299,19 @@<textarea id="popText" rows="2" data-t="placeholder=noteHint aria-label=note"></textarea><div class="foot2"><button id="popDel" data-t="del"></button><span><button id="popDone"></button><button id="popOk" data-t="save"></button></span></div></div></div>+ <div id="dock">+ <div id="scrubWrap"><canvas id="scrub" aria-hidden="true"></canvas><div id="scrubTip" hidden></div></div><div id="bar"><div class="pill" id="tools"><button class="sq" id="prev" data-i="prev" data-label="prevScene"></button><button class="sq" id="play" data-i="play" data-label="play" data-key="Space"></button><button class="sq" id="next" data-i="next" data-label="nextScene"></button>- <span id="time" class="num"><span id="now">00:00.00</span> <span class="muted">/ <span id="len">00:00.00</span></span></span>+ <span id="time" class="num"><span id="now">00:00.00</span> <span class="muted">/ <span id="len">00:00.00</span></span><span id="fsScene" class="muted"></span></span><button class="sq" id="rangeBtn" data-i="range" data-label="markRange" data-key="R" aria-pressed="false"></button><button class="sq" id="zout" data-i="zout" data-label="zoomOut" data-key="−"></button><button class="sq" id="zin" data-i="zin" data-label="zoomIn" data-key="+"></button><button class="sq" id="laneBtn" data-i="lane" data-label="hideTimeline" aria-expanded="true" aria-controls="lane"></button>+ <button class="sq" id="fullExit" data-i="unfull" data-label="fullExit" data-key="F"></button></div><div class="pill" id="rangeBar" role="group" data-t="aria-label=range" hidden><span class="ri" data-i="range"></span><span id="rangeText" class="num"></span>@@ -293,6 +323,7 @@<canvas id="tl" data-tip="#tlKeys" tabindex="0" role="slider" aria-label="Timeline" aria-valuemin="0" aria-valuenow="0"></canvas><div class="mark" id="pick" hidden></div><div class="mark" id="head"></div></div></div>+ </div></div></main><div id="frames"></div>@@ -390,6 +421,8 @@ const TEXT = {noteLabel: [(n, done, text, where) => `Catatan ${n}${done ? ', selesai' : ''}: ${text || 'tanpa catatan'}, ${where}`, (n, done, text, where) => `Note ${n}${done ? ', done' : ''}: ${text || 'empty note'}, ${where}`],noNotes: ['Belum ada catatan. Tarik kotak atau klik di preview.', 'No notes yet. Drag a box or click on the preview.'],allDone: ['Semua catatan sudah selesai.', 'All notes are done.'],+ clearDone: ['Hapus semua yang selesai', 'Delete all done notes'],+ clearSure: [n => `Klik lagi untuk menghapus ${n} catatan`, n => `Click again to delete ${n} note${n > 1 ? 's' : ''}`],rangeHow: ['Tarik di timeline dari awal sampai akhir. Esc untuk batal.', 'Drag on the timeline from start to end. Esc to cancel.'],open: ['Buka', 'Open'],cancelling: ['Membatalkan…', 'Cancelling…'],@@ -425,6 +458,7 @@ const ICON = {panel: svg('<rect x="2" y="3" width="12" height="10" rx="2"/><path d="M6.5 3v10"/>'),export: svg('<path d="M8 2.5v7.5m0 0L5 7m3 3 3-3M3 11v1a1.5 1.5 0 0 0 1.5 1.5h7A1.5 1.5 0 0 0 13 12v-1"/>'),full: svg('<path d="M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5 9.5 6.5M2.5 13.5l4-4"/>'),+ unfull: svg('<path d="M9.5 2.5v4h4M6.5 13.5v-4h-4M13.5 2.5l-4 4M2.5 13.5l4-4"/>'), // the same arrows, pointing inprev: svg('<path d="M4 3.5v9"/><path d="M12 4v8L6.5 8z" fill="currentColor"/>'),next: svg('<path d="M12 3.5v9"/><path d="M4 4v8l5.5-4z" fill="currentColor"/>'),play: svg('<path d="M5 3.5v9L12.5 8z"/>', true),@@ -549,10 +583,20 @@ if (!document.fullscreenEnabled) { $('full').disabled = true; label($('full'), L$('full').onclick = () => { // some embedded browsers neither open full screen nor reject, so a silent wait also gets a messageif (document.fullscreenElement) return document.exitFullscreen();let settled = false;- $('stage').requestFullscreen().then(() => settled = true, e => { settled = true; note(L('fullRefused')); });+ $('canvas').requestFullscreen().then(() => settled = true, e => { settled = true; note(L('fullRefused')); });setTimeout(() => { if (!settled) note(L('fullStuck')); }, 1500);};-document.onfullscreenchange = () => label($('full'), L(document.fullscreenElement ? 'fullExit' : 'full'));+addEventListener('keydown', e => { // F for full screen, as in video players+ if (e.key.toLowerCase() !== 'f' || e.ctrlKey || e.metaKey || e.altKey || e.target.closest?.('input, textarea') || $('full').disabled) return;+ e.preventDefault(); $('full').click();+});+$('fullExit').onclick = () => document.exitFullscreen();+// Only the full-screen element is drawn in full screen, so the tooltip moves into it and back out again. The button+// gives up focus, so Space plays instead of pressing it again.+document.addEventListener('fullscreenchange', () => {+ (document.fullscreenElement || document.body).append($('tip'));+ if (document.activeElement === $('full')) $('full').blur();+});try {const project = await (await fetch(encodeURIComponent('{{project}}'))).json(), fps = project.fps, files = project.audio || [];@@ -652,7 +696,7 @@ try {// lane scrolls natively, and the canvas (sticky) draws only the part in view.const fitPps = () => (lane.clientWidth - PAD * 2) / total, maxZoom = () => Math.max(1, 24 * fps / fitPps()); // up to 24 px per framefunction layout() { // hidden, the timeline has no width, so it keeps its zoom and is laid out again when it is shown- if (lane.hidden) return;+ if (lane.hidden || !lane.clientWidth) return; // hidden, or left out in full screenzoom = Math.min(zoom, maxZoom()); pps = fitPps() * zoom;$('laneIn').style.width = zoom > 1 ? total * pps + PAD * 2 + 'px' : '';$('zout').disabled = zoom <= 1; $('zin').disabled = zoom >= maxZoom();@@ -661,7 +705,8 @@ try {zoom = Math.max(1, z); layout(); lane.scrollLeft = PAD + at * pps - x; drawTimeline();}function drawTimeline() {- if (lane.hidden) return;+ drawScrub(); // notes and the range show on the full-screen scrub bar too+ if (lane.hidden || !lane.clientWidth) return; // hidden, or left out in full screenconst w = lane.clientWidth, h = laneHeight(tracks.length), dpr = devicePixelRatio, sx = lane.scrollLeft;tl.style.width = w + 'px'; tl.width = w * dpr; tl.height = h * dpr; tl.style.height = h + 'px'; g.setTransform(dpr, 0, 0, dpr, 0, 0);const X = time => PAD + time * pps - sx, from = Math.max(0, (sx - PAD) / pps), to = (sx + w) / pps; // visible seconds@@ -752,9 +797,10 @@ try {$('head').style.left = PAD + t * pps + 'px';$('pick').hidden = !sel; if (sel) $('pick').style.left = PAD + sel.time * pps + 'px';tl.setAttribute('aria-valuenow', t.toFixed(2)); tl.setAttribute('aria-valuetext', `${fmt(t)}, ${name(sceneAt(t).file)}`);+ drawScrub();}function reveal() { // zoomed in, playing or stepping brings the playhead back into view, near the left edge- if (lane.hidden) return;+ if (lane.hidden || !lane.clientWidth) return; // hidden, or left out in full screenconst x = PAD + t * pps - lane.scrollLeft;if (x < PAD || x > lane.clientWidth - PAD) lane.scrollLeft = t * pps;}@@ -793,6 +839,8 @@ try {d.className = 'mk' + (m.point ? ' point' : '') + (m === active ? ' on' : '');Object.assign(d.style, { left: vr.left - sr.left + b.x * k + 'px', top: vr.top - sr.top + b.y * k + 'px', width: b.w * k + 'px', height: b.h * k + 'px' });if (m.n) d.append(Object.assign(document.createElement('i'), { textContent: m.n }));+ if (m === active && m.box) for (const [x, y] of [[0, 0], [1, 0], [0, 1], [1, 1]])+ d.append(Object.assign(document.createElement('b'), { className: 'hd', style: `left: ${x * 100}%; top: ${y * 100}%` }));return d;}));if (active?.box || active?.point) place();@@ -819,7 +867,7 @@ try {async function show() {marks(); $('now').textContent = fmt(t);const s = sceneAt(t);- if (s !== shown) { if (shown) shown.warm = null; shown = s; $('crumb').textContent = name(s.file); } // played, it needs warming again+ if (s !== shown) { if (shown) shown.warm = null; shown = s; $('crumb').textContent = $('fsScene').textContent = name(s.file); } // played, it needs warming againif (busy) return;const at = t, frame = frameIn(s, at);// The display refreshes at 60 to 240 Hz and the video has 24 or 30 frames a second, so most ticks land on the frame@@ -850,8 +898,84 @@ try {if (at !== t) show();}+ // ---- full screen: the player bar stays hidden, paused too, so the whole frame shows, and comes up like an auto-hidden+ // taskbar while the pointer is in the bottom ZONE px of the screen. It also shows for 2.5 s on entering full screen+ // and after Space, the arrows, Home or End. A pointer moving with a button down (drawing or moving a note) never+ // brings it up, except while scrubbing. While it plays and the pointer rests for 2.5 s with the bar hidden, the+ // cursor hides too ('idle').+ const ZONE = 120;+ let barTimer = 0, cursorTimer = 0, inZone = false;+ const setBar = on => $('canvas').classList.toggle('bar-off', !on);+ function flashBar() { clearTimeout(barTimer); setBar(true); barTimer = setTimeout(() => { if (!inZone && !scrubbing) setBar(false); }, 2500); }+ function wake() { // the cursor+ $('canvas').classList.remove('idle'); clearTimeout(cursorTimer);+ if (document.fullscreenElement && playing) cursorTimer = setTimeout(() => { if ($('canvas').classList.contains('bar-off')) $('canvas').classList.add('idle'); }, 2500);+ }+ addEventListener('pointermove', e => {+ if (!document.fullscreenElement) return;+ wake();+ const was = inZone;+ inZone = e.clientY >= innerHeight - ZONE && (!e.buttons || scrubbing);+ if (inZone) { clearTimeout(barTimer); setBar(true); }+ else if (was && !scrubbing) { clearTimeout(barTimer); barTimer = setTimeout(() => { if (!inZone && !scrubbing) setBar(false); }, 400); }+ }, { passive: true });+ addEventListener('keydown', e => {+ wake();+ if (document.fullscreenElement && !e.target.closest?.('input, textarea') && [' ', 'ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(e.key)) flashBar();+ }, { passive: true });+ document.addEventListener('fullscreenchange', () => {+ inZone = false; wake();+ if (document.fullscreenElement) flashBar(); else { clearTimeout(barTimer); setBar(true); }+ requestAnimationFrame(() => drawScrub());+ });+ // The scrub bar in the full-screen player bar: the video's length across the bar, split into its scenes, dark up to+ // the playhead. Click or drag it to move in time; a note's number above it opens the note. Arrows step a frame (a+ // second with Shift) anywhere in full screen, as on the focused timeline.+ const SX = 8, SY = 25, scrubHits = []; // side room for the knob; the track's middle+ const scrubX = time => SX + time / total * ($('scrub').clientWidth - 2 * SX);+ const scrubTime = x => Math.min(total, Math.max(0, (x - SX) / ($('scrub').clientWidth - 2 * SX) * total));+ function drawScrub() {+ const c = $('scrub'), w = c.clientWidth, h = c.clientHeight;+ if (!document.fullscreenElement || !w) return;+ const s = c.getContext('2d'), dpr = devicePixelRatio, X = scrubX;+ c.width = w * dpr; c.height = h * dpr; s.setTransform(dpr, 0, 0, dpr, 0, 0);+ const fill = (x, y, cw, ch, r) => { if (cw <= 0) return; s.beginPath(); s.roundRect(x, y, cw, ch, r); s.fill(); };+ if (range) { s.fillStyle = 'rgba(44,111,224,.16)'; fill(X(range.start), SY - 6, X(range.end) - X(range.start), 12, 3); }+ scenes.forEach((sc, i) => { // 2 px apart at each cut; a transition's overlap belongs to the scene it leads into+ const a = X(sc.start) + (i ? 1 : 0), b = scenes[i + 1] ? X(scenes[i + 1].start) - 1 : X(total);+ s.fillStyle = '#dcdcda'; fill(a, SY - 2, b - a, 4, 2);+ s.fillStyle = '#1f1f1e'; fill(a, SY - 2, Math.min(b, X(t)) - a, 4, 2);+ });+ s.font = `600 11px ${FONT}`; s.textAlign = 'center'; s.textBaseline = 'middle'; scrubHits.length = 0;+ for (const m of openNotes()) { // tags as on the timeline: light blue, solid blue for the open note+ const tw = Math.max(16, s.measureText(m.n).width + 10), x0 = Math.min(w - tw, Math.max(0, X(m.range ? m.range.start : m.time) - tw / 2));+ s.fillStyle = m === active ? BLUE : '#dfe9fb'; fill(x0, 1, tw, 16, 4);+ s.fillStyle = m === active ? '#fff' : BLUE; s.fillText(m.n, x0 + tw / 2, 9.5);+ scrubHits.push({ m, x0, x1: x0 + tw });+ }+ s.fillStyle = '#1f1f1e'; s.beginPath(); s.arc(X(t), SY, 6, 0, Math.PI * 2); s.fill();+ }+ let scrubbing = false;+ const scrubTip = x => { const tip = $('scrubTip'), w = $('scrub').clientWidth; tip.textContent = fmt(scrubTime(x)); tip.hidden = false; tip.style.left = Math.min(w - 30, Math.max(30, x)) + 'px'; };+ $('scrub').onpointerdown = e => {+ if (e.button !== 0) return;+ const tag = e.offsetY < 19 && scrubHits.findLast(h => e.offsetX >= h.x0 && e.offsetX <= h.x1);+ if (tag) return goTo(tag.m);+ $('scrub').setPointerCapture(e.pointerId); scrubbing = true; seek(scrubTime(e.offsetX));+ };+ $('scrub').onpointermove = e => { if (scrubbing) seek(scrubTime(e.offsetX)); scrubTip(e.offsetX); };+ $('scrub').onpointerup = $('scrub').onpointercancel = () => { scrubbing = false; };+ $('scrub').onpointerleave = () => { if (!scrubbing) $('scrubTip').hidden = true; };+ new ResizeObserver(() => drawScrub()).observe($('scrub'));+ addEventListener('keydown', e => {+ if (!document.fullscreenElement || e.ctrlKey || e.metaKey || e.altKey || e.target.closest?.('input, textarea')) return;+ const step = e.shiftKey ? 1 : 1 / fps, to = { ArrowLeft: t - step, ArrowRight: t + step, Home: 0, End: total }[e.key];+ if (to === undefined) return;+ e.preventDefault(); seek(to);+ });+// ---- playback: the audio clock drives the playhead; the button is blue only while it plays- const setPlay = on => { $('play').innerHTML = on ? ICON.pause : ICON.play; $('play').classList.toggle('hot', on); label($('play'), L(on ? 'pause' : 'play')); };+ const setPlay = on => { $('play').innerHTML = on ? ICON.pause : ICON.play; $('play').classList.toggle('hot', on); label($('play'), L(on ? 'pause' : 'play')); wake(); };function play(jump = true) { // with a range, Play starts at its start and goes round inside itconst inside = range && t >= range.start && t < range.end - 1e-6;looping = !!range && (jump || inside); // a click elsewhere while playing plays on from there@@ -963,10 +1087,11 @@ try {const el = $('marks').querySelector('.mk.on'), M = 12;let r;if (el) r = el.getBoundingClientRect();- else if (active?.range && !lane.hidden) {+ else if (active?.range && !lane.hidden && lane.clientWidth) {const lr = tl.getBoundingClientRect(), x = lr.left + PAD + active.range.start * pps - lane.scrollLeft;r = { left: x, top: lr.top + MK_Y - 8, bottom: lr.top + MK_Y + 8 };- } else { const sr = $('stage').getBoundingClientRect(); r = { left: sr.left + sr.width / 2 - 144, top: sr.bottom - 24, bottom: sr.bottom - 24 }; }+ } else if (document.fullscreenElement) { const dr = $('dock').getBoundingClientRect(); r = { left: dr.left + dr.width / 2 - 144, top: dr.top, bottom: dr.top }; } // above the player bar+ else { const sr = $('stage').getBoundingClientRect(); r = { left: sr.left + sr.width / 2 - 144, top: sr.bottom - 24, bottom: sr.bottom - 24 }; }const w = pop.offsetWidth, h = pop.offsetHeight, below = r.bottom + 8, above = r.top - 8 - h;pop.style.left = Math.min(innerWidth - w - M, Math.max(M, r.left)) + 'px';// a range note sits above the timeline, so the range stays in view@@ -1035,10 +1160,27 @@ try {b.querySelector('.num').textContent = done.length;b.onclick = () => { doneOpen = !doneOpen; try { localStorage.motlabDone = doneOpen ? '1' : '0'; } catch {} listNotes(); $('doneBtn').focus(); };li.append(b); items.push(li);- if (doneOpen) items.push(...done.map(row));+ if (doneOpen) items.push(...done.map(row), clearRow(done.length));}$('notes').replaceChildren(...items);}+ // Under the unfolded done notes: delete them all. The first click asks, by changing the row's text for 4 s, and a+ // second click deletes them, as Hapus does one by one.+ let clearAsked = 0;+ function clearRow(n) {+ const li = document.createElement('li'), b = document.createElement('button');+ b.className = 'row'; b.id = 'clearDone';+ b.innerHTML = `<span class="ic" aria-hidden="true">${ICON.x}</span><span class="name"></span>`;+ b.lastChild.textContent = clearAsked ? L('clearSure', n) : L('clearDone');+ b.onclick = () => {+ if (!clearAsked) { clearAsked = setTimeout(() => { clearAsked = 0; listNotes(); }, 4000); listNotes(); return $('clearDone').focus(); }+ clearTimeout(clearAsked); clearAsked = 0;+ for (const m of notes.filter(x => x.done)) { images.delete(m.n); deleted.add(key(m)); if (m === active) { active = null; pop.hidden = true; } }+ notes = notes.filter(x => !x.done);+ paint(); listNotes(); drawTimeline(); save();+ };+ li.append(b); return li;+ }popText.oninput = () => { active.note = popText.value; grow(); place(); listNotes(); save(); };popText.onkeydown = e => {if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) { e.preventDefault(); closeNote(); }@@ -1103,7 +1245,7 @@ try {addEventListener('keydown', e => { // I and O mark the start and the end of the range at the playheadif (e.ctrlKey || e.metaKey || e.altKey || e.target.closest?.('input, textarea')) return;const k = e.key.toLowerCase(), at = snap(t);- if (k === 'r') setRangeMode(!rangeMode); // R picks the range tool, as in Final Cut Pro+ if (k === 'r' && !document.fullscreenElement) setRangeMode(!rangeMode); // R picks the range tool, as in Final Cut Pro; full screen has no timeline to drag onif (k === 'x') { const s = sceneAt(t); setRange(snap(s.start), snap(s.start + s.dur), true); } // X: the scene under the playhead, as Mark Clipif (k === 'i') setRange(at, range && range.end > at ? range.end : total, true);else if (k === 'o') setRange(range && range.start < at ? range.start : 0, at, true);@@ -1140,16 +1282,44 @@ try {return openNotes().filter(onFrame).findLast(m => m.box ? p.x >= m.box.x && p.x <= m.box.x + m.box.w && p.y >= m.box.y && p.y <= m.box.y + m.box.h: Math.hypot(p.x - m.point.x, p.y - m.point.y) <= (PT / 2 + 2) / k);};+ // The open note's box can be moved (drag inside it) and resized (drag a corner or an edge), and its point moved. What a+ // drag there would change: 'move', or the edges as compass letters ('n', 'se', ...), or null.+ const EDGE = 6; // CSS px either side of an edge+ const grab = e => {+ if (!active || !onFrame(active)) return null;+ const r = view.getBoundingClientRect(), k = r.width / view.width, x = e.clientX - r.left, y = e.clientY - r.top;+ if (active.point) return Math.hypot(x - active.point.x * k, y - active.point.y * k) <= PT / 2 + 2 ? 'move' : null;+ const { box: b } = active, l = b.x * k, t = b.y * k, rt = (b.x + b.w) * k, bt = (b.y + b.h) * k;+ if (x < l - EDGE || x > rt + EDGE || y < t - EDGE || y > bt + EDGE) return null;+ const v = Math.abs(y - t) <= EDGE ? 'n' : Math.abs(y - bt) <= EDGE ? 's' : '', h = Math.abs(x - l) <= EDGE ? 'w' : Math.abs(x - rt) <= EDGE ? 'e' : '';+ return v + h || (x > l && x < rt && y > t && y < bt ? 'move' : null);+ };+ const CURSOR = { move: 'move', n: 'ns-resize', s: 'ns-resize', e: 'ew-resize', w: 'ew-resize', ne: 'nesw-resize', sw: 'nesw-resize', nw: 'nwse-resize', se: 'nwse-resize' };+ function reshape(d, p) { // the open note's box or point after dragging from d.a to p, kept inside the frame+ const dx = p.x - d.a.x, dy = p.y - d.a.y, W = view.width, H = view.height, f = d.from;+ if (d.m.point) return void (d.m.point = { x: Math.round(Math.min(W, Math.max(0, f.x + dx))), y: Math.round(Math.min(H, Math.max(0, f.y + dy))) });+ if (d.edit === 'move') return void (d.m.box = { ...f, x: Math.round(Math.min(W - f.w, Math.max(0, f.x + dx))), y: Math.round(Math.min(H - f.h, Math.max(0, f.y + dy))) });+ let l = f.x, t = f.y, r = f.x + f.w, b = f.y + f.h;+ if (d.edit.includes('w')) l += dx; if (d.edit.includes('e')) r += dx;+ if (d.edit.includes('n')) t += dy; if (d.edit.includes('s')) b += dy;+ const c = (v, max) => Math.min(max, Math.max(0, v)); // dragged past the other edge, the box flips over+ [l, r] = [c(Math.min(l, r), W), c(Math.max(l, r), W)]; [t, b] = [c(Math.min(t, b), H), c(Math.max(t, b), H)];+ d.m.box = { x: Math.round(l), y: Math.round(t), w: Math.max(2, Math.round(r - l)), h: Math.max(2, Math.round(b - t)) };+ }// A drag on the preview draws a box and a click marks a point; either one is a new note, opened for typing. A click// on a note opens it, and a click while a note is open only closes it.view.onpointerdown = e => {if (e.button !== 0 || !cur) return;if (playing) pause();+ if (document.fullscreenElement) { clearTimeout(barTimer); setBar(false); inZone = false; } // out of the way of a note near the bottomview.setPointerCapture(e.pointerId);- drag = { a: onView(e), x: e.clientX, y: e.clientY, moved: false, open: !!active };+ const edit = grab(e);+ drag = { a: onView(e), x: e.clientX, y: e.clientY, moved: false, open: !!active, ...(edit && { edit, m: active, from: { ...(active.box || active.point) } }) };};view.onpointermove = e => {- if (!drag || (!drag.moved && Math.hypot(e.clientX - drag.x, e.clientY - drag.y) < 4)) return;+ if (!drag) { view.style.cursor = CURSOR[grab(e)] || ''; return; } // over the open note: a move or resize cursor+ if (!drag.moved && Math.hypot(e.clientX - drag.x, e.clientY - drag.y) < 4) return;+ if (drag.edit) { drag.moved = true; reshape(drag, onView(e)); return paint(); }if (!drag.moved) closeNote();const a = drag.a, b = onView(e); drag.moved = true;draft = { box: { x: Math.round(Math.min(a.x, b.x)), y: Math.round(Math.min(a.y, b.y)), w: Math.round(Math.abs(b.x - a.x)), h: Math.round(Math.abs(b.y - a.y)) } };@@ -1158,6 +1328,10 @@ try {view.onpointerup = () => {if (!drag) return;const d = drag; drag = null;+ if (d.edit && d.moved) { // the note keeps its number and frame; its picture is drawn again+ images.set(d.m.n, snapshot(d.m)); save(); place();+ return popText.focus({ preventScroll: true });+ }if (d.moved) {const { box } = draft; draft = null;if (box.w < 2 || box.h < 2) return paint();@@ -1168,7 +1342,7 @@ try {if (d.open) return closeNote();select(t, null); addNote({ point: { x: Math.round(d.a.x), y: Math.round(d.a.y) } }); showSelection();};- view.onpointercancel = () => { drag = draft = null; paint(); };+ view.onpointercancel = () => { if (drag?.edit) Object.assign(drag.m, drag.m.box ? { box: drag.from } : { point: drag.from }); drag = draft = null; paint(); };// Escape (unless it just closed a menu) closes the open note, else leaves range marking, else takes the range off. A click on the empty grey// space around the preview closes the note. Notes are only deleted with Hapus.const unrange = () => { if (!range) return; range = null; save(); showSelection(); };