mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 12:58:35 +03:00
Add secure check to set map bounds with narrative
This commit is contained in:
committed by
Lachlan Kermode
parent
b84e59cd28
commit
aa3da2d744
@@ -52,10 +52,12 @@ function updateNarrative(appState, action) {
|
||||
if (stepTime < minTime) minTime = stepTime;
|
||||
if (stepTime > maxTime) maxTime = stepTime;
|
||||
|
||||
if (+step.longitude < cornerBound0[1]) cornerBound0[1] = +step.longitude;
|
||||
if (+step.longitude > cornerBound1[1]) cornerBound1[1] = +step.longitude;
|
||||
if (+step.latitude < cornerBound0[0]) cornerBound0[0] = +step.latitude;
|
||||
if (+step.latitude > cornerBound1[0]) cornerBound1[0] = +step.latitude;
|
||||
if (!!step.longitude && !!step.latitude) {
|
||||
if (+step.longitude < cornerBound0[1]) cornerBound0[1] = +step.longitude;
|
||||
if (+step.longitude > cornerBound1[1]) cornerBound1[1] = +step.longitude;
|
||||
if (+step.latitude < cornerBound0[0]) cornerBound0[0] = +step.latitude;
|
||||
if (+step.latitude > cornerBound1[0]) cornerBound1[0] = +step.latitude;
|
||||
}
|
||||
});
|
||||
|
||||
minTime = new Date(minTime.getTime() - Math.abs((maxTime - minTime) / 10));
|
||||
@@ -71,7 +73,7 @@ function updateNarrative(appState, action) {
|
||||
filters: {
|
||||
...appState.filters,
|
||||
timerange: [minTime, maxTime],
|
||||
mapBounds: [cornerBound0, cornerBound1]
|
||||
mapBounds: (action.narrative) ? [cornerBound0, cornerBound1] : null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user