-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bottom node selection menu and some refactoring, re-styling
- Loading branch information
1 parent
7c6de0a
commit 63b2be0
Showing
13 changed files
with
179 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as model from "../model"; | ||
import { onSelectionUpdate } from "../selection"; | ||
|
||
let selectedNode = null; | ||
|
||
onSelectionUpdate((selection) => { | ||
|
||
d3.select("#nodeDetailsToggle").classed("disabled", selection.length !== 1); | ||
selectedNode = selection.length === 1 ? selection[0] : null; | ||
updateHeader(); | ||
|
||
}); | ||
|
||
function updateHeader () { | ||
|
||
d3.select("#nodeDetails .header .text").text( | ||
selectedNode | ||
? `Node "${ selectedNode.label }" (${ selectedNode.type }) selected.` | ||
: "Please, select one node." | ||
); | ||
|
||
if (!selectedNode) { | ||
d3.select("#nodeDetails").classed("active", model.uiState.detailsToggled = false); | ||
} | ||
|
||
} | ||
|
||
export function init () { | ||
|
||
d3.select("#nodeDetailsToggle") | ||
.data([model.uiState]) | ||
.on("click", function (d) { | ||
if (!selectedNode) | ||
return; | ||
d.detailsToggled = !d.detailsToggled; | ||
d3.select("#nodeDetails").classed("active", d.detailsToggled); | ||
}); | ||
|
||
updateHeader(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { update } from "./graph"; | ||
import * as tabular from "./tabular"; | ||
import * as details from "./details"; | ||
|
||
window.init = () => { | ||
|
||
update(); | ||
tabular.init(); | ||
details.init(); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as model from "./model"; | ||
|
||
let selection = [], | ||
callbacks = []; | ||
|
||
export function updateSelection () { | ||
|
||
selection = model.getGraphData().nodes.filter(node => !!node.selected); | ||
|
||
callbacks.forEach(c => c(selection)); | ||
|
||
} | ||
|
||
/** | ||
* The callback is invoked when selection changes. | ||
* @param {selectionCallback} callback | ||
*/ | ||
export function onSelectionUpdate (callback) { | ||
|
||
callbacks.push(callback); | ||
|
||
} | ||
|
||
/** | ||
* This callback is invoked when selection changes. | ||
* @callback selectionCallback | ||
* @param {*[]} nodes - Currently selected nodes. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
$defaultTransition: all .3s ease; | ||
$defaultPadding: 10px; | ||
$defaultShadow: 0 1px 2px gray; | ||
$defaultShadow: 0 0 2px gray; | ||
|
||
$colorA: #02ad8b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
@import "mixins"; | ||
@import "const"; | ||
|
||
#nodeDetails { | ||
|
||
position: absolute; | ||
box-sizing: border-box; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
max-height: 100%; | ||
background: white; | ||
overflow: visible; | ||
box-shadow: $defaultShadow; | ||
@include transition($defaultTransition); | ||
@include transform(translate(0,100%)); | ||
&.active { | ||
@include transform(translate(0,0)); | ||
} | ||
|
||
> .header { | ||
|
||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: -28px; | ||
height: 20px; | ||
max-width: 80%; | ||
width: 350px; | ||
margin: 0 auto; | ||
border-radius: 5px 5px 0 0; | ||
background: white; | ||
padding: 4px; | ||
font-size: 16px; | ||
box-shadow: 0 0 2px gray; | ||
|
||
> .icons { | ||
display: block; | ||
float: left; | ||
width: 30px; | ||
font-size: 24px; | ||
color: gray; | ||
} | ||
|
||
> .text { | ||
margin-left: 30px; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
} | ||
|
||
} | ||
|
||
> .content { | ||
|
||
overflow: auto; | ||
max-height: 100%; | ||
padding: $defaultPadding; | ||
box-sizing: border-box; | ||
|
||
> .wrapper { | ||
|
||
position: relative; | ||
|
||
table { | ||
width: 100%; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} |
File renamed without changes.