@diegotsi/flint-react 0.3.5 → 0.4.1

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
@@ -7907,23 +7907,33 @@ function ScreenAnnotator({ zIndex: zIndex2, onCapture, onCancel }) {
7907
7907
  );
7908
7908
  const unpatch = patchGetComputedStyle();
7909
7909
  try {
7910
- const canvas = await html2canvas_esm_default(document.body, {
7910
+ const fullCanvas = await html2canvas_esm_default(document.body, {
7911
7911
  useCORS: true,
7912
7912
  logging: false,
7913
7913
  allowTaint: true,
7914
7914
  scale: dpr,
7915
- x: sx,
7916
- y: sy,
7917
- width: vw,
7918
- height: vh,
7919
- windowWidth: vw,
7920
- windowHeight: vh,
7921
- scrollX: -sx,
7922
- scrollY: -sy,
7915
+ scrollX: 0,
7916
+ scrollY: 0,
7923
7917
  ignoreElements: (el) => el === overlayRef.current
7924
7918
  });
7925
7919
  unpatch();
7920
+ const canvas = document.createElement("canvas");
7921
+ canvas.width = vw * dpr;
7922
+ canvas.height = vh * dpr;
7926
7923
  const ctx = canvas.getContext("2d");
7924
+ ctx.drawImage(
7925
+ fullCanvas,
7926
+ sx * dpr,
7927
+ sy * dpr,
7928
+ vw * dpr,
7929
+ vh * dpr,
7930
+ // source: viewport region from full capture
7931
+ 0,
7932
+ 0,
7933
+ vw * dpr,
7934
+ vh * dpr
7935
+ // dest: fill the cropped canvas
7936
+ );
7927
7937
  ctx.fillStyle = "rgba(255,200,0,0.25)";
7928
7938
  ctx.fillRect(finalRect.x * dpr, finalRect.y * dpr, finalRect.w * dpr, finalRect.h * dpr);
7929
7939
  ctx.strokeStyle = "#f97316";
@@ -8415,7 +8425,7 @@ function FlintModal({
8415
8425
  onCancel: () => setAnnotating(false)
8416
8426
  }
8417
8427
  ),
8418
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: overlayRef, style: { ...overlayStyle, opacity: annotating ? 0 : 1, pointerEvents: annotating ? "none" : "auto" }, onClick: handleOverlayClick, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: modalStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "flint-modal-title", children: [
8428
+ !annotating && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: overlayRef, style: overlayStyle, onClick: handleOverlayClick, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: modalStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "flint-modal-title", children: [
8419
8429
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
8420
8430
  ModalHeader,
8421
8431
  {