Enhance signature field handling in PDF editor

Added a `FieldClick` parameter to `SenderPdfImageEditor` to handle field click events. Introduced `OnFieldClickAsync` to invoke the `FieldClick` callback. Updated `ReceiverPage.razor` to bind `FieldClick` to `OnSignatureFieldClickAsync`.

Enhanced signature application workflow by tracking applied fields with `_appliedSignatureFieldIndexes` and managing pending fields with `_pendingSignatureFieldIndex`. Added `AllSignatureFieldsApplied` to validate submission readiness. Updated `VisibleFieldOverlays` and `SignedOverlays` to reflect applied fields.

Refactored signature popup logic with `SignaturePopupVisible` for better state management. Improved submission validation to ensure all fields are signed before allowing submission. Various minor adjustments to improve user experience and state handling.
This commit is contained in:
2026-11-24 11:35:15 +01:00
parent 7b5cf30baf
commit e65531db57
2 changed files with 107 additions and 30 deletions

View File

@@ -84,17 +84,18 @@
<div class="sender-image-editor__page-placeholder">@L("SenderEditor_PageLabel", "Seite") @pageNumber</div>
}
@foreach (var field in Fields.Where(f => f.Page == pageNumber))
{
<div class="sender-image-editor__field"
style="@GetFieldStyle(field, widthPt, heightPt)"
title="@field.ReceiverName"
@onmousedown="args => OnFieldMouseDownAsync(args, field)"
@onmousedown:preventDefault="true"
@onclick:stopPropagation="true">
<span class="sender-image-editor__field-label">@field.ReceiverName</span>
@if (ShowFieldRemoveButton)
{
@foreach (var field in Fields.Where(f => f.Page == pageNumber))
{
<div class="sender-image-editor__field"
style="@GetFieldStyle(field, widthPt, heightPt)"
title="@field.ReceiverName"
@onmousedown="args => OnFieldMouseDownAsync(args, field)"
@onmousedown:preventDefault="true"
@onclick="() => OnFieldClickAsync(field.Index)"
@onclick:stopPropagation="true">
<span class="sender-image-editor__field-label">@field.ReceiverName</span>
@if (ShowFieldRemoveButton)
{
<button type="button"
class="sender-image-editor__field-remove"
title='@L("Delete", "Löschen")'
@@ -171,6 +172,9 @@
[Parameter]
public EventCallback<SenderPdfFieldMoveRequest> MoveField { get; set; }
[Parameter]
public EventCallback<int> FieldClick { get; set; }
private int? _draggedFieldIndex;
private bool _isDragging;
private double _grabOffsetXPt;
@@ -303,6 +307,14 @@
_grabOffsetYPt = pointerYPt - field.YPt;
}
private async Task OnFieldClickAsync(int fieldIndex)
{
if (!FieldClick.HasDelegate)
return;
await FieldClick.InvokeAsync(fieldIndex);
}
private async Task OnEditorMouseMoveAsync(MouseEventArgs args)
{
if (_draggedFieldIndex is null || !MoveField.HasDelegate)