refix map selection

This commit is contained in:
Lachlan Kermode
2020-05-29 15:08:20 +02:00
parent 3b4a3312d5
commit 404dd618ae
3 changed files with 11 additions and 6 deletions

View File

@@ -52,9 +52,10 @@ class Dashboard extends React.Component {
}
handleSelect (selected, axis) {
const matchedEvents = [selected]
const matchedEvents = []
const TIMELINE_AXIS = 0
if (axis === TIMELINE_AXIS) {
matchedEvents.push(selected)
// find in events
const { events } = this.props.domain
const idx = binarySearch(
@@ -74,6 +75,10 @@ class Dashboard extends React.Component {
matchedEvents.push(events[ptr])
ptr += 1
}
} else { // Map...
const std = { ...selected }
delete std.sources
Object.values(std).forEach(ev => matchedEvents.push(ev))
}
this.props.actions.updateSelected(matchedEvents)
@@ -152,14 +157,14 @@ class Dashboard extends React.Component {
/>
<Map
methods={{
onSelect: this.handleSelect,
onSelect: ev => this.handleSelect(ev, 1),
onSelectNarrative: this.setNarrative,
getCategoryColor: this.getCategoryColor
}}
/>
<Timeline
methods={{
onSelect: this.handleSelect,
onSelect: ev => this.handleSelect(ev, 0),
onUpdateTimerange: actions.updateTimeRange,
getCategoryColor: category => this.getCategoryColor(category)
}}

View File

@@ -357,7 +357,7 @@ class Timeline extends React.Component {
}}
getCategoryColor={this.props.methods.getCategoryColor}
transitionDuration={this.state.transitionDuration}
onSelect={ev => this.props.methods.onSelect(ev, TIMELINE_AXIS)}
onSelect={this.props.methods.onSelect}
dims={dims}
features={this.props.features}
/>

View File

@@ -60,12 +60,12 @@ const initial = {
},
timeline: {
dimensions: {
height: 1250,
height: 250,
width: 0,
marginLeft: 100,
marginTop: 15,
marginBottom: 60,
contentHeight: 800,
contentHeight: 200,
width_controls: 100
},
range: [