Improve zoom control granularity and behavior
Updated the zoom slider in `EnvelopeViewer.razor` to allow finer adjustments by changing the step size from 25 to 1. Modified `pdf-viewer.js` to enable smoother zooming with 1% increments for `zoomIn` and `zoomOut` methods. Capped zoom levels between 0.5 and 3.0. Enhanced mouse wheel zoom behavior to adjust zoom in 1% steps and notify the .NET side of changes via `OnZoomChanged`. Ensured pages are re-rendered after each zoom adjustment.
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
</svg>
|
||||
</button>
|
||||
<div class="pdf-toolbar__zoom-slider-container">
|
||||
<input type="range" class="pdf-toolbar__zoom-slider" min="50" max="300" step="25" value="@_currentZoom" @oninput="OnZoomSliderChanged" title="@(_currentZoom)%" />
|
||||
<input type="range" class="pdf-toolbar__zoom-slider" min="50" max="300" step="1" value="@_currentZoom" @oninput="OnZoomSliderChanged" title="@(_currentZoom)%" />
|
||||
<div class="pdf-toolbar__zoom-label">@(_currentZoom)%</div>
|
||||
</div>
|
||||
<button class="pdf-toolbar__btn" @onclick="ZoomIn" disabled="@(_currentZoom >= 300)" title="Vergrößern">
|
||||
|
||||
@@ -70,14 +70,16 @@ window.pdfViewer = {
|
||||
e.preventDefault();
|
||||
|
||||
if (e.deltaY < 0) {
|
||||
// Scroll up = Zoom In
|
||||
this.zoomIn();
|
||||
// Scroll up = Zoom In (1% ad?m)
|
||||
this.scale = Math.min(this.scale + 0.01, 3.0);
|
||||
this.queueRenderPage(this.pageNum);
|
||||
if (this.dotNetReference) {
|
||||
this.dotNetReference.invokeMethodAsync('OnZoomChanged', this.scale);
|
||||
}
|
||||
} else {
|
||||
// Scroll down = Zoom Out
|
||||
this.zoomOut();
|
||||
// Scroll down = Zoom Out (1% ad?m)
|
||||
this.scale = Math.max(this.scale - 0.01, 0.5);
|
||||
this.queueRenderPage(this.pageNum);
|
||||
if (this.dotNetReference) {
|
||||
this.dotNetReference.invokeMethodAsync('OnZoomChanged', this.scale);
|
||||
}
|
||||
@@ -220,15 +222,15 @@ window.pdfViewer = {
|
||||
},
|
||||
|
||||
zoomIn() {
|
||||
this.scale += 0.25;
|
||||
// 1% art??
|
||||
this.scale = Math.min(this.scale + 0.01, 3.0);
|
||||
this.queueRenderPage(this.pageNum);
|
||||
},
|
||||
|
||||
zoomOut() {
|
||||
if (this.scale > 0.5) {
|
||||
this.scale -= 0.25;
|
||||
this.queueRenderPage(this.pageNum);
|
||||
}
|
||||
// 1% azal??
|
||||
this.scale = Math.max(this.scale - 0.01, 0.5);
|
||||
this.queueRenderPage(this.pageNum);
|
||||
},
|
||||
|
||||
setScale(scale) {
|
||||
|
||||
Reference in New Issue
Block a user