From 34d5f4d5198a66b09f848b3dbc4da95020179bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eat=C4=B1r?= Date: Wed, 2 Jun 2021 19:21:08 +0300 Subject: [PATCH] PDF Scroll: Find most visible part. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was a bug in the function. Also, onLostFocus function's bug is solved. Signed-off-by: Gökay Şatır Change-Id: Ic793999c58e13c9a42d00a4c19e44285aad8c750 --- loleaflet/src/layer/tile/CanvasTileLayer.js | 11 +++++++++-- loleaflet/src/layer/tile/CommentSection.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js index 51d2b9216..68630ba2a 100644 --- a/loleaflet/src/layer/tile/CanvasTileLayer.js +++ b/loleaflet/src/layer/tile/CanvasTileLayer.js @@ -5309,10 +5309,18 @@ L.CanvasTileLayer = L.Layer.extend({ // Used with filebasedview. _getMostVisiblePart: function (queue) { var parts = []; + var found = false; for (var i = 0; i < queue.length; i++) { - if (parts.indexOf(queue[i].part) < 0) + for (var j = 0; j < parts.length; j++) { + if (parts[j].part === queue[i].part) { + found = true; + break; + } + } + if (!found) parts.push({part: queue[i].part, tileCount: 0}); + found = false; } var maxTileCount = 0; @@ -5439,7 +5447,6 @@ L.CanvasTileLayer = L.Layer.extend({ } } - for (var i = 0; i < this._tiles.length; i++) { this._tiles[i].current = false; // Visible ones's "current" property will be set to true below. } diff --git a/loleaflet/src/layer/tile/CommentSection.ts b/loleaflet/src/layer/tile/CommentSection.ts index 28dfe742c..a76611c62 100644 --- a/loleaflet/src/layer/tile/CommentSection.ts +++ b/loleaflet/src/layer/tile/CommentSection.ts @@ -644,7 +644,7 @@ class Comment { if (this.sectionProperties.contentText.origText !== this.sectionProperties.nodeModifyText.value) { this.onSaveComment(e); } - else if (this.sectionProperties.nodeModifyText.value === '') { + else { this.onCancelClick(e); } }