diff --git a/apps/documentation/pages/developers/developer-mode/field-coordinates.mdx b/apps/documentation/pages/developers/developer-mode/field-coordinates.mdx index 7489912e6..8f57a127d 100644 --- a/apps/documentation/pages/developers/developer-mode/field-coordinates.mdx +++ b/apps/documentation/pages/developers/developer-mode/field-coordinates.mdx @@ -5,14 +5,22 @@ description: Learn how to get the coordinates of a field in a document. ## Field Coordinates -Field coordinates represent the position of a field in a document. They are returned in the `pageX` and `pageY` properties of the field. +Field coordinates represent the position of a field in a document. They are returned in the `pageX`, `pageY`, `width` and `height` properties of the field. To enable field coordinates, you can use the `devmode` query parameter. ```bash -https://app.documenso.com/documents//edit?devmode=true +# Legacy editor + +https://app.documenso.com/t//documents//legacy_editor?devmode=true ``` -You should then see the coordinates on top of each field. +![Field Coordinates Legacy Editor](/developer-mode/field-coordinates-legacy-editor.webp) -![Field Coordinates](/developer-mode/field-coordinates.webp) +```bash +# New editor + +https://app.documenso.com/t//documents//edit?step=addFields&devmode=true +``` + +![Field Coordinates New Editor](/developer-mode/field-coordinates-new-editor.webp) diff --git a/apps/documentation/public/developer-mode/field-coordinates-legacy-editor.webp b/apps/documentation/public/developer-mode/field-coordinates-legacy-editor.webp new file mode 100644 index 000000000..7cf99a3b9 Binary files /dev/null and b/apps/documentation/public/developer-mode/field-coordinates-legacy-editor.webp differ diff --git a/apps/documentation/public/developer-mode/field-coordinates-new-editor.webp b/apps/documentation/public/developer-mode/field-coordinates-new-editor.webp new file mode 100644 index 000000000..ea6980da2 Binary files /dev/null and b/apps/documentation/public/developer-mode/field-coordinates-new-editor.webp differ diff --git a/apps/documentation/public/developer-mode/field-coordinates.webp b/apps/documentation/public/developer-mode/field-coordinates.webp deleted file mode 100644 index 2089e8b15..000000000 Binary files a/apps/documentation/public/developer-mode/field-coordinates.webp and /dev/null differ diff --git a/packages/ui/primitives/document-flow/field-item.tsx b/packages/ui/primitives/document-flow/field-item.tsx index 40c2684da..7d4b28111 100644 --- a/packages/ui/primitives/document-flow/field-item.tsx +++ b/packages/ui/primitives/document-flow/field-item.tsx @@ -269,8 +269,8 @@ export const FieldItem = ({ className={cn( 'absolute -top-16 left-0 right-0 rounded-md p-2 text-center text-xs text-gray-700', { - 'bg-foreground/5 border-primary border': !fieldHasCheckedValues, - 'bg-documenso-200 border-primary border': fieldHasCheckedValues, + 'border border-primary bg-foreground/5': !fieldHasCheckedValues, + 'border border-primary bg-documenso-200': fieldHasCheckedValues, }, )} > @@ -321,8 +321,25 @@ export const FieldItem = ({ {isDevMode && ( -
- {`x: ${field.pageX.toFixed(2)}, y: ${field.pageY.toFixed(2)}`} +
+
+ + Pos X:  + {field.pageX.toFixed(2)} + + + Pos Y:  + {field.pageY.toFixed(2)} + + + Width:  + {field.pageWidth.toFixed(2)} + + + Height:  + {field.pageHeight.toFixed(2)} + +
)}