Skip to content

Commit e80048d

Browse files
committed
update narrative to use LayoutContex
1 parent f3cc970 commit e80048d

File tree

1 file changed

+42
-35
lines changed

1 file changed

+42
-35
lines changed

src/containers/Interfaces/Narrative.js

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { getNetworkEdges, getNetworkNodes } from '../../selectors/network';
1313
import { edgesToCoords } from '../../selectors/canvas';
1414
import { entityAttributesProperty } from '../../utils/network-exporters/src/utils/reservedAttributes';
1515
import { get } from '../../utils/lodash-replacements';
16+
import { LayoutProvider } from '../../contexts/LayoutContext';
1617

1718
/**
1819
* Narrative Interface
@@ -150,43 +151,49 @@ class Narrative extends Component {
150151
return (
151152
<div className="narrative-interface">
152153
<div className="narrative-interface__canvas" id="narrative-interface__canvas">
153-
<Canvas
154-
className="narrative-concentric-circles"
155-
id="concentric-circles"
156-
key={`circles-${currentPreset.id}`}
154+
<LayoutProvider
155+
layout={layoutVariable}
156+
nodes={nodesWithLayout}
157+
edges={edgesWithCoords}
157158
>
158-
<Background
159-
concentricCircles={concentricCircles}
160-
skewedTowardCenter={skewedTowardCenter}
161-
image={backgroundImage}
162-
/>
163-
<ConvexHulls
164-
nodes={nodesWithLayout}
165-
groupVariable={convexHullVariable}
166-
layoutVariable={layoutVariable}
167-
/>
168-
<EdgeLayout
169-
edges={edgesWithCoords}
170-
/>
171-
{
172-
freeDraw && (
173-
<Annotations
174-
ref={this.annotationLayer}
175-
isFrozen={isFrozen}
176-
onChangeActiveAnnotations={this.handleChangeActiveAnnotations}
177-
/>
178-
)
179-
}
180-
<NodeLayout
181-
nodes={nodesWithLayout}
182-
id="NODE_LAYOUT"
183-
highlightAttribute={
184-
(showHighlightedNodes ? highlight[highlightIndex] : null)
159+
<Canvas
160+
className="narrative-concentric-circles"
161+
id="concentric-circles"
162+
key={`circles-${currentPreset.id}`}
163+
>
164+
<Background
165+
concentricCircles={concentricCircles}
166+
skewedTowardCenter={skewedTowardCenter}
167+
image={backgroundImage}
168+
/>
169+
<ConvexHulls
170+
nodes={nodesWithLayout}
171+
groupVariable={convexHullVariable}
172+
layoutVariable={layoutVariable}
173+
/>
174+
<EdgeLayout
175+
edges={edgesWithCoords}
176+
/>
177+
{
178+
freeDraw && (
179+
<Annotations
180+
ref={this.annotationLayer}
181+
isFrozen={isFrozen}
182+
onChangeActiveAnnotations={this.handleChangeActiveAnnotations}
183+
/>
184+
)
185185
}
186-
layoutVariable={layoutVariable}
187-
allowPositioning={allowRepositioning}
188-
/>
189-
</Canvas>
186+
<NodeLayout
187+
nodes={nodesWithLayout}
188+
id="NODE_LAYOUT"
189+
highlightAttribute={
190+
(showHighlightedNodes ? highlight[highlightIndex] : null)
191+
}
192+
layoutVariable={layoutVariable}
193+
allowPositioning={allowRepositioning}
194+
/>
195+
</Canvas>
196+
</LayoutProvider>
190197
<PresetSwitcher
191198
id="drop-obstacle"
192199
presets={presets}

0 commit comments

Comments
 (0)