Skip to content

Commit a5b9479

Browse files
authored
Change zoomToNote to moveToNote (openstreetmap#10819)
1 parent 06629e5 commit a5b9479

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

modules/behavior/hash.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export function behaviorHash(context) {
196196
const selectIds = q.id.split(',');
197197
if (selectIds.length === 1 && selectIds[0].startsWith('note/')) {
198198
const noteId = selectIds[0].split('/')[1];
199-
context.zoomToNote(noteId, !q.map);
199+
context.moveToNote(noteId, !q.map);
200200
} else {
201201
context.zoomToEntities(
202202
// convert ids to short form id: node/123 -> n123

modules/core/context.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,21 @@ export function coreContext() {
219219
});
220220
};
221221

222-
context.zoomToNote = (noteId, zoomTo) => {
222+
context.moveToNote = (noteId, moveTo) => {
223223
context.loadNote(noteId, (err, result) => {
224224
if (err) return;
225225
const entity = result.data.find(e => e.id === noteId);
226-
if (entity) {
227-
// zoom to, used note loc
228-
const note = services.osm.getNote(noteId);
229-
if (zoomTo !== false) {
230-
context.map().centerZoom(note.loc,15);
231-
}
232-
// open note layer
233-
const noteLayer = context.layers().layer('notes');
234-
noteLayer.enabled(true);
235-
// select the note
236-
context.enter(modeSelectNote(context, noteId));
226+
if (!entity) return;
227+
// zoom to, used note loc
228+
const note = services.osm.getNote(noteId);
229+
if (moveTo !== false) {
230+
context.map().center(note.loc);
237231
}
232+
// open note layer
233+
const noteLayer = context.layers().layer('notes');
234+
noteLayer.enabled(true);
235+
// select the note
236+
context.enter(modeSelectNote(context, noteId));
238237
});
239238
};
240239

modules/ui/feature_list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ export function uiFeatureList(context) {
383383
const noteId = d.id.replace(/\D/g, '');
384384

385385
// load note
386-
context.zoomToNote(noteId);
386+
context.moveToNote(noteId);
387387
} else {
388388
// download, zoom to, and select the entity with the given ID
389389
context.zoomToEntity(d.id);

0 commit comments

Comments
 (0)