@devskin/browser-sdk 1.0.22 → 1.0.24

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.
@@ -8935,14 +8935,30 @@
8935
8935
  if (this.config.debug) {
8936
8936
  console.log('[DevSkin] Capturing page screenshot...');
8937
8937
  }
8938
- const canvas = yield html2canvas(document.body, {
8938
+ // Scroll to top before capturing
8939
+ const originalScrollY = window.scrollY;
8940
+ window.scrollTo(0, 0);
8941
+ // Wait for scroll to complete
8942
+ yield new Promise(resolve => setTimeout(resolve, 100));
8943
+ // Get full page dimensions
8944
+ const fullWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth);
8945
+ const fullHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
8946
+ const canvas = yield html2canvas(document.documentElement, {
8939
8947
  allowTaint: true,
8940
8948
  useCORS: true,
8941
8949
  logging: false,
8942
8950
  scale: 0.5, // Reduce size
8943
- width: window.innerWidth,
8944
- height: Math.min(document.documentElement.scrollHeight, 3000), // Max 3000px height
8951
+ width: fullWidth,
8952
+ height: fullHeight,
8953
+ windowWidth: fullWidth,
8954
+ windowHeight: fullHeight,
8955
+ scrollY: 0,
8956
+ scrollX: 0,
8957
+ x: 0,
8958
+ y: 0,
8945
8959
  });
8960
+ // Restore scroll position
8961
+ window.scrollTo(0, originalScrollY);
8946
8962
  // Convert to base64 JPEG (smaller than PNG)
8947
8963
  const screenshot = canvas.toDataURL('image/jpeg', 0.6);
8948
8964
  // Send to backend