Merge pull request #161 from forensic-architecture/feature/multi-select-events

Feature/multi select events
This commit is contained in:
Ebrahem Farooqui
2020-09-28 07:19:40 -07:00
committed by GitHub
2 changed files with 6 additions and 7 deletions

View File

@@ -57,12 +57,6 @@ class Timeline extends React.Component {
if (nextProps.dimensions.trackHeight !== this.props.dimensions.trackHeight) {
this.computeDims()
}
if (hash(nextProps.app.selected) !== hash(this.props.app.selected)) {
if (!!nextProps.app.selected && nextProps.app.selected.length > 0) {
this.onCenterTime(nextProps.app.selected[0].datetime)
}
}
}
addEventListeners () {

View File

@@ -21,6 +21,11 @@ function MapEvents ({
return [x, y]
}
function handleEventSelect (e, location) {
const events = e.shiftKey ? selected.concat(location.events) : location.events
onSelect(events)
}
function renderBorder () {
return (
<React.Fragment>
@@ -135,7 +140,7 @@ function MapEvents ({
<g
className={`location-event ${narrative ? 'no-hover' : ''}`}
transform={`translate(${x}, ${y})`}
onClick={() => onSelect(location.events)}
onClick={(e) => handleEventSelect(e, location)}
>
{renderLocationSlicesByCategory(location)}
{extraRender ? extraRender() : null}