diff --git a/client/app/scripts/charts/node-shape-stack.js b/client/app/scripts/charts/node-shape-stack.js index 48de1d6b91..d150d5d142 100644 --- a/client/app/scripts/charts/node-shape-stack.js +++ b/client/app/scripts/charts/node-shape-stack.js @@ -2,27 +2,23 @@ import React from 'react'; import { NODE_BASE_SIZE } from '../constants/styles'; - export default function NodeShapeStack(props) { - const shift = props.contrastMode ? 0.15 : 0.1; - const highlightScale = [1, 1 + shift]; - const dy = NODE_BASE_SIZE * shift; - + const verticalDistance = NODE_BASE_SIZE * (props.contrastMode ? 0.12 : 0.1); + const verticalTranslate = t => `translate(0, ${t * verticalDistance})`; const Shape = props.shape; + + // Stack three shapes on top of one another pretending they are never highlighted. + // Instead, fake the highlight of the whole stack with a vertically stretched shape + // drawn in the background. This seems to give a good approximation of the stack + // highlight and prevents us from needing to do some render-heavy SVG clipping magic. return ( - - - - - - - - - - - - + + + + + + ); } diff --git a/client/app/scripts/charts/node-shapes.js b/client/app/scripts/charts/node-shapes.js index 1e39d4f867..3c421ab7cc 100644 --- a/client/app/scripts/charts/node-shapes.js +++ b/client/app/scripts/charts/node-shapes.js @@ -28,8 +28,13 @@ function NodeShape(shapeType, shapeElement, shapeProps, { id, highlighted, color return ( {highlighted && shapeElement({ - className: 'highlight', - transform: `scale(${NODE_BASE_SIZE * 0.7})`, + className: 'highlight-border', + transform: `scale(${NODE_BASE_SIZE * 0.5})`, + ...shapeProps, + })} + {highlighted && shapeElement({ + className: 'highlight-shadow', + transform: `scale(${NODE_BASE_SIZE * 0.5})`, ...shapeProps, })} {shapeElement({ diff --git a/client/app/styles/_base.scss b/client/app/styles/_base.scss index 33e4b9ee27..a8c68c3005 100644 --- a/client/app/styles/_base.scss +++ b/client/app/styles/_base.scss @@ -425,15 +425,11 @@ } } - .stack .shape .highlight { - display: none; - } - - .stack .highlight .shape { - .border { display: none; } + .stack .highlight-only { + .background { display: none; } .shadow { display: none; } + .border { display: none; } .node { display: none; } - .highlight { display: inline; } } .stack .shape .metric-fill { @@ -444,14 +440,20 @@ transform: scale(1); cursor: pointer; - .highlight { - fill: $weave-blue; - fill-opacity: $node-highlight-fill-opacity; + .highlight-border { + fill: none; stroke: $weave-blue; - stroke-width: $node-highlight-stroke-width; + stroke-width: 0.7 + $node-highlight-stroke-width * 2; stroke-opacity: $node-highlight-stroke-opacity; } + .highlight-shadow { + fill: none; + stroke: white; + stroke-width: 0.7; + stroke-opacity: $node-highlight-shadow-opacity; + } + .background { stroke: none; fill: $background-lighter-color; diff --git a/client/app/styles/_contrast-overrides.scss b/client/app/styles/_contrast-overrides.scss index 4860c5a5fc..310f791668 100644 --- a/client/app/styles/_contrast-overrides.scss +++ b/client/app/styles/_contrast-overrides.scss @@ -12,7 +12,7 @@ $text-darker-color: darken($text-color, 20%); $white: white; $edge-color: black; -$node-highlight-fill-opacity: 0.3; +$node-highlight-shadow-opacity: 0.4; $node-highlight-stroke-opacity: 0.5; $node-highlight-stroke-width: 0.16; $node-border-stroke-width: 0.2; diff --git a/client/app/styles/_variables.scss b/client/app/styles/_variables.scss index 2a9f759dc5..7abd7c2eec 100644 --- a/client/app/styles/_variables.scss +++ b/client/app/styles/_variables.scss @@ -30,7 +30,7 @@ $border-radius: 4px; $terminal-header-height: 44px; -$node-highlight-fill-opacity: 0.1; +$node-highlight-shadow-opacity: 0.5; $node-highlight-stroke-opacity: 0.4; $node-highlight-stroke-width: 0.04; $node-border-stroke-width: 0.12;