- handleDrawnFieldPointerDown(event, drawnFieldIndex)
+ handleDrawnFieldPointerDown(
+ event,
+ fileIndex,
+ pageIndex,
+ drawnFieldIndex
+ )
}
onPointerMove={(event) => {
handleDrawnFieldPointerMove(event, drawnField, page.width)
@@ -390,7 +408,7 @@ export const DrawPDFFields = (props: Props) => {
backgroundColor: drawnField.counterpart
? `#${npubToHex(drawnField.counterpart)?.substring(0, 6)}4b`
: undefined,
- borderColor: drawnField.counterpart
+ outlineColor: drawnField.counterpart
? `#${npubToHex(drawnField.counterpart)?.substring(0, 6)}`
: undefined,
left: inPx(from(page.width, drawnField.left)),
@@ -401,14 +419,33 @@ export const DrawPDFFields = (props: Props) => {
touchAction: 'none',
opacity:
mouseState.dragging &&
- activeDrawField === drawnFieldIndex
+ isActiveDrawnField(
+ fileIndex,
+ pageIndex,
+ drawnFieldIndex
+ )
? 0.8
: undefined
}}
>
+
+ {getToolboxLabelByMarkType(drawnField.type) ||
+ 'placeholder'}
+
- handleResizePointerDown(event, drawnFieldIndex)
+ handleResizePointerDown(
+ event,
+ fileIndex,
+ pageIndex,
+ drawnFieldIndex
+ )
}
onPointerMove={(event) => {
handleResizePointerMove(event, drawnField, page.width)
@@ -417,7 +454,11 @@ export const DrawPDFFields = (props: Props) => {
style={{
background:
mouseState.resizing &&
- activeDrawField === drawnFieldIndex
+ isActiveDrawnField(
+ fileIndex,
+ pageIndex,
+ drawnFieldIndex
+ )
? 'var(--primary-main)'
: undefined
}}
@@ -435,56 +476,59 @@ export const DrawPDFFields = (props: Props) => {
>
-
-
- Counterpart
-
+
+
+ )}
)
})}
@@ -513,28 +558,19 @@ export const DrawPDFFields = (props: Props) => {
)
}
- const renderCounterpartValue = (value: string) => {
- const user = users.find((u) => u.pubkey === npubToHex(value))
- if (user) {
- let displayValue = truncate(value, {
- length: 16
- })
+ const renderCounterpartValue = (npub: string) => {
+ let displayValue = _.truncate(npub, { length: 16 })
- const metadata = props.metadata[user.pubkey]
+ const signer = signers.find((u) => u.pubkey === npubToHex(npub))
+ if (signer) {
+ const metadata = props.metadata[signer.pubkey]
+ displayValue = getProfileUsername(npub, metadata)
- if (metadata) {
- displayValue = truncate(
- metadata.name || metadata.display_name || metadata.username || value,
- {
- length: 16
- }
- )
- }
return (
- <>
+