Skip to content

Commit

Permalink
Fixes for arrow alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed Mar 19, 2024
1 parent 1aec98f commit 6480e46
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.

This file was deleted.

5 changes: 2 additions & 3 deletions packages/demo-app-ts/src/demos/pipelinesDemo/DemoTaskNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ const DemoTaskNode: React.FunctionComponent<DemoTaskNodeProps> = ({
badge={pipelineOptions.showBadges ? data.taskProgress : undefined}
badgePopoverParams={pipelineOptions.showBadgeTooltips ? undefined : badgePopoverParams}
badgeTooltip={pipelineOptions.showBadgeTooltips ? DEMO_TIP_TEXT : undefined}
hasWhenExpression={!!data.whenStatus}
whenOffset={DEFAULT_WHEN_OFFSET}
whenSize={DEFAULT_WHEN_SIZE}
whenOffset={data.whenStatus ? DEFAULT_WHEN_OFFSET : 0}
whenSize={data.whenStatus ? DEFAULT_WHEN_SIZE : 0}
{...rest}
>
{whenDecorator}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ import {
DEFAULT_EDGE_TYPE,
DEFAULT_FINALLY_EDGE_TYPE
} from '@patternfly/react-topology';
import pipelineComponentFactory, { GROUPED_EDGE_TYPE } from './pipelineComponentFactory';
import pipelineComponentFactory, {
GROUPED_EDGE_TYPE,
SPACER_EDGE_TYPE
} from './pipelineComponentFactory';
import { useDemoPipelineNodes } from './useDemoPipelineNodes';
import { GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL } from './DemoTaskGroupEdge';
import { PipelineDemoContext, PipelineDemoModel } from './PipelineDemoContext';
import PipelineOptionsBar from './PipelineOptionsBar';

export const PIPELINE_NODE_SEPARATION_VERTICAL = 65;

export const LAYOUT_TITLE = 'Layout';

const GROUP_PREFIX = 'Grouped_';
const VERTICAL_SUFFIX = '_Vertical';
const PIPELINE_LAYOUT = 'PipelineLayout';
Expand All @@ -58,7 +59,7 @@ const TopologyPipelineLayout: React.FC = observer(() => {
nodes.filter((n) => !n.group),
DEFAULT_SPACER_NODE_TYPE,
edgeType,
edgeType,
SPACER_EDGE_TYPE,
[DEFAULT_FINALLY_NODE_TYPE],
DEFAULT_FINALLY_EDGE_TYPE
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ import {
withSelection,
withPanZoom,
GraphComponent,
DEFAULT_FINALLY_EDGE_TYPE
DEFAULT_FINALLY_EDGE_TYPE,
TaskEdge
} from '@patternfly/react-topology';
import DemoTaskNode from './DemoTaskNode';
import DemoFinallyNode from './DemoFinallyNode';
import DemoTaskGroupEdge from './DemoTaskGroupEdge';
import DemoFinallyTaskEdge from './DemoFinallyTaskEdge';
import DemoTaskEdge from './DemoTaskEdge';

export const GROUPED_EDGE_TYPE = 'GROUPED_EDGE';
export const SPACER_EDGE_TYPE = 'spacer-edge';

const contextMenuItem = (label: string, i: number): React.ReactElement => {
if (label === '-') {
Expand Down Expand Up @@ -59,11 +60,11 @@ const pipelineComponentFactory: ComponentFactory = (
return DefaultTaskGroup;
case DEFAULT_SPACER_NODE_TYPE:
return SpacerNode;
case 'finally-spacer-edge':
case SPACER_EDGE_TYPE:
return TaskEdge;
case DEFAULT_FINALLY_EDGE_TYPE:
case DEFAULT_EDGE_TYPE:
return DemoTaskEdge;
case DEFAULT_FINALLY_EDGE_TYPE:
return DemoFinallyTaskEdge;
case GROUPED_EDGE_TYPE:
return DemoTaskGroupEdge;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default class TaskNodeTargetAnchor<E extends Node = Node> extends Abstrac
const scale = this.owner.getGraph().getScale();
return new Point(bounds.x + (this.lowDetailsStatusIconSize / 2 + 2) * (1 / scale), bounds.y);
}
return new Point(bounds.x + bounds.width / 2, bounds.y);
return new Point(bounds.x + bounds.width / 2, bounds.y - this.whenOffset);
}
return new Point(bounds.x + this.whenOffset, bounds.y + bounds.height / 2);
return new Point(bounds.x, bounds.y + bounds.height / 2);
}
}
2 changes: 1 addition & 1 deletion packages/module/src/pipelines/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const getEdgesFromNodes = (
finallyNodes.forEach(finallyNode => {
edges.push({
id: `${finallyId}-${finallyNode.id}`,
type: spacerEdgeType,
type: finallyEdgeType,
source: finallyId,
target: finallyNode.id
});
Expand Down

0 comments on commit 6480e46

Please sign in to comment.