@empiricalrun/test-gen 0.38.8 → 0.38.9

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.38.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 134f282: fix: annotations position after scroll
8
+
3
9
  ## 0.38.8
4
10
 
5
11
  ### Patch Changes
@@ -313,20 +313,18 @@ function annotateClickableElements(options = {}) {
313
313
  var parentElements = [];
314
314
 
315
315
  // Create a hint marker
316
- function createHintMarker(el, hint, parentElement) {
316
+ function createHintMarker(el, hint, parentElement, windowToAnnotate) {
317
317
  const rect = el.getBoundingClientRect();
318
- const parentRect = parentElement.getBoundingClientRect();
319
318
 
320
319
  // Create the marker element
321
320
  const marker = document.createElement("div");
322
321
  marker.textContent = hint;
323
322
  marker.className = markerClass;
324
-
325
323
  // Style the marker
326
324
  Object.assign(marker.style, {
327
325
  position: "absolute",
328
- top: `${rect.top + parentRect.top}px`,
329
- left: `${rect.left + parentRect.left}px`,
326
+ top: `${rect.top + windowToAnnotate.scrollY}px`,
327
+ left: `${rect.left + windowToAnnotate.scrollX}px`,
330
328
  background:
331
329
  "-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(255, 247, 133)), to(rgb(255, 197, 66)))",
332
330
  padding: "1px 3px 0px",
@@ -389,7 +387,7 @@ function annotateClickableElements(options = {}) {
389
387
  const rect = el.getBoundingClientRect();
390
388
 
391
389
  // Use createHintMarker with the specified container
392
- createHintMarker(el, hint, container);
390
+ createHintMarker(el, hint, container, windowToAnnotate);
393
391
  el.style.boxShadow = `inset 0 0 0px 2px red`;
394
392
 
395
393
  // Add element details to the annotations map
@@ -313,20 +313,18 @@ function annotateClickableElements(options = {}) {
313
313
  var parentElements = [];
314
314
 
315
315
  // Create a hint marker
316
- function createHintMarker(el, hint, parentElement) {
316
+ function createHintMarker(el, hint, parentElement, windowToAnnotate) {
317
317
  const rect = el.getBoundingClientRect();
318
- const parentRect = parentElement.getBoundingClientRect();
319
318
 
320
319
  // Create the marker element
321
320
  const marker = document.createElement("div");
322
321
  marker.textContent = hint;
323
322
  marker.className = markerClass;
324
-
325
323
  // Style the marker
326
324
  Object.assign(marker.style, {
327
325
  position: "absolute",
328
- top: `${rect.top + parentRect.top}px`,
329
- left: `${rect.left + parentRect.left}px`,
326
+ top: `${rect.top + windowToAnnotate.scrollY}px`,
327
+ left: `${rect.left + windowToAnnotate.scrollX}px`,
330
328
  background:
331
329
  "-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(255, 247, 133)), to(rgb(255, 197, 66)))",
332
330
  padding: "1px 3px 0px",
@@ -389,7 +387,7 @@ function annotateClickableElements(options = {}) {
389
387
  const rect = el.getBoundingClientRect();
390
388
 
391
389
  // Use createHintMarker with the specified container
392
- createHintMarker(el, hint, container);
390
+ createHintMarker(el, hint, container, windowToAnnotate);
393
391
  el.style.boxShadow = `inset 0 0 0px 2px red`;
394
392
 
395
393
  // Add element details to the annotations map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.38.8",
3
+ "version": "0.38.9",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"