Clean-up to avoid code duplication. Corrected neo-optins according to stephs design

This commit is contained in:
Per Brolin
2024-06-12 10:38:54 +02:00
parent 6842b316ec
commit 3af2c29d8f
5 changed files with 13 additions and 23 deletions

View File

@@ -89,7 +89,7 @@ stateDiagram-v2
</pre
>
<pre id="diagram" class="mermaid2">
<pre id="diagram" class="mermaid">
stateDiagram
[*] --> Still
Still --> [*]
@@ -102,7 +102,7 @@ stateDiagram-v2
</pre>
<pre id="diagram" class="mermaid">
<pre id="diagram" class="mermaid2">
stateDiagram
direction LR
[*] --> A

View File

@@ -101,7 +101,7 @@ g.stateGroup line {
}
.node circle.state-end {
fill: ${options.innerEndBackground};
fill: ${options.stateBkg || options.mainBkg};
stroke: ${options.background};
stroke-width: 1.5
}

View File

@@ -44,26 +44,16 @@ export const drawRect = async (parent: SVGAElement, node: Node, options: RectOpt
rect = shapeSvg.insert(() => roughNode, ':first-child');
rect.attr('class', 'basic label-container').attr('style', cssStyles);
} else if (node.look === 'neo') {
// TODO: Take theme and look into account
rect = shapeSvg.insert('rect', ':first-child');
rect
.attr('class', 'basic label-container state-shadow-neo')
.attr('style', cssStyles)
.attr('rx', rx)
.attr('data-id', 'abc')
.attr('data-et', 'node')
.attr('ry', ry)
.attr('x', x)
.attr('y', y)
.attr('width', totalWidth)
.attr('height', totalHeight);
} else {
rect = shapeSvg.insert('rect', ':first-child');
let rectClass = 'basic label-container';
if (node.look === 'neo') {
rectClass += ' state-shadow-neo';
}
rect
.attr('class', 'basic label-container')
.attr('class', rectClass)
.attr('style', cssStyles)
.attr('rx', rx)
.attr('data-id', 'abc')

View File

@@ -6,8 +6,8 @@ export const roundedRect = async (parent: SVGAElement, node: Node) => {
const { look } = getConfig();
node.look = look;
const options = {
rx: node.look === 'neo' ? 1 : 5,
ry: node.look === 'neo' ? 1 : 5,
rx: node.look === 'neo' ? 3 : 5,
ry: node.look === 'neo' ? 3 : 5,
labelPaddingX: node.padding * 2,
labelPaddingY: node.padding * 1,

View File

@@ -7,8 +7,8 @@ export const state = async (parent: SVGAElement, node: Node) => {
node.look = look;
const options = {
rx: node.look === 'neo' ? 2 : 5,
ry: node.look === 'neo' ? 2 : 5,
rx: node.look === 'neo' ? 3 : 5,
ry: node.look === 'neo' ? 3 : 5,
classes: 'flowchart-node',
};
return drawRect(parent, node, options);