- map.addObject({
- type: "note",
- id: parseInt(id, 10),
- latLng: L.latLng(data.coordinates.split(",")),
- icon: noteIcons[data.status]
- });
-
- if (callback) callback();
+ if (data) {
+ var hashParams = OSM.parseHash(window.location.hash);
+ map.addObject({
+ type: "note",
+ id: parseInt(id, 10),
+ latLng: L.latLng(data.coordinates.split(",")),
+ icon: noteIcons[data.status]
+ }, function () {
+ if (!hashParams.center && !skipMoveToNote) {
+ var latLng = L.latLng(data.coordinates.split(","));
+ OSM.router.withoutMoveListener(function () {
+ map.setView(latLng, 15, { reset: true });
+ });
+ }
+ });
+ }