Skip to content
Snippets Groups Projects
Commit 1916d100 authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Adjusts interactions for links

parent 5584663f
No related branches found
No related tags found
1 merge request!2Implemented editor in the react framework
Pipeline #56812 passed
...@@ -368,8 +368,11 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> { ...@@ -368,8 +368,11 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
} }
private handleLinkClick(link: Link) { private handleLinkClick(link: Link) {
link.delete(); if (this.state.keys["Control"]) {
this.forceUpdate(); // Delete link when control is pressed
link.delete();
this.forceUpdate();
}
} }
private handleEngineStop() { private handleEngineStop() {
...@@ -391,6 +394,30 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> { ...@@ -391,6 +394,30 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
<h1>Interface</h1> <h1>Interface</h1>
<SpaceSelect onLoadSpace={this.loadSpace} /> <SpaceSelect onLoadSpace={this.loadSpace} />
<div id="content"> <div id="content">
{this.state.graph ? (
<ReactForceGraph2d
ref={this.renderer}
graphData={this.state.graph.data}
onNodeClick={this.handleNodeClick}
autoPauseRedraw={false}
cooldownTicks={0}
warmupTicks={this.warmupTicks}
onEngineStop={this.handleEngineStop}
nodeCanvasObject={this.handleNodeCanvasObject}
nodeCanvasObjectMode={() => "after"}
linkCanvasObject={this.handleLinkCanvasObject}
linkCanvasObjectMode={() => "replace"}
onNodeDrag={this.handleNodeDrag}
onNodeDragEnd={this.handleNodeDragEnd}
onLinkClick={this.handleLinkClick}
onBackgroundClick={(event) =>
this.handleBackgroundClick(
event,
this.extractPositions(event)
)
}
/>
) : undefined}
<div id="sidepanel"> <div id="sidepanel">
<HistoryNavigator <HistoryNavigator
spaceId="space" spaceId="space"
...@@ -402,7 +429,7 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> { ...@@ -402,7 +429,7 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
<li>Click background to create node</li> <li>Click background to create node</li>
<li>Click node to select and edit</li> <li>Click node to select and edit</li>
<li>CTRL+Click node to delete</li> <li>CTRL+Click node to delete</li>
<li>Click link to delete</li> <li>CTRL+Click link to delete</li>
<li>SHIFT+Click a second node to connect</li> <li>SHIFT+Click a second node to connect</li>
{this.state.connectOnDrag ? ( {this.state.connectOnDrag ? (
<li> <li>
...@@ -466,30 +493,6 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> { ...@@ -466,30 +493,6 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
Connect nodes when dragged Connect nodes when dragged
</label> </label>
</div> </div>
{this.state.graph ? (
<ReactForceGraph2d
ref={this.renderer}
graphData={this.state.graph.data}
onNodeClick={this.handleNodeClick}
autoPauseRedraw={false}
cooldownTicks={0}
warmupTicks={this.warmupTicks}
onEngineStop={this.handleEngineStop}
nodeCanvasObject={this.handleNodeCanvasObject}
nodeCanvasObjectMode={() => "after"}
linkCanvasObject={this.handleLinkCanvasObject}
linkCanvasObjectMode={() => "replace"}
onNodeDrag={this.handleNodeDrag}
onNodeDragEnd={this.handleNodeDragEnd}
onLinkClick={this.handleLinkClick}
onBackgroundClick={(event) =>
this.handleBackgroundClick(
event,
this.extractPositions(event)
)
}
/>
) : undefined}
</div> </div>
</div> </div>
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment