node page: display map correctly also if node doesn't have location info

This commit is contained in:
Oliver Gerlich 2018-07-21 18:46:19 +02:00
parent d7e98625e2
commit 2cc533c481
1 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,8 @@ export class NodeView extends View {
owner = domlib.newAt(this.el, 'p'),
mapEl = domlib.newAt(this.el, 'div');
this.currentNodeIsRendered = false;
this.titleName = domlib.newAt(title, 'span');
title.appendChild(document.createTextNode(' - '));
this.titleID = domlib.newAt(title, 'i');
@ -196,12 +198,22 @@ export class NodeView extends View {
this.marker.setLatLng(latlng);
this.marker.setOpacity(1);
this.map.invalidateSize();
this.currentNodeIsRendered = true;
}
}
if (!this.currentNodeIsRendered) {
this.map.setView(config.map.view.bound);
this.marker.setLatLng(config.map.view.bound);
this.marker.setOpacity(0.5);
this.map.invalidateSize();
this.currentNodeIsRendered = true;
}
}
setNodeID (nodeID) {
this.currentNodeID = nodeID;
this.currentNodeIsRendered = false;
}
}