Skip to content

Commit

Permalink
Merge pull request #49 from kieler/jep/elkFix
Browse files Browse the repository at this point in the history
Jep/elk fix
  • Loading branch information
Drakae authored Dec 19, 2024
2 parents 746775b + 08c461e commit 4d6b2ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function createPort(id: string, side: PortSide, assocEdge?: { node1: stri
type: PORT_TYPE,
id: id,
side: side,
size: {width: 1, height: 1},
associatedEdge: assocEdge,
};
}
Expand Down
4 changes: 4 additions & 0 deletions extension/src-webview/css/diagram.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
font-weight: bold;
}

.pasta-hidden {
opacity: 0;
}

/* sprotty and black/white colors */
.vscode-high-contrast .print-node {
fill: black;
Expand Down
5 changes: 3 additions & 2 deletions extension/src-webview/stpa/stpa-views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Point, toDegrees } from "sprotty-protocol";
import { DISymbol } from '../di.symbols';
import { ColorStyleOption, DifferentFormsOption, RenderOptionsRegistry } from '../options/render-options-registry';
import { SendModelRendererAction } from '../snippets/actions';
import { renderDiamond, renderHexagon, renderMirroredTriangle, renderOval, renderPentagon, renderRectangle, renderRoundedRectangle, renderTrapez, renderTriangle } from '../views-rendering';
import { renderDiamond, renderHexagon, renderMirroredTriangle, renderOval, renderPentagon, renderPort, renderRectangle, renderRoundedRectangle, renderTrapez, renderTriangle } from '../views-rendering';
import { collectAllChildren } from './helper-methods';
import { CSEdge, CSNode, CS_EDGE_TYPE, CS_INTERMEDIATE_EDGE_TYPE, CS_NODE_TYPE, EdgeType, STPAAspect, STPAEdge, STPANode, STPA_EDGE_TYPE, STPA_INTERMEDIATE_EDGE_TYPE } from './stpa-model';

Expand Down Expand Up @@ -261,7 +261,8 @@ export class STPAGraphView extends SGraphView {
@injectable()
export class PortView implements IView {
render(model: SPortImpl, context: RenderingContext): VNode {
return <g />;
const port = <g>{renderPort(model.position.x, model.position.y, model.size.width, model.size.height)}</g>;
return <g class-pasta-hidden>{port}</g>;
}
}

Expand Down
7 changes: 7 additions & 0 deletions extension/src-webview/views-rendering.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export function renderRectangle(node: SNodeImpl): VNode {
/>;
}

export function renderPort(x:number, y: number, width: number, height: number): VNode {
return <rect
x={x} y={y}
width={Math.max(width, 0)} height={Math.max(height, 0)}
/>;
}

/**
* Creates rectangle borders for {@code node} at the top and bottom.
* @param node The node that should be represented by a rectangle.
Expand Down

0 comments on commit 4d6b2ce

Please # to comment.