From: Anton Khorev Date: Fri, 28 Jun 2024 00:12:15 +0000 (+0300) Subject: Rename map layer javascript files X-Git-Tag: live~375^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/51d2a846ece990db7c4109ecf923ad9201c6f8e6?ds=sidebyside;hp=--cc Rename map layer javascript files --- 51d2a846ece990db7c4109ecf923ad9201c6f8e6 diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 8ffa05c53..5c7b2d26e 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -12,9 +12,9 @@ //= require leaflet.contextmenu //= require index/contextmenu //= require index/search -//= require index/browse +//= require index/layers/data //= require index/export -//= require index/notes +//= require index/layers/notes //= require index/history //= require index/note //= require index/new_note @@ -160,12 +160,12 @@ $(document).ready(function () { OSM.initializeContextMenu(map); if (OSM.STATUS !== "api_offline" && OSM.STATUS !== "database_offline") { - OSM.initializeNotes(map); + OSM.initializeNotesLayer(map); if (params.layers.indexOf(map.noteLayer.options.code) >= 0) { map.addLayer(map.noteLayer); } - OSM.initializeBrowse(map); + OSM.initializeDataLayer(map); if (params.layers.indexOf(map.dataLayer.options.code) >= 0) { map.addLayer(map.dataLayer); } diff --git a/app/assets/javascripts/index/browse.js b/app/assets/javascripts/index/layers/data.js similarity index 95% rename from app/assets/javascripts/index/browse.js rename to app/assets/javascripts/index/layers/data.js index 7a761b500..0a996f0c7 100644 --- a/app/assets/javascripts/index/browse.js +++ b/app/assets/javascripts/index/layers/data.js @@ -1,5 +1,5 @@ -OSM.initializeBrowse = function (map) { - var browseBounds; +OSM.initializeDataLayer = function (map) { + var loadedBounds; var dataLayer = map.dataLayer; dataLayer.setStyle({ @@ -41,7 +41,7 @@ OSM.initializeBrowse = function (map) { function updateData() { var bounds = map.getBounds(); - if (!browseBounds || !browseBounds.contains(bounds)) { + if (!loadedBounds || !loadedBounds.contains(bounds)) { getData(); } } @@ -96,7 +96,7 @@ OSM.initializeBrowse = function (map) { function addFeatures() { $("#browse_status").empty(); dataLayer.addData(features); - browseBounds = bounds; + loadedBounds = bounds; } function cancelAddFeatures() { diff --git a/app/assets/javascripts/index/notes.js b/app/assets/javascripts/index/layers/notes.js similarity index 98% rename from app/assets/javascripts/index/notes.js rename to app/assets/javascripts/index/layers/notes.js index 5d553e970..eaa5c3654 100644 --- a/app/assets/javascripts/index/notes.js +++ b/app/assets/javascripts/index/layers/notes.js @@ -1,4 +1,4 @@ -OSM.initializeNotes = function (map) { +OSM.initializeNotesLayer = function (map) { var noteLayer = map.noteLayer, notes = {};