]> git.openstreetmap.org Git - rails.git/commitdiff
Rename map layer javascript files
authorAnton Khorev <tony29@yandex.ru>
Fri, 28 Jun 2024 00:12:15 +0000 (03:12 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 28 Jun 2024 00:12:15 +0000 (03:12 +0300)
app/assets/javascripts/index.js
app/assets/javascripts/index/layers/data.js [moved from app/assets/javascripts/index/browse.js with 95% similarity]
app/assets/javascripts/index/layers/notes.js [moved from app/assets/javascripts/index/notes.js with 98% similarity]

index 8ffa05c53e41ebcf88b58acd19e77f36950cf334..5c7b2d26e9f1e0fd6eb2d1c53a2bd61ce0481584 100644 (file)
@@ -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);
     }
similarity index 95%
rename from app/assets/javascripts/index/browse.js
rename to app/assets/javascripts/index/layers/data.js
index 7a761b50036dd30d02c1ec2d2fd0ca16f6b660d0..0a996f0c70c27244e7769f765f4586b425a9879c 100644 (file)
@@ -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() {
similarity index 98%
rename from app/assets/javascripts/index/notes.js
rename to app/assets/javascripts/index/layers/notes.js
index 5d553e970c4be49aa9a05f0c6984c1e0361429d3..eaa5c36547829691d53b881e0c002267b8bfae6f 100644 (file)
@@ -1,4 +1,4 @@
-OSM.initializeNotes = function (map) {
+OSM.initializeNotesLayer = function (map) {
   var noteLayer = map.noteLayer,
       notes = {};