From a82eb53bfeb7a83540700e0ff868a6c4f783ca15 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 5 May 2025 12:43:44 +0300 Subject: [PATCH] Change bbox layer interface to make updateChangesetLocations private --- .../javascripts/index/history-changesets-layer.js | 12 ++++++------ app/assets/javascripts/index/history.js | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/index/history-changesets-layer.js b/app/assets/javascripts/index/history-changesets-layer.js index 30d95922f..619d36989 100644 --- a/app/assets/javascripts/index/history-changesets-layer.js +++ b/app/assets/javascripts/index/history-changesets-layer.js @@ -85,10 +85,10 @@ OSM.HistoryChangesetBboxHighlightBorderLayer = OSM.HistoryChangesetBboxLayer.ext OSM.HistoryChangesetsLayer = L.FeatureGroup.extend({ updateChangesets: function (map, changesets) { this._changesets = new Map(changesets.map(changeset => [changeset.id, changeset])); - this.updateChangesetShapes(map); + this.updateChangesetsGeometry(map); }, - updateChangesetShapes: function (map) { + updateChangesetsGeometry: function (map) { for (const changeset of this._changesets.values()) { const topLeft = map.project(L.latLng(changeset.bbox.maxlat, changeset.bbox.minlon)), bottomRight = map.project(L.latLng(changeset.bbox.minlat, changeset.bbox.maxlon)), @@ -110,11 +110,11 @@ OSM.HistoryChangesetsLayer = L.FeatureGroup.extend({ map.unproject(bottomRight)); } - this.updateChangesetLocations(map); - this.reorderChangesets(); + this._updateChangesetLocations(map); + this.updateChangesetsOrder(); }, - updateChangesetLocations: function (map) { + _updateChangesetLocations: function (map) { const mapCenterLng = map.getCenter().lng; for (const changeset of this._changesets.values()) { @@ -135,7 +135,7 @@ OSM.HistoryChangesetsLayer = L.FeatureGroup.extend({ } }, - reorderChangesets: function () { + updateChangesetsOrder: function () { const changesetEntries = [...this._changesets]; changesetEntries.sort(([, a], [, b]) => b.bounds.getSize() - a.bounds.getSize()); this._changesets = new Map(changesetEntries); diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index f180c885d..dd888ca42 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -85,7 +85,7 @@ OSM.History = function (map) { if (id) changesetsLayer.setChangesetSidebarRelativePosition(id, -1); }); - changesetsLayer.reorderChangesets(); + changesetsLayer.updateChangesetsOrder(); if (keepInitialLocation) { keepInitialLocation = false; @@ -263,12 +263,12 @@ OSM.History = function (map) { OSM.router.replace("/history" + window.location.hash); loadFirstChangesets(); } else { - changesetsLayer.updateChangesetLocations(map); + changesetsLayer.updateChangesetsGeometry(map); } } function zoomEndListener() { - changesetsLayer.updateChangesetShapes(map); + changesetsLayer.updateChangesetsGeometry(map); } function updateMap() { -- 2.39.5