Improve signature navigation logic and comments
Updated `getSignatureNavState`, `goToNextSignature`, and `goToPreviousSignature` methods to enhance code readability by improving comments and clarifying logic. Fixed a minor bug in `goToPreviousSignature` where the wrong variable (`lastSig`) was used for page navigation, replacing it with the correct variable (`prevSignature`). Ensured `_lastViewedSignatureId` is updated correctly in navigation methods. No significant functional changes were introduced.
This commit is contained in:
@@ -488,7 +488,7 @@ window.pdfViewer = {
|
||||
* @returns {object} { total, signed, unsigned, currentIndex, canGoPrev, canGoNext }
|
||||
*/
|
||||
getSignatureNavState() {
|
||||
// Global imza listesi yoksa bo? state dön
|
||||
// Global imza listesi yoksa bo? state d<EFBFBD>n
|
||||
if (!this._allSignatures || this._allSignatures.length === 0) {
|
||||
return {
|
||||
total: 0,
|
||||
@@ -500,7 +500,7 @@ window.pdfViewer = {
|
||||
};
|
||||
}
|
||||
|
||||
// TÜM sayfalardaki imzalar? say (database'den gelen global liste)
|
||||
// T<EFBFBD>M sayfalardaki imzalar? say (database'den gelen global liste)
|
||||
const total = this._allSignatures.length; // Global: Toplam imza say?s?
|
||||
const signed = this.appliedSignatures.length; // ?mzalananlar
|
||||
const unsigned = total - signed; // Hesaplanan: ?mzalanmayanlar
|
||||
@@ -521,12 +521,12 @@ window.pdfViewer = {
|
||||
* Cross-page navigation: searches ALL pages for next unsigned signature.
|
||||
*/
|
||||
async goToNextSignature(dotNetRef) {
|
||||
// Global imza listesi yoksa ç?k
|
||||
// Global imza listesi yoksa <EFBFBD>?k
|
||||
if (!this._allSignatures || this._allSignatures.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mevcut görüntülenen imzan?n index'ini bul
|
||||
// Mevcut g<EFBFBD>r<EFBFBD>nt<EFBFBD>lenen imzan?n index'ini bul
|
||||
let currentIndex = -1;
|
||||
if (this._lastViewedSignatureId) {
|
||||
currentIndex = this._allSignatures.findIndex(s => s.id === this._lastViewedSignatureId);
|
||||
@@ -535,9 +535,9 @@ window.pdfViewer = {
|
||||
// Bir sonraki imzay? al (imzalanm?? olup olmad???na bakmadan)
|
||||
let nextIndex = currentIndex + 1;
|
||||
|
||||
// Sonsuz döngü: Son imzadaysa ilk imzaya dön
|
||||
// Sonsuz d<EFBFBD>ng<EFBFBD>: Son imzadaysa ilk imzaya d<EFBFBD>n
|
||||
if (nextIndex >= this._allSignatures.length) {
|
||||
nextIndex = 0; // ?lk imzaya dön
|
||||
nextIndex = 0; // ?lk imzaya d<EFBFBD>n
|
||||
}
|
||||
|
||||
const nextSignature = this._allSignatures[nextIndex];
|
||||
@@ -564,7 +564,7 @@ window.pdfViewer = {
|
||||
await new Promise(resolve => setTimeout(resolve, 150));
|
||||
}
|
||||
|
||||
// Son görüntülenen imzay? kaydet
|
||||
// Son g<EFBFBD>r<EFBFBD>nt<EFBFBD>lenen imzay? kaydet
|
||||
this._lastViewedSignatureId = nextSignature.id;
|
||||
|
||||
// ?mza imzalanm?? m? kontrol et
|
||||
@@ -586,7 +586,7 @@ window.pdfViewer = {
|
||||
}
|
||||
}
|
||||
|
||||
// Counter'? güncelle (Blazor'a bildir)
|
||||
// Counter'? g<EFBFBD>ncelle (Blazor'a bildir)
|
||||
if (dotNetRef) {
|
||||
dotNetRef.invokeMethodAsync('OnSignatureNavChanged');
|
||||
}
|
||||
@@ -603,16 +603,16 @@ window.pdfViewer = {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mevcut görüntülenen imzan?n index'ini bul
|
||||
// Mevcut g<EFBFBD>r<EFBFBD>nt<EFBFBD>lenen imzan?n index'ini bul
|
||||
let currentIndex = this._allSignatures.length; // Varsay?lan: son imzadan sonra
|
||||
if (this._lastViewedSignatureId) {
|
||||
currentIndex = this._allSignatures.findIndex(s => s.id === this._lastViewedSignatureId);
|
||||
}
|
||||
|
||||
// Bir önceki imzay? al
|
||||
// Bir <EFBFBD>nceki imzay? al
|
||||
let prevIndex = currentIndex - 1;
|
||||
|
||||
// Sonsuz döngü: ?lk imzadaysa son imzaya git
|
||||
// Sonsuz d<EFBFBD>ng<EFBFBD>: ?lk imzadaysa son imzaya git
|
||||
if (prevIndex < 0) {
|
||||
prevIndex = this._allSignatures.length - 1; // Son imzaya git
|
||||
}
|
||||
@@ -620,9 +620,9 @@ window.pdfViewer = {
|
||||
const prevSignature = this._allSignatures[prevIndex];
|
||||
|
||||
// Change page if needed
|
||||
if (lastSig.page !== this.pageNum) {
|
||||
if (prevSignature.page !== this.pageNum) {
|
||||
// Sayfa de?i?tir
|
||||
this.pageNum = lastSig.page;
|
||||
this.pageNum = prevSignature.page;
|
||||
this.queueRenderPage(this.pageNum);
|
||||
|
||||
// Render tamamlanana kadar bekle
|
||||
@@ -632,16 +632,16 @@ window.pdfViewer = {
|
||||
waitCount++;
|
||||
}
|
||||
|
||||
// Blazor'a haber ver - signature butonlar?n? yeniden çiz
|
||||
// Blazor'a haber ver - signature butonlar?n? yeniden <EFBFBD>iz
|
||||
if (dotNetRef) {
|
||||
await dotNetRef.invokeMethodAsync('OnPageChangedBySignatureNav', this.pageNum);
|
||||
}
|
||||
|
||||
// DOM güncellenmesini bekle
|
||||
// DOM g<EFBFBD>ncellenmesini bekle
|
||||
await new Promise(resolve => setTimeout(resolve, 150));
|
||||
}
|
||||
|
||||
// Son görüntülenen imzay? kaydet
|
||||
// Son g<EFBFBD>r<EFBFBD>nt<EFBFBD>lenen imzay? kaydet
|
||||
this._lastViewedSignatureId = prevSignature.id;
|
||||
|
||||
// ?mza imzalanm?? m? kontrol et
|
||||
@@ -1016,3 +1016,4 @@ window.pdfViewer = {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user