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 }
|
* @returns {object} { total, signed, unsigned, currentIndex, canGoPrev, canGoNext }
|
||||||
*/
|
*/
|
||||||
getSignatureNavState() {
|
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) {
|
if (!this._allSignatures || this._allSignatures.length === 0) {
|
||||||
return {
|
return {
|
||||||
total: 0,
|
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 total = this._allSignatures.length; // Global: Toplam imza say?s?
|
||||||
const signed = this.appliedSignatures.length; // ?mzalananlar
|
const signed = this.appliedSignatures.length; // ?mzalananlar
|
||||||
const unsigned = total - signed; // Hesaplanan: ?mzalanmayanlar
|
const unsigned = total - signed; // Hesaplanan: ?mzalanmayanlar
|
||||||
@@ -521,12 +521,12 @@ window.pdfViewer = {
|
|||||||
* Cross-page navigation: searches ALL pages for next unsigned signature.
|
* Cross-page navigation: searches ALL pages for next unsigned signature.
|
||||||
*/
|
*/
|
||||||
async goToNextSignature(dotNetRef) {
|
async goToNextSignature(dotNetRef) {
|
||||||
// Global imza listesi yoksa ç?k
|
// Global imza listesi yoksa <EFBFBD>?k
|
||||||
if (!this._allSignatures || this._allSignatures.length === 0) {
|
if (!this._allSignatures || this._allSignatures.length === 0) {
|
||||||
return false;
|
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;
|
let currentIndex = -1;
|
||||||
if (this._lastViewedSignatureId) {
|
if (this._lastViewedSignatureId) {
|
||||||
currentIndex = this._allSignatures.findIndex(s => s.id === 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)
|
// Bir sonraki imzay? al (imzalanm?? olup olmad???na bakmadan)
|
||||||
let nextIndex = currentIndex + 1;
|
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) {
|
if (nextIndex >= this._allSignatures.length) {
|
||||||
nextIndex = 0; // ?lk imzaya dön
|
nextIndex = 0; // ?lk imzaya d<EFBFBD>n
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextSignature = this._allSignatures[nextIndex];
|
const nextSignature = this._allSignatures[nextIndex];
|
||||||
@@ -564,7 +564,7 @@ window.pdfViewer = {
|
|||||||
await new Promise(resolve => setTimeout(resolve, 150));
|
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;
|
this._lastViewedSignatureId = nextSignature.id;
|
||||||
|
|
||||||
// ?mza imzalanm?? m? kontrol et
|
// ?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) {
|
if (dotNetRef) {
|
||||||
dotNetRef.invokeMethodAsync('OnSignatureNavChanged');
|
dotNetRef.invokeMethodAsync('OnSignatureNavChanged');
|
||||||
}
|
}
|
||||||
@@ -603,16 +603,16 @@ window.pdfViewer = {
|
|||||||
return false;
|
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
|
let currentIndex = this._allSignatures.length; // Varsay?lan: son imzadan sonra
|
||||||
if (this._lastViewedSignatureId) {
|
if (this._lastViewedSignatureId) {
|
||||||
currentIndex = this._allSignatures.findIndex(s => s.id === this._lastViewedSignatureId);
|
currentIndex = this._allSignatures.findIndex(s => s.id === this._lastViewedSignatureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bir önceki imzay? al
|
// Bir <EFBFBD>nceki imzay? al
|
||||||
let prevIndex = currentIndex - 1;
|
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) {
|
if (prevIndex < 0) {
|
||||||
prevIndex = this._allSignatures.length - 1; // Son imzaya git
|
prevIndex = this._allSignatures.length - 1; // Son imzaya git
|
||||||
}
|
}
|
||||||
@@ -620,9 +620,9 @@ window.pdfViewer = {
|
|||||||
const prevSignature = this._allSignatures[prevIndex];
|
const prevSignature = this._allSignatures[prevIndex];
|
||||||
|
|
||||||
// Change page if needed
|
// Change page if needed
|
||||||
if (lastSig.page !== this.pageNum) {
|
if (prevSignature.page !== this.pageNum) {
|
||||||
// Sayfa de?i?tir
|
// Sayfa de?i?tir
|
||||||
this.pageNum = lastSig.page;
|
this.pageNum = prevSignature.page;
|
||||||
this.queueRenderPage(this.pageNum);
|
this.queueRenderPage(this.pageNum);
|
||||||
|
|
||||||
// Render tamamlanana kadar bekle
|
// Render tamamlanana kadar bekle
|
||||||
@@ -632,16 +632,16 @@ window.pdfViewer = {
|
|||||||
waitCount++;
|
waitCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blazor'a haber ver - signature butonlar?n? yeniden çiz
|
// Blazor'a haber ver - signature butonlar?n? yeniden <EFBFBD>iz
|
||||||
if (dotNetRef) {
|
if (dotNetRef) {
|
||||||
await dotNetRef.invokeMethodAsync('OnPageChangedBySignatureNav', this.pageNum);
|
await dotNetRef.invokeMethodAsync('OnPageChangedBySignatureNav', this.pageNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOM güncellenmesini bekle
|
// DOM g<EFBFBD>ncellenmesini bekle
|
||||||
await new Promise(resolve => setTimeout(resolve, 150));
|
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;
|
this._lastViewedSignatureId = prevSignature.id;
|
||||||
|
|
||||||
// ?mza imzalanm?? m? kontrol et
|
// ?mza imzalanm?? m? kontrol et
|
||||||
@@ -1016,3 +1016,4 @@ window.pdfViewer = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user