Enable infinite signature navigation and improve button logic
Updated the `disabled` attribute logic in `EnvelopeViewer.razor` to ensure navigation buttons are always active when signatures exist. Modified `pdf-viewer.js` to enable infinite looping for signature navigation, allowing users to cycle between the first and last signatures seamlessly. Adjusted `canGoPrev` and `canGoNext` properties to depend on the total number of signatures, ensuring navigation is always enabled when signatures are present.
This commit is contained in:
@@ -119,7 +119,7 @@
|
|||||||
<div class="pdf-toolbar__section pdf-toolbar__signature-nav">
|
<div class="pdf-toolbar__section pdf-toolbar__signature-nav">
|
||||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-nav"
|
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-nav"
|
||||||
@onclick="GoToPreviousSignature"
|
@onclick="GoToPreviousSignature"
|
||||||
disabled="@(_signedSignatures == 0)"
|
disabled="@(_totalSignatures == 0)"
|
||||||
title="Vorherige Unterschrift">
|
title="Vorherige Unterschrift">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
|
<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-nav"
|
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-nav"
|
||||||
@onclick="GoToNextSignature"
|
@onclick="GoToNextSignature"
|
||||||
disabled="@(_unsignedSignatures == 0)"
|
disabled="@(_totalSignatures == 0)"
|
||||||
title="Nächste Unterschrift">
|
title="Nächste Unterschrift">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
|
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
|
||||||
|
|||||||
@@ -509,9 +509,9 @@ window.pdfViewer = {
|
|||||||
total: total,
|
total: total,
|
||||||
signed: signed,
|
signed: signed,
|
||||||
unsigned: unsigned,
|
unsigned: unsigned,
|
||||||
currentIndex: signed, // Sonraki imzan?n index'i
|
currentIndex: signed,
|
||||||
canGoPrev: signed > 0, // En az 1 imza uygulanm?? m??
|
canGoPrev: total > 0, // Her zaman aktif (e?er imza varsa)
|
||||||
canGoNext: unsigned > 0 // Hala imzalanmam?? var m??
|
canGoNext: total > 0 // Her zaman aktif (e?er imza varsa)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -533,9 +533,11 @@ window.pdfViewer = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bir sonraki imzay? al (imzalanm?? olup olmad???na bakmadan)
|
// Bir sonraki imzay? al (imzalanm?? olup olmad???na bakmadan)
|
||||||
const nextIndex = currentIndex + 1;
|
let nextIndex = currentIndex + 1;
|
||||||
|
|
||||||
|
// Sonsuz döngü: Son imzadaysa ilk imzaya dön
|
||||||
if (nextIndex >= this._allSignatures.length) {
|
if (nextIndex >= this._allSignatures.length) {
|
||||||
return false; // Son imzaday?z
|
nextIndex = 0; // ?lk imzaya dön
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextSignature = this._allSignatures[nextIndex];
|
const nextSignature = this._allSignatures[nextIndex];
|
||||||
@@ -608,9 +610,11 @@ window.pdfViewer = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bir önceki imzay? al
|
// Bir önceki imzay? al
|
||||||
const prevIndex = currentIndex - 1;
|
let prevIndex = currentIndex - 1;
|
||||||
|
|
||||||
|
// Sonsuz döngü: ?lk imzadaysa son imzaya git
|
||||||
if (prevIndex < 0) {
|
if (prevIndex < 0) {
|
||||||
return false; // ?lk imzaday?z
|
prevIndex = this._allSignatures.length - 1; // Son imzaya git
|
||||||
}
|
}
|
||||||
|
|
||||||
const prevSignature = this._allSignatures[prevIndex];
|
const prevSignature = this._allSignatures[prevIndex];
|
||||||
|
|||||||
Reference in New Issue
Block a user