You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:36:33 UTC

[GitHub] [brooklyn-ui] algairim commented on a change in pull request #296: Invert label text when arc goes in the opposite direction

algairim commented on a change in pull request #296:
URL: https://github.com/apache/brooklyn-ui/pull/296#discussion_r729825130



##########
File path: ui-modules/blueprint-composer/app/components/util/d3-blueprint.js
##########
@@ -819,23 +849,11 @@ export function D3Blueprint(container, options) {
             .attr('opacity', 1)
             .attr('stroke', 'red')
             .attr('d', function(d) {
-                let targetNode = nodeForEntity(d.target);
-                let sourceNode = nodeForEntity(d.source);
-                let sourceY = sourceNode.y + (d.source.isMemberSpec() ? _configHolder.nodes.memberspec.circle.cy : 0);
-                let targetY = targetNode.y + (d.target.isMemberSpec() ? _configHolder.nodes.memberspec.circle.cy : 0);
-                let dx = targetNode.x - sourceNode.x;
-                let dy = targetY - sourceY;
-                let dr = Math.sqrt(dx * dx + dy * dy);
-                let sweep = dx * dy > 0 ? 0 : 1;
-                _mirror.attr('d', `M ${sourceNode.x},${sourceY} A ${dr},${dr} 0 0,${sweep} ${targetNode.x},${targetY}`);
-
-                let m = _mirror._groups[0][0].getPointAtLength(_mirror._groups[0][0].getTotalLength() - _configHolder.nodes.child.circle.r - 20);
-
-                dx = m.x - sourceNode.x;
-                dy = m.y - sourceY;
-                dr = Math.sqrt(dx * dx + dy * dy);
-
-                return `M ${sourceNode.x},${sourceY} A ${dr},${dr} 0 0,${sweep} ${m.x},${m.y}`;
+                const [x1,y1, dr, sweep, x2, y2, isLeftToRight] = getArcTransitionParameters(d);
+
+                d.isLeftToRight = isLeftToRight;

Review comment:
       We compute this condition in the first walk thorough arcs, there is no need to do the same for labels at the arc level again. `isLeftToRight` condition computed again for labels above arc (multiple labels).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org