-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree browser #442
Tree browser #442
Changes from 1 commit
cdbad33
1f6ef10
fd553e5
50d2d19
6f5ca9a
7258f57
8ecfa00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,9 +275,20 @@ export default class TreeWidget extends React.Component { | |
nodesList.push(edges[childrenList[i]].to) | ||
} | ||
var uniqNodes = [...new Set(nodesList)]; | ||
|
||
for (var j = uniqNodes.length - 1; j >= 0 ; j--) { | ||
var node = nodes[this.findChildren({ id: uniqNodes[j] }, "id", nodes)[0]]; | ||
if (node.instanceId.indexOf("VFB_") > -1) { | ||
child.instanceId = node.instanceId; | ||
// child.subtitle = child.subtitle + " " + node.instanceId; | ||
uniqNodes.splice(j, 1); | ||
} | ||
} | ||
|
||
for ( var j = 0; j < uniqNodes.length; j++) { | ||
var node = nodes[this.findChildren({ id: uniqNodes[j] }, "id", nodes)[0]]; | ||
if (node.instanceId.indexOf("VFB_") > -1) { | ||
console.log("child.instanceId contains " + child.instanceId + "but I am overwriting it with " + node.instanceId); | ||
child.instanceId = node.instanceId; | ||
} else { | ||
child.children.push({ | ||
|
@@ -420,34 +431,76 @@ export default class TreeWidget extends React.Component { | |
|
||
getButtons (rowInfo) { | ||
var buttons = []; | ||
if (rowInfo.node.title !== "No data available.") { | ||
buttons.push(<i className="fa fa-tint" | ||
aria-hidden="true" | ||
onClick={ () => { | ||
this.setState({ displayColorPicker: true }); | ||
}}> | ||
{ (this.state.displayColorPicker | ||
if (Instances[rowInfo.node.instanceId] !== undefined && typeof Instances[rowInfo.node.instanceId].isVisible !== "undefined") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ddelpiano too many nested if else else if else - very hard to read --> switch |
||
// rowInfo.node.subtitle = rowInfo.node.instanceId; | ||
if (Instances[rowInfo.node.instanceId].isVisible()) { | ||
var color = Instances[rowInfo.node.instanceId].getColor(); | ||
buttons.push(<i className="fa fa-eye-slash" | ||
aria-hidden="true" | ||
onClick={ () => { | ||
Instances[rowInfo.node.instanceId].hide(); | ||
this.setState({ nodeSelected: rowInfo.node }); | ||
}} />); | ||
buttons.push(<i className="fa fa-tint" | ||
style={{ | ||
paddingLeft: "6px", | ||
color: color | ||
}} | ||
aria-hidden="true" | ||
onClick={ () => { | ||
this.setState({ displayColorPicker: true }); | ||
}}> | ||
{ (this.state.displayColorPicker | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ddelpiano ternary operator here makes the code hard to read, it's ok for short one-liners but in cases like this I would avoid it |
||
&& this.state.nodeSelected.subtitle === rowInfo.node.subtitle | ||
&& this.colorPickerNode === undefined) | ||
? <CompactColor | ||
style={{ zIndex: 10 }}/> | ||
: null} | ||
</i>); | ||
? <CompactColor | ||
ref={node => this.colorPickerNode = node} | ||
color={Instances[rowInfo.node.instanceId].getColor()} | ||
onChangeComplete={ color => { | ||
Instances[rowInfo.node.instanceId].setColor(color.hex); | ||
this.setState({ displayColorPicker: true }); | ||
}} | ||
style={{ zIndex: 10 }}/> | ||
: null} | ||
</i>); | ||
} else { | ||
if (rowInfo.node.instanceId.indexOf("VFB_") > -1) { | ||
buttons.push(<i className="fa fa-eye" | ||
aria-hidden="true" | ||
onClick={ () => { | ||
Instances[rowInfo.node.instanceId].show(); | ||
this.setState({ nodeSelected: rowInfo.node }); | ||
}} />); | ||
} | ||
} | ||
} else { | ||
if (rowInfo.node.instanceId.indexOf("VFB_") > -1) { | ||
buttons.push(<i className="fa fa-eye" | ||
aria-hidden="true" | ||
onClick={ () => { | ||
// rowInfo.node.subtitle = rowInfo.node.instanceId; | ||
this.props.selectionHandler(rowInfo.node.instanceId); | ||
this.setState({ nodeSelected: rowInfo.node }); | ||
}} />); | ||
} | ||
} | ||
return buttons; | ||
} | ||
|
||
getNodes (rowInfo) { | ||
if (rowInfo.node.title !== "No data available.") { | ||
var title = <MuiThemeProvider theme={this.theme}> | ||
<Tooltip | ||
title={<div id="dario"> | ||
<div> {rowInfo.node.instanceId} </div> | ||
<div> {rowInfo.node.description} </div> | ||
<div> | ||
<img id="dario" | ||
src={"https://VirtualFlyBrain.org/reports/" + rowInfo.node.instanceId + "/thumbnailT.png"} /> | ||
</div></div>}> | ||
<Tooltip placement="right-start" | ||
title={ (rowInfo.node.instanceId.indexOf("VFB_") > -1) | ||
? (<div> | ||
<div> {rowInfo.node.description} </div> | ||
<div> | ||
<img style={{ textAlign: "center" }} | ||
src={"https://VirtualFlyBrain.org/reports/" + rowInfo.node.instanceId + "/thumbnailT.png"} /> | ||
</div></div>) | ||
: (<div> | ||
<div> {rowInfo.node.description} </div> | ||
</div>)}> | ||
<div | ||
className={rowInfo.node.subtitle === this.state.nodeSelected.subtitle | ||
? "nodeFound nodeSelected" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1355,7 +1355,7 @@ | |
.rst__collapseButton:focus, | ||
.rst__expandButton:focus { | ||
outline: none; | ||
box-shadow: 0 0 0 1px #000, 0 0 1px 3px #83bef9; | ||
box-shadow: none; //0 0 0 1px #000, 0 0 1px 3px #83bef9; | ||
} | ||
.rst__collapseButton:hover:not(:active), | ||
.rst__expandButton:hover:not(:active) { | ||
|
@@ -1615,10 +1615,12 @@ | |
} | ||
|
||
.nodeFound { | ||
outline: solid 3px #0080ff; | ||
//outline: solid 3px #0080ff; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ddelpiano cleanup |
||
color: #0080ff; | ||
|
||
} | ||
|
||
.chrome-picker { | ||
position: absolute; | ||
z-index: 1; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddelpiano cleanup if this is gone for real