gpucanvas 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -55,16 +55,14 @@ later. Thirty agent cursors build the first view, then the camera pulls out to a
55
55
  - Press `b` to run the benchmark tour, `f` to fit every screen in view, `t` to switch the theme.
56
56
  - On a phone: pinch to zoom, drag to pan, tap to use a screen.
57
57
 
58
- The GPU path needs HTML-in-Canvas, which is behind a flag:
58
+ The GPU path needs WebGPU and HTML-in-Canvas. Chrome 157 and later on a computer has both on by
59
+ default, so the demo opens on the GPU path. On older Chrome or other Chromium builds, turn it on
60
+ with `chrome://flags/#canvas-draw-element` and relaunch.
59
61
 
60
- 1. Open `chrome://flags/#canvas-draw-element`
61
- 2. Set it to Enabled and relaunch Chrome
62
- 3. Reload the demo
63
-
64
- Without the flag the demo runs the DOM fallback with 1,000 screens and says so. Phones start
65
- smaller so the tab is not killed for memory: 1,000 screens on the GPU path (Chrome on Android with
66
- the flag) and 250 as DOM. iPhone and iPad browsers have no HTML-in-Canvas yet, so they run the DOM
67
- version and say so.
62
+ Without HTML-in-Canvas the demo runs the DOM fallback with 1,000 screens and says so. Phones start
63
+ smaller so the tab is not killed for memory: 1,000 screens on the GPU path and 250 as DOM. Firefox,
64
+ Safari and every iPhone or iPad browser have no HTML-in-Canvas yet, so they run the DOM version and
65
+ say so.
68
66
 
69
67
  Status: early (0.4). The API can still change.
70
68
 
@@ -338,8 +336,8 @@ to npm from GitHub Actions, with provenance, through npm trusted publishing. See
338
336
  6. **Live updates.** A MutationObserver marks a node dirty when its content changes, and
339
337
  loading images, web fonts and CSS transitions trigger a redraw. Animated content on nodes
340
338
  under 200 screen pixels refreshes at most four times a second.
341
- 7. **Input.** Only the page under the pointer is registered for hit testing, and a CSS transform
342
- puts the node under the pointer exactly where the GPU drew it. Clicks, typing, selection and
339
+ 7. **Input.** Only the page under the pointer is registered for hit testing, and its canvas
340
+ transform puts the node under the pointer exactly where the GPU drew it. Clicks, typing, selection and
343
341
  hover all go to the real element. A focused node keeps its page live. Touch has no hover, so a
344
342
  tap makes the node under the finger live and hands the click to the element it landed on. A
345
343
  two-finger pinch zooms and pans the camera wherever the fingers land.
@@ -378,11 +376,11 @@ so a gap of a few percent, like frost above none, is noise rather than a speedup
378
376
  ## Chrome 157 findings (differ from the WICG explainer)
379
377
 
380
378
  - **Hit-test registration.** A drawable is hit-tested only after
381
- `canvas.updateElementGeometry(el, {})` registers it. The `canvasTransform` option does not
382
- move the hit area.
383
- - **Hit-test position.** The hit area is the element's CSS box, so position it with
384
- `el.style.transform = canvas.getElementTransform(el, drawMatrix)`. The draw matrix maps the
385
- element's default-size snapshot (CSS px × DPR) to canvas pixels.
379
+ `canvas.updateElementGeometry(el, options)` registers it.
380
+ - **Hit-test position.** Chrome 157 hit tests at `options.canvasTransform`, a matrix in CSS
381
+ pixels from the element's border box to the canvas, and `getElementTransform(el)` returns it.
382
+ Chrome 156 ignored `canvasTransform` and hit tested at the CSS box, positioned with
383
+ `el.style.transform = canvas.getElementTransform(el, drawMatrix)`. gpucanvas handles both.
386
384
  - **Transform changes.** Changing a drawable's CSS transform or pointer-events reports it in
387
385
  `changedElements`.
388
386
  - **Newly drawable elements.** An element that just became drawable is not reported in