@zumer/snapdom-plugins 4.2.1 → 4.3.0
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/stream/src/stream.js +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Plugin changes
|
|
2
2
|
|
|
3
|
+
## 4.3.0
|
|
4
|
+
|
|
5
|
+
> 25 October 2026
|
|
6
|
+
|
|
7
|
+
**Fixes**
|
|
8
|
+
|
|
9
|
+
- **stream:** report only dirty rects inside the canvas [`f9302d4`](https://github.com/zumerlab/snapdom/commit/f9302d4bd8b76f4dcab81c83314778cf9074b2a3)
|
|
10
|
+
|
|
3
11
|
## 4.2.1
|
|
4
12
|
|
|
5
13
|
- Fix the stream plugin: a box cut by an ancestor with overflow hidden was painted whole. Patches now stay inside every clipping ancestor.
|
package/package.json
CHANGED
package/stream/src/stream.js
CHANGED
|
@@ -342,18 +342,26 @@ export function stream(element, options = {}) {
|
|
|
342
342
|
// demos/stream-webgl.html: 11.9 ms one after another.
|
|
343
343
|
const layers = await Promise.all(hosts.map(renderPatch))
|
|
344
344
|
const out = []
|
|
345
|
+
// The canvas clips draws past its edge; a reported rect must be clipped too, or a box
|
|
346
|
+
// sliding off the stage (the lower third hides to left:-720px) hands texSubImage2D a
|
|
347
|
+
// negative offset and the upload is rejected. Pinned by __tests__/plugin.stream.test.js.
|
|
348
|
+
const report = (x, y, w, h) => {
|
|
349
|
+
const x0 = Math.max(0, x), y0 = Math.max(0, y)
|
|
350
|
+
const x1 = Math.min(canvas.width, x + w), y1 = Math.min(canvas.height, y + h)
|
|
351
|
+
if (x1 > x0 && y1 > y0) out.push({ x: x0, y: y0, width: x1 - x0, height: y1 - y0 })
|
|
352
|
+
}
|
|
345
353
|
for (const [host, old] of movedFrom) {
|
|
346
354
|
const r = pixelRect(old)
|
|
347
355
|
const x = Math.round(ox + r.left * k), y = Math.round(oy + r.top * k)
|
|
348
356
|
const w = Math.round(ox + r.right * k) - x, h = Math.round(oy + r.bottom * k) - y
|
|
349
357
|
paintBackdrop(backdrops.get(host), x, y, w, h)
|
|
350
|
-
|
|
358
|
+
report(x, y, w, h)
|
|
351
359
|
}
|
|
352
360
|
for (const { layer, x, y, w, h, backdrop } of layers) {
|
|
353
361
|
// A backdrop layer is the full frame's pixels for its whole rect: replace, not blend.
|
|
354
362
|
if (backdrop) ctx.clearRect(x, y, w, h)
|
|
355
363
|
ctx.drawImage(layer, x, y)
|
|
356
|
-
|
|
364
|
+
report(x, y, w, h)
|
|
357
365
|
}
|
|
358
366
|
movedFrom.clear()
|
|
359
367
|
// Remember where each host was drawn, not where it is now: a sliding box kept moving
|