From f52f24b5175db2219baf891307aaa817d7a6ae49 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 10 Jul 2018 23:28:37 -0400 Subject: [PATCH] Add noteOptions, default to 10k note limit and 7 days closed Also bump note tile zoom to z12. There just aren't that many notes, so this reduces API calls. --- modules/services/osm.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/services/osm.js b/modules/services/osm.js index 922296916..7ef04526d 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -49,7 +49,7 @@ var _noteChangeset = {}; var _connectionID = 1; var _tileZoom = 16; -var _noteZoom = 13; +var _noteZoom = 12; var _rateLimitError; var _userChangesets; var _userDetails; @@ -567,7 +567,6 @@ export default { if (!this.authenticated()) return; // require auth } - var that = this; var cid = _connectionID; @@ -769,15 +768,18 @@ export default { }, - loadTiles: function(projection, dimensions, callback, loadingNotes) { + loadTiles: function(projection, dimensions, callback, noteOptions) { if (_off) return; var that = this; + var loadingNotes = (noteOptions !== undefined); // check if loading entities, or notes var path, cache, tilezoom, throttleLoadUsers; if (loadingNotes) { - path = '/api/0.6/notes?bbox='; + noteOptions = _extend({ limit: 10000, closed: 7}, noteOptions); + path = '/api/0.6/notes?limit=' + noteOptions.limit + + '&closed=' + noteOptions.closed + '&bbox='; cache = _noteCache; tilezoom = _noteZoom; throttleLoadUsers = _throttle(function() { @@ -937,8 +939,9 @@ export default { }, - loadNotes: function(projection, dimensions) { - this.loadTiles(projection, dimensions, null, true); // true = loadingNotes + loadNotes: function(projection, dimensions, noteOptions) { + noteOptions = _extend({ limit: 10000, closed: 7}, noteOptions); + this.loadTiles(projection, dimensions, null, noteOptions); },