From 404dd618ae39dc587e332c544b54055e4213acf5 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Fri, 29 May 2020 15:08:20 +0200 Subject: [PATCH] refix map selection --- src/components/Layout.js | 11 ++++++++--- src/components/Timeline.jsx | 2 +- src/store/initial.js | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/Layout.js b/src/components/Layout.js index 7f69332..4e83c05 100644 --- a/src/components/Layout.js +++ b/src/components/Layout.js @@ -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 { /> this.handleSelect(ev, 1), onSelectNarrative: this.setNarrative, getCategoryColor: this.getCategoryColor }} /> this.handleSelect(ev, 0), onUpdateTimerange: actions.updateTimeRange, getCategoryColor: category => this.getCategoryColor(category) }} diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index be96a72..3b272ad 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -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} /> diff --git a/src/store/initial.js b/src/store/initial.js index 9374837..978940a 100644 --- a/src/store/initial.js +++ b/src/store/initial.js @@ -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: [