fixed issue for without label shapes

This commit is contained in:
omkarht
2024-08-29 19:51:12 +05:30
parent eb341bdfb6
commit f4d4c784e4
3 changed files with 22 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
import { log } from '$root/logger.js';
import { labelHelper, getNodeClasses, updateNodeBounds } from './util.js';
import { getNodeClasses, updateNodeBounds } from './util.js';
import type { SVG } from '$root/diagram-api/types.js';
import type { Node } from '$root/rendering-util/types.d.ts';
import {
styles2String,
@@ -22,11 +23,14 @@ function createLine(r: number) {
M ${pointQ1.x},${pointQ1.y} L ${pointQ3.x},${pointQ3.y}`;
}
export const crossedCircle = async (parent: SVGAElement, node: Node) => {
export const crossedCircle = (parent: SVG, node: Node) => {
const { labelStyles, nodeStyles } = styles2String(node);
node.labelStyle = labelStyles;
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 radius = Math.max(30, node?.width ?? 0);
const { cssStyles } = node;
@@ -46,8 +50,6 @@ export const crossedCircle = async (parent: SVGAElement, node: Node) => {
const crossedCircle = shapeSvg.insert(() => circleNode, ':first-child');
crossedCircle.insert(() => lineNode);
crossedCircle.attr('class', 'basic label-container');
if (cssStyles && node.look !== 'handDrawn') {
crossedCircle.selectAll('path').attr('style', cssStyles);
}

View File

@@ -1,6 +1,7 @@
import { log } from '$root/logger.js';
import { labelHelper, getNodeClasses, updateNodeBounds } from './util.js';
import { getNodeClasses, updateNodeBounds } from './util.js';
import type { Node } from '$root/rendering-util/types.d.ts';
import type { SVG } from '$root/diagram-api/types.js';
import {
styles2String,
userNodeOverrides,
@@ -8,11 +9,14 @@ import {
import rough from 'roughjs';
import intersect from '../intersect/index.js';
export const filledCircle = async (parent: SVGAElement, node: Node) => {
export const filledCircle = (parent: SVG, node: Node) => {
const { labelStyles, nodeStyles } = styles2String(node);
node.label = '';
node.labelStyle = labelStyles;
const { shapeSvg } = await labelHelper(parent, node, getNodeClasses(node));
const shapeSvg = parent
.insert('g')
.attr('class', getNodeClasses(node))
.attr('id', node.domId ?? node.id);
const radius = 7;
const { cssStyles } = node;
@@ -29,7 +33,7 @@ export const filledCircle = async (parent: SVGAElement, node: Node) => {
const filledCircle = shapeSvg.insert(() => circleNode, ':first-child');
filledCircle.attr('class', 'basic label-container');
// filledCircle.attr('class', 'basic label-container');
if (cssStyles && node.look !== 'handDrawn') {
filledCircle.selectAll('path').attr('style', cssStyles);

View File

@@ -1,6 +1,7 @@
import { log } from '$root/logger.js';
import { labelHelper, getNodeClasses, updateNodeBounds } from './util.js';
import { getNodeClasses, updateNodeBounds } from './util.js';
import type { Node } from '$root/rendering-util/types.d.ts';
import type { SVG } from '$root/diagram-api/types.js';
import {
styles2String,
userNodeOverrides,
@@ -9,11 +10,14 @@ import rough from 'roughjs';
import intersect from '../intersect/index.js';
import { createPathFromPoints } from './util.js';
export const lightningBolt = async (parent: SVGAElement, node: Node) => {
export const lightningBolt = (parent: SVG, node: Node) => {
const { labelStyles, nodeStyles } = styles2String(node);
node.label = '';
node.labelStyle = labelStyles;
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 height = 80;
const width = 80;
@@ -42,8 +46,6 @@ export const lightningBolt = async (parent: SVGAElement, node: Node) => {
const lightningBolt = shapeSvg.insert(() => lineNode, ':first-child');
lightningBolt.attr('class', 'basic label-container');
if (cssStyles && node.look !== 'handDrawn') {
lightningBolt.selectAll('path').attr('style', cssStyles);
}