Skip to content
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

Tighter node bounding boxes #1756

Merged
merged 4 commits into from
Aug 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions client/app/scripts/charts/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,22 @@ class Node extends React.Component {
const useSvgLabels = exportingGraph;
const size = nodeScale(scaleFactor);
const networkOffset = focused ? nodeScale(scaleFactor * 0.67) : nodeScale(0.67);
const mouseEvents = {
onClick: this.handleMouseClick,
onMouseEnter: this.handleMouseEnter,
onMouseLeave: this.handleMouseLeave,
};

return (
<g className={nodeClassName} transform={transform}
onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
<g className={nodeClassName} transform={transform}>

{useSvgLabels ?

svgLabels(label, subLabel, labelClassName, subLabelClassName, labelOffsetY) :

<foreignObject x={labelOffsetX} y={labelOffsetY} width={labelWidth}
height="10em" transform={labelTransform}>
<div className="node-label-wrapper" onClick={this.handleMouseClick}>
<foreignObject style={{pointerEvents: 'none'}} x={labelOffsetX} y={labelOffsetY}
width={labelWidth} height="100em" transform={labelTransform}>
<div className="node-label-wrapper" style={{pointerEvents: 'all'}} {...mouseEvents}>
<div className={labelClassName}>
<MatchedText text={label} match={matches.get('label')} />
</div>
Expand All @@ -127,7 +131,7 @@ class Node extends React.Component {
</div>
</foreignObject>}

<g onClick={this.handleMouseClick}>
<g {...mouseEvents}>
<NodeShapeType
size={size}
color={color}
Expand Down
21 changes: 21 additions & 0 deletions client/app/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ h2 {
}

.header {
pointer-events: none;

This comment was marked as abuse.


position: absolute;
top: 32px;
width: 100%;
Expand Down Expand Up @@ -264,6 +266,8 @@ h2 {
.topologies-item-main,
.topologies-sub-item {
// border: 1px solid @background-darker-secondary-color;
pointer-events: all;

color: @text-secondary-color;
.btn-opacity;
cursor: pointer;
Expand Down Expand Up @@ -368,6 +372,19 @@ h2 {
}

.node-label-wrapper {
//
// inline-block so wrapper is only as wide as content.
//
display: inline-block;

//
// - inline-block gets a different baseline depending on overflow value
// - this element gets its overflow value changed sometimes.
// - explicitly set the baseline so the text doesn't jump up and down.
// http://stackoverflow.com/questions/9273016
//
vertical-align: top;

cursor: pointer;
}

Expand Down Expand Up @@ -1176,10 +1193,12 @@ h2 {
}

.grid-mode-selector {

margin-top: 8px;
margin-left: 8px;

&-wrapper {
pointer-events: all;
border-color: @background-darker-secondary-color;
}

Expand Down Expand Up @@ -1265,6 +1284,8 @@ h2 {
}

.search {
pointer-events: all;

display: inline-block;
position: relative;
width: 10em;
Expand Down