Make ZoomPercent a public parameter in SenderPdfEditor

Refactored the `ZoomPercent` property in `SenderPdfImageEditor.razor` to be a public parameter, enabling external control of the zoom level. Removed the private `_zoomPercent` field and updated all references to use the new parameter.

Updated the `SetZoomPercent` method to modify the `ZoomPercent` parameter. Adjusted `SenderPdfImageEditorToolbar` to accept `ZoomPercent` as a parameter.

In `CreateEnvelopeWizardPopup.razor`, added the `ZoomPercent` parameter to the `SenderPdfImageEditor` component with a default value of `100`.
This commit is contained in:
2026-11-30 15:45:19 +01:00
parent eae1f7baa8
commit d82d0f4a66
2 changed files with 10 additions and 7 deletions

View File

@@ -12,7 +12,7 @@
<div class="sender-image-editor__toolbar-host">
<SenderPdfImageEditorToolbar CurrentPage="@_currentPage"
TotalPages="@PageCount"
ZoomPercent="@_zoomPercent"
ZoomPercent="@ZoomPercent"
MinZoomPercent="@MinZoomPercent"
MaxZoomPercent="@MaxZoomPercent"
ZoomStepPercent="@ZoomStepPercent"
@@ -195,7 +195,9 @@
private double _grabOffsetXPt;
private double _grabOffsetYPt;
private int _currentPage = 1;
private int _zoomPercent = 180;
[Parameter]
public int ZoomPercent { get; set; } = 180;
private bool _zoomOverrideInitialized;
private bool _isDownloading;
private bool _isPrinting;
@@ -268,7 +270,7 @@
private string GetZoomStyle()
{
var factor = (_zoomPercent / 100.0).ToString("F4", CultureInfo.InvariantCulture);
var factor = (ZoomPercent / 100.0).ToString("F4", CultureInfo.InvariantCulture);
return $"--sender-editor-zoom:{factor};";
}
@@ -456,13 +458,13 @@
private async Task OnZoomOutAsync()
{
SetZoomPercent(_zoomPercent - ZoomStepPercent);
SetZoomPercent(ZoomPercent - ZoomStepPercent);
await InvokeAsync(StateHasChanged);
}
private async Task OnZoomInAsync()
{
SetZoomPercent(_zoomPercent + ZoomStepPercent);
SetZoomPercent(ZoomPercent + ZoomStepPercent);
await InvokeAsync(StateHasChanged);
}
@@ -495,7 +497,7 @@
private void SetZoomPercent(int value)
{
_zoomPercent = Math.Max(MinZoomPercent, Math.Min(value, MaxZoomPercent));
ZoomPercent = Math.Max(MinZoomPercent, Math.Min(value, MaxZoomPercent));
}
private async Task OnDownloadPdfAsync()

View File

@@ -411,7 +411,8 @@
SignatureOverlays="Array.Empty<SenderPdfSignatureOverlay>()"
ShowFieldRemoveButton="false"
ShowToolbar="false"
EnableWheelZoom="false" />
EnableWheelZoom="false"
ZoomPercent="100"/>
</div>
}
</aside>