Improve upload panel resizing performance

Refactored the upload panel resizing logic in `CreateEnvelopeWizardPopup` to reduce .NET interop calls and improve responsiveness.

- Added a `@ref` attribute and `_bodyLayoutRef` field to reference the upload panel layout element.
- Updated `startWizardUploadPanelResize` in `envelope-editor.js` to accept and use a `hostEl` parameter for direct DOM manipulation.
- Removed `OnUploadPanelResizeMove` from `CreateEnvelopeWizardPopup.razor` as it is no longer needed.
- Updated `OnUploadPanelResizeEnd` to handle the final width passed from JavaScript.
- Modified `stopWizardUploadPanelResize` to include the final width when invoking the .NET method.
- Cleaned up unused references and state properties in `envelope-editor.js`.

These changes reduce latency during resizing and ensure the application state remains consistent.
This commit is contained in:
2026-11-30 13:55:40 +01:00
parent 4653670b2c
commit af24bb61ee
2 changed files with 18 additions and 24 deletions

View File

@@ -36,7 +36,8 @@
tabindex="0"
@onkeydown="OnWizardKeyDownAsync">
<div class="sender-create-wizard__body-layout @(_isUploadPanelResizing ? "sender-create-wizard__body-layout--resizing" : string.Empty)"
style="@($"--sender-upload-panel-width: {_uploadPanelWidthPx}px;")">
style="@($"--sender-upload-panel-width: {_uploadPanelWidthPx}px;")"
@ref="_bodyLayoutRef">
<MudPaper Class="sender-create-wizard__stepper-shell" Elevation="0">
<MudStepper Vertical="true"
NonLinear="false"
@@ -538,6 +539,7 @@
private bool _isUploadPanelResizing;
private double _uploadPanelResizeStartX;
private double _uploadPanelResizeStartWidthPx;
private ElementReference _bodyLayoutRef;
private DotNetObjectReference<CreateEnvelopeWizardPopup>? _resizeDotNetRef;
private string? _validationMessage;
@@ -796,24 +798,16 @@
_uploadPanelResizeStartWidthPx,
UploadPanelMinWidthPx,
UploadPanelMaxWidthPx,
_resizeDotNetRef);
_resizeDotNetRef,
_bodyLayoutRef);
await InvokeAsync(StateHasChanged);
}
[JSInvokable]
public Task OnUploadPanelResizeMove(double widthPx)
public Task OnUploadPanelResizeEnd(double widthPx)
{
if (!_isUploadPanelResizing)
return Task.CompletedTask;
_uploadPanelWidthPx = Math.Clamp(widthPx, UploadPanelMinWidthPx, UploadPanelMaxWidthPx);
return InvokeAsync(StateHasChanged);
}
[JSInvokable]
public Task OnUploadPanelResizeEnd()
{
_isUploadPanelResizing = false;
return InvokeAsync(StateHasChanged);
}