@canvas-harness/core 0.1.21 → 0.1.23

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/dist/index.cjs CHANGED
@@ -4777,10 +4777,12 @@ var cacheReuseLayout = (cache5, view) => {
4777
4777
  const cacheW = cache5.widthDevicePx;
4778
4778
  const cacheH = cache5.heightDevicePx;
4779
4779
  const marginDev = cache5.marginCssPx * cache5.dpr;
4780
- const destW = cacheW * ratio;
4781
- const destH = cacheH * ratio;
4782
- const destX = (cache5.camX - view.camX) * view.camZ * cache5.dpr + marginDev * (1 - ratio);
4783
- const destY = (cache5.camY - view.camY) * view.camZ * cache5.dpr + marginDev * (1 - ratio);
4780
+ const rawDestX = (cache5.camX - view.camX) * view.camZ * cache5.dpr + marginDev * (1 - ratio);
4781
+ const rawDestY = (cache5.camY - view.camY) * view.camZ * cache5.dpr + marginDev * (1 - ratio);
4782
+ const destX = Math.round(rawDestX);
4783
+ const destY = Math.round(rawDestY);
4784
+ const destW = Math.round(rawDestX + cacheW * ratio) - destX;
4785
+ const destH = Math.round(rawDestY + cacheH * ratio) - destY;
4784
4786
  const dest = { x: destX, y: destY, w: destW, h: destH };
4785
4787
  const strips = {
4786
4788
  top: { x: 0, y: 0, w: cacheW, h: Math.max(0, destY) },
@@ -4949,6 +4951,8 @@ var createRenderer = (opts) => {
4949
4951
  paintBackground(surface.ctx, { viewport, zoom: camera.z, background });
4950
4952
  const visible = visibleNodes(camera, viewport);
4951
4953
  const isMoving2 = isMoving(interaction);
4954
+ const viewMotion = interaction.mode === "panning" || interaction.mode === "zooming" || interaction.mode === "marqueeing";
4955
+ const isStripRender = !fullRender;
4952
4956
  const minOnScreen = MIN_ON_SCREEN_SIZE_PX;
4953
4957
  const nextOverlaySet = /* @__PURE__ */ new Set();
4954
4958
  let drawn = 0;
@@ -5037,7 +5041,7 @@ var createRenderer = (opts) => {
5037
5041
  if (!def) continue;
5038
5042
  if (node.w * camera.z < minOnScreen && node.h * camera.z < minOnScreen) continue;
5039
5043
  if (camera.z < def.lod.minZoomForPlaceholder) continue;
5040
- const preferCanvas = camera.z < def.lod.minZoomForReact || isMoving2;
5044
+ const preferCanvas = camera.z < def.lod.minZoomForReact || viewMotion && isStripRender && !overlaySet.has(node.id);
5041
5045
  if (preferCanvas) {
5042
5046
  if (paintCustomCanvasFallback(surface.ctx, node, def, scale, renderEnv)) {
5043
5047
  drawn++;