mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 00:40:22 +02:00
MC-1765: Removed hard-coded setting of look in render-utils
This commit is contained in:
@@ -91,7 +91,7 @@ stateDiagram-v2
|
|||||||
|
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
stateDiagram
|
stateDiagram
|
||||||
StateID
|
StateA
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ export interface MermaidConfig {
|
|||||||
* Defines which main look to use for the diagram.
|
* Defines which main look to use for the diagram.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
look?: 'classic' | 'handdrawn';
|
look?: 'classic' | 'handdrawn' | 'neo';
|
||||||
/**
|
/**
|
||||||
* Defines the seed to be used when using handdrawn look. This is important for the automated tests as they will always find differences without the seed. The default value is 0 which gives a random seed.
|
* Defines the seed to be used when using handdrawn look. This is important for the automated tests as they will always find differences without the seed. The default value is 0 which gives a random seed.
|
||||||
*
|
*
|
||||||
|
@@ -7,6 +7,7 @@ import { setupViewPortForSVG } from '../../rendering-util/setupViewPortForSVG.js
|
|||||||
import type { LayoutData } from '../../rendering-util/types.js';
|
import type { LayoutData } from '../../rendering-util/types.js';
|
||||||
import utils from '../../utils.js';
|
import utils from '../../utils.js';
|
||||||
import { CSS_DIAGRAM, DEFAULT_NESTED_DOC_DIR } from './stateCommon.js';
|
import { CSS_DIAGRAM, DEFAULT_NESTED_DOC_DIR } from './stateCommon.js';
|
||||||
|
import { lookUpDomId } from '../flowchart/flowDb';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the direction from the statement items.
|
* Get the direction from the statement items.
|
||||||
@@ -83,11 +84,14 @@ export const draw = async function (
|
|||||||
const config = getConfig();
|
const config = getConfig();
|
||||||
if (config.look === 'neo') {
|
if (config.look === 'neo') {
|
||||||
data4Layout.markers = ['barbNeo'];
|
data4Layout.markers = ['barbNeo'];
|
||||||
|
data4Layout.nodes.forEach((node) => {
|
||||||
|
node.look = 'neo';
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
data4Layout.markers = ['barb'];
|
data4Layout.markers = ['barb'];
|
||||||
}
|
}
|
||||||
data4Layout.diagramId = id;
|
data4Layout.diagramId = id;
|
||||||
// console.log('REF1:', data4Layout);
|
console.log('REF1:', data4Layout);
|
||||||
await render(data4Layout, svg, element, positions);
|
await render(data4Layout, svg, element, positions);
|
||||||
const padding = 8;
|
const padding = 8;
|
||||||
utils.insertTitle(
|
utils.insertTitle(
|
||||||
|
@@ -23,7 +23,6 @@ export const drawRect = async (parent: SVGAElement, node: Node, options: RectOpt
|
|||||||
const y = -totalHeight / 2;
|
const y = -totalHeight / 2;
|
||||||
|
|
||||||
let rect;
|
let rect;
|
||||||
node.look = look;
|
|
||||||
let { rx, ry } = node;
|
let { rx, ry } = node;
|
||||||
const { cssStyles } = node;
|
const { cssStyles } = node;
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@ import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
|||||||
|
|
||||||
export const roundedRect = async (parent: SVGAElement, node: Node) => {
|
export const roundedRect = async (parent: SVGAElement, node: Node) => {
|
||||||
const { look } = getConfig();
|
const { look } = getConfig();
|
||||||
node.look = look;
|
|
||||||
const options = {
|
const options = {
|
||||||
rx: node.look === 'neo' ? 3 : 5,
|
rx: node.look === 'neo' ? 3 : 5,
|
||||||
ry: node.look === 'neo' ? 3 : 5,
|
ry: node.look === 'neo' ? 3 : 5,
|
||||||
|
@@ -4,8 +4,6 @@ import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
|||||||
|
|
||||||
export const state = async (parent: SVGAElement, node: Node) => {
|
export const state = async (parent: SVGAElement, node: Node) => {
|
||||||
const { look } = getConfig();
|
const { look } = getConfig();
|
||||||
node.look = look;
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
rx: node.look === 'neo' ? 3 : 5,
|
rx: node.look === 'neo' ? 3 : 5,
|
||||||
ry: node.look === 'neo' ? 3 : 5,
|
ry: node.look === 'neo' ? 3 : 5,
|
||||||
|
@@ -78,6 +78,7 @@ properties:
|
|||||||
enum:
|
enum:
|
||||||
- classic
|
- classic
|
||||||
- handdrawn
|
- handdrawn
|
||||||
|
- neo
|
||||||
default: 'classic'
|
default: 'classic'
|
||||||
handdrawnSeed:
|
handdrawnSeed:
|
||||||
description: |
|
description: |
|
||||||
|
Reference in New Issue
Block a user