Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jep/elk fix #49

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading