Merge pull request #168 from forensic-architecture/fix/dot-vs-bar

fix check to render a dot or bar in timeline
This commit is contained in:
Ebrahem Farooqui
2020-10-27 08:24:22 -07:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@@ -4,7 +4,13 @@ import DatetimeSquare from './DatetimeSquare'
import DatetimeStar from './DatetimeStar'
import Project from './Project'
import ColoredMarkers from '../Map/ColoredMarkers.jsx'
import { calcOpacity, getEventCategories, zipColorsToPercentages, calculateColorPercentages } from '../../../common/utilities'
import {
calcOpacity,
getEventCategories,
zipColorsToPercentages,
calculateColorPercentages,
isLatitude,
isLongitude } from '../../../common/utilities'
function renderDot (event, styles, props) {
const colorPercentages = calculateColorPercentages([event], props.coloringSet)
@@ -92,7 +98,7 @@ const TimelineEvents = ({
return null
}
}
const isDot = (!!event.location && !!event.longitude) || (features.GRAPH_NONLOCATED && event.projectOffset !== -1)
const isDot = (isLatitude(event.latitude) && isLongitude(event.longitude)) || (features.GRAPH_NONLOCATED && event.projectOffset !== -1)
let renderShape = isDot ? renderDot : renderBar
if (event.shape) {

View File

@@ -1,6 +1,6 @@
import React from 'react'
import colors from '../../../common/global'
import { getEventCategories } from '../../../common/utilities'
import { getEventCategories, isLatitude, isLongitude } from '../../../common/utilities'
const TimelineMarkers = ({
styles,
@@ -51,7 +51,7 @@ const TimelineMarkers = ({
/>
}
const isDot = (!!event.location && !!event.longitude) || (features.GRAPH_NONLOCATED && event.projectOffset !== -1)
const isDot = (isLatitude(event.latitude) && isLongitude(event.longitude)) || (features.GRAPH_NONLOCATED && event.projectOffset !== -1)
const evShadows = getEventCategories(event, categories).map(cat => getEventY({ ...event, category: cat.id }))
function renderMarkerForEvent (y) {