fixes issue for withoutlabel shapes

This commit is contained in:
omkarht
2024-08-29 19:33:44 +05:30
parent ee84ed4236
commit eb341bdfb6
3 changed files with 12 additions and 10 deletions

View File

@@ -4,12 +4,15 @@ import type { SVG } from '$root/diagram-api/types.js';
// @ts-ignore TODO: Fix rough typings
import rough from 'roughjs';
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);
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 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 choiceShape = shapeSvg.insert(() => roughNode, ':first-child');
choiceShape.attr('class', 'basic label-container');
if (cssStyles && node.look !== 'handDrawn') {
choiceShape.selectAll('path').attr('style', cssStyles);
}

View File

@@ -1,14 +1,17 @@
import { getNodeClasses, labelHelper, updateNodeBounds } from './util.js';
import { getNodeClasses, updateNodeBounds } from './util.js';
import intersect from '../intersect/index.js';
import type { Node } from '$root/rendering-util/types.d.ts';
import type { SVG } from '$root/diagram-api/types.js';
import rough from 'roughjs';
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);
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;
let width = Math.max(70, node?.width ?? 0);

View File

@@ -39,8 +39,6 @@ export const stateEnd = (parent: SVG, node: Node) => {
const circle = shapeSvg.insert(() => roughNode, ':first-child');
circle.insert(() => roughInnerNode);
circle.attr('class', 'basic label-container');
if (cssStyles) {
circle.selectAll('path').attr('style', cssStyles);
}