mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-22 17:56:43 +02:00
fixes issue for withoutlabel shapes
This commit is contained in:
@@ -4,12 +4,15 @@ import type { SVG } from '$root/diagram-api/types.js';
|
|||||||
// @ts-ignore TODO: Fix rough typings
|
// @ts-ignore TODO: Fix rough typings
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
import { createPathFromPoints, getNodeClasses, labelHelper } from './util.js';
|
import { createPathFromPoints, getNodeClasses } from './util.js';
|
||||||
|
|
||||||
export const choice = async (parent: SVG, node: Node) => {
|
export const choice = (parent: SVG, node: Node) => {
|
||||||
const { nodeStyles } = styles2String(node);
|
const { nodeStyles } = styles2String(node);
|
||||||
node.label = '';
|
node.label = '';
|
||||||
const { shapeSvg } = await labelHelper(parent, node, getNodeClasses(node));
|
const shapeSvg = parent
|
||||||
|
.insert('g')
|
||||||
|
.attr('class', getNodeClasses(node))
|
||||||
|
.attr('id', node.domId ?? node.id);
|
||||||
const { cssStyles } = node;
|
const { cssStyles } = node;
|
||||||
|
|
||||||
const s = Math.max(28, node.width ?? 0);
|
const s = Math.max(28, node.width ?? 0);
|
||||||
@@ -34,8 +37,6 @@ export const choice = async (parent: SVG, node: Node) => {
|
|||||||
const roughNode = rc.path(choicePath, options);
|
const roughNode = rc.path(choicePath, options);
|
||||||
const choiceShape = shapeSvg.insert(() => roughNode, ':first-child');
|
const choiceShape = shapeSvg.insert(() => roughNode, ':first-child');
|
||||||
|
|
||||||
choiceShape.attr('class', 'basic label-container');
|
|
||||||
|
|
||||||
if (cssStyles && node.look !== 'handDrawn') {
|
if (cssStyles && node.look !== 'handDrawn') {
|
||||||
choiceShape.selectAll('path').attr('style', cssStyles);
|
choiceShape.selectAll('path').attr('style', cssStyles);
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,17 @@
|
|||||||
import { getNodeClasses, labelHelper, updateNodeBounds } from './util.js';
|
import { getNodeClasses, updateNodeBounds } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '$root/rendering-util/types.d.ts';
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '$root/diagram-api/types.js';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
|
|
||||||
export const forkJoin = async (parent: SVG, node: Node, dir: string) => {
|
export const forkJoin = (parent: SVG, node: Node, dir: string) => {
|
||||||
const { nodeStyles } = styles2String(node);
|
const { nodeStyles } = styles2String(node);
|
||||||
node.label = '';
|
node.label = '';
|
||||||
const { shapeSvg } = await labelHelper(parent, node, getNodeClasses(node));
|
const shapeSvg = parent
|
||||||
|
.insert('g')
|
||||||
|
.attr('class', getNodeClasses(node))
|
||||||
|
.attr('id', node.domId ?? node.id);
|
||||||
|
|
||||||
const { cssStyles } = node;
|
const { cssStyles } = node;
|
||||||
let width = Math.max(70, node?.width ?? 0);
|
let width = Math.max(70, node?.width ?? 0);
|
||||||
|
@@ -39,8 +39,6 @@ export const stateEnd = (parent: SVG, node: Node) => {
|
|||||||
const circle = shapeSvg.insert(() => roughNode, ':first-child');
|
const circle = shapeSvg.insert(() => roughNode, ':first-child');
|
||||||
circle.insert(() => roughInnerNode);
|
circle.insert(() => roughInnerNode);
|
||||||
|
|
||||||
circle.attr('class', 'basic label-container');
|
|
||||||
|
|
||||||
if (cssStyles) {
|
if (cssStyles) {
|
||||||
circle.selectAll('path').attr('style', cssStyles);
|
circle.selectAll('path').attr('style', cssStyles);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user