Skip to content

Commit

Permalink
Merge pull request #306 from akaene/fix/isReference-icon
Browse files Browse the repository at this point in the history
Icon show only for isReference true
  • Loading branch information
blcham authored May 19, 2024
2 parents c6aa862 + 9f667b1 commit 4054887
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/editor/faultTree/shapes/RenderTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
} from "@components/editor/faultTree/shapes/constants";
import { getNodeWidthForText } from "@utils/treeUtils";

const referenceIcon =
"M3.9 7c0-1.71 1.39-3.1 3.1-3.1h4V2H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 8h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V12h4c2.76 0 5-2.24 5-5s-2.24-5-5-5";

const renderLink = (container, source, target, shouldHighlight) => {
// @ts-ignore
const link = Link.create(source, target);
Expand All @@ -33,10 +36,15 @@ const highlightCheck = (path, iri) => {

const renderTree = async (container, node, parentShape = null, pathsToHighlight) => {
const shouldHighlight = pathsToHighlight ? highlightCheck(pathsToHighlight, node.iri) : false;

// render node shape
let nodeShape = createShape(node);
nodeShape.addTo(container);

if (node.isReference && node.eventType === EventType.EXTERNAL) {
nodeShape.attr("icon/d", referenceIcon);
}

if (node.eventType === EventType.INTERMEDIATE) {
// @ts-ignore
nodeShape.gate(node.gateType.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const ExternalEvent = Event.define(
cursor: "pointer",
},
icon: {
d: "M3.9 7c0-1.71 1.39-3.1 3.1-3.1h4V2H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 8h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V12h4c2.76 0 5-2.24 5-5s-2.24-5-5-5",
d: "",
stroke: "none",
fill: MAIN_EVENT_BODY_COLOR,
},
Expand Down

0 comments on commit 4054887

Please sign in to comment.