@diegotsi/flint-react 0.3.5 → 0.4.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/dist/index.js CHANGED
@@ -7879,23 +7879,33 @@ function ScreenAnnotator({ zIndex: zIndex2, onCapture, onCancel }) {
7879
7879
  );
7880
7880
  const unpatch = patchGetComputedStyle();
7881
7881
  try {
7882
- const canvas = await html2canvas_esm_default(document.body, {
7882
+ const fullCanvas = await html2canvas_esm_default(document.body, {
7883
7883
  useCORS: true,
7884
7884
  logging: false,
7885
7885
  allowTaint: true,
7886
7886
  scale: dpr,
7887
- x: sx,
7888
- y: sy,
7889
- width: vw,
7890
- height: vh,
7891
- windowWidth: vw,
7892
- windowHeight: vh,
7893
7887
  scrollX: -sx,
7894
7888
  scrollY: -sy,
7895
7889
  ignoreElements: (el) => el === overlayRef.current
7896
7890
  });
7897
7891
  unpatch();
7892
+ const canvas = document.createElement("canvas");
7893
+ canvas.width = vw * dpr;
7894
+ canvas.height = vh * dpr;
7898
7895
  const ctx = canvas.getContext("2d");
7896
+ ctx.drawImage(
7897
+ fullCanvas,
7898
+ sx * dpr,
7899
+ sy * dpr,
7900
+ vw * dpr,
7901
+ vh * dpr,
7902
+ // source: viewport region from full capture
7903
+ 0,
7904
+ 0,
7905
+ vw * dpr,
7906
+ vh * dpr
7907
+ // dest: fill the cropped canvas
7908
+ );
7899
7909
  ctx.fillStyle = "rgba(255,200,0,0.25)";
7900
7910
  ctx.fillRect(finalRect.x * dpr, finalRect.y * dpr, finalRect.w * dpr, finalRect.h * dpr);
7901
7911
  ctx.strokeStyle = "#f97316";
@@ -8387,7 +8397,7 @@ function FlintModal({
8387
8397
  onCancel: () => setAnnotating(false)
8388
8398
  }
8389
8399
  ),
8390
- /* @__PURE__ */ jsx2("div", { ref: overlayRef, style: { ...overlayStyle, opacity: annotating ? 0 : 1, pointerEvents: annotating ? "none" : "auto" }, onClick: handleOverlayClick, children: /* @__PURE__ */ jsxs2("div", { style: modalStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "flint-modal-title", children: [
8400
+ !annotating && /* @__PURE__ */ jsx2("div", { ref: overlayRef, style: overlayStyle, onClick: handleOverlayClick, children: /* @__PURE__ */ jsxs2("div", { style: modalStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "flint-modal-title", children: [
8391
8401
  /* @__PURE__ */ jsx2(
8392
8402
  ModalHeader,
8393
8403
  {