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">
|
||||
stateDiagram
|
||||
StateID
|
||||
StateA
|
||||
|
||||
|
||||
|
||||
|
@@ -68,7 +68,7 @@ export interface MermaidConfig {
|
||||
* 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.
|
||||
*
|
||||
|
@@ -7,6 +7,7 @@ import { setupViewPortForSVG } from '../../rendering-util/setupViewPortForSVG.js
|
||||
import type { LayoutData } from '../../rendering-util/types.js';
|
||||
import utils from '../../utils.js';
|
||||
import { CSS_DIAGRAM, DEFAULT_NESTED_DOC_DIR } from './stateCommon.js';
|
||||
import { lookUpDomId } from '../flowchart/flowDb';
|
||||
|
||||
/**
|
||||
* Get the direction from the statement items.
|
||||
@@ -83,11 +84,14 @@ export const draw = async function (
|
||||
const config = getConfig();
|
||||
if (config.look === 'neo') {
|
||||
data4Layout.markers = ['barbNeo'];
|
||||
data4Layout.nodes.forEach((node) => {
|
||||
node.look = 'neo';
|
||||
});
|
||||
} else {
|
||||
data4Layout.markers = ['barb'];
|
||||
}
|
||||
data4Layout.diagramId = id;
|
||||
// console.log('REF1:', data4Layout);
|
||||
console.log('REF1:', data4Layout);
|
||||
await render(data4Layout, svg, element, positions);
|
||||
const padding = 8;
|
||||
utils.insertTitle(
|
||||
|
@@ -23,7 +23,6 @@ export const drawRect = async (parent: SVGAElement, node: Node, options: RectOpt
|
||||
const y = -totalHeight / 2;
|
||||
|
||||
let rect;
|
||||
node.look = look;
|
||||
let { rx, ry } = node;
|
||||
const { cssStyles } = node;
|
||||
|
||||
|
@@ -4,7 +4,6 @@ import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
||||
|
||||
export const roundedRect = async (parent: SVGAElement, node: Node) => {
|
||||
const { look } = getConfig();
|
||||
node.look = look;
|
||||
const options = {
|
||||
rx: 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) => {
|
||||
const { look } = getConfig();
|
||||
node.look = look;
|
||||
|
||||
const options = {
|
||||
rx: node.look === 'neo' ? 3 : 5,
|
||||
ry: node.look === 'neo' ? 3 : 5,
|
||||
|
@@ -78,6 +78,7 @@ properties:
|
||||
enum:
|
||||
- classic
|
||||
- handdrawn
|
||||
- neo
|
||||
default: 'classic'
|
||||
handdrawnSeed:
|
||||
description: |
|
||||
|
Reference in New Issue
Block a user