mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 17:54:13 +01:00
feat: Mark diagrams capable of handDrawn
This commit is contained in:
@@ -10,6 +10,9 @@ export const diagram: DiagramDefinition = {
|
|||||||
get db() {
|
get db() {
|
||||||
return new ClassDB();
|
return new ClassDB();
|
||||||
},
|
},
|
||||||
|
capabilities: {
|
||||||
|
handDrawn: true,
|
||||||
|
},
|
||||||
renderer,
|
renderer,
|
||||||
styles,
|
styles,
|
||||||
init: (cnf) => {
|
init: (cnf) => {
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
import erParser from './parser/erDiagram.jison';
|
import erParser from './parser/erDiagram.jison';
|
||||||
import { ErDB } from './erDb.js';
|
import { ErDB } from './erDb.js';
|
||||||
import * as renderer from './erRenderer-unified.js';
|
import * as renderer from './erRenderer-unified.js';
|
||||||
import erStyles from './styles.js';
|
import styles from './styles.js';
|
||||||
|
|
||||||
export const diagram = {
|
export const diagram = {
|
||||||
parser: erParser,
|
parser: erParser,
|
||||||
get db() {
|
get db() {
|
||||||
return new ErDB();
|
return new ErDB();
|
||||||
},
|
},
|
||||||
|
capabilities: {
|
||||||
|
handDrawn: true,
|
||||||
|
},
|
||||||
renderer,
|
renderer,
|
||||||
styles: erStyles,
|
styles,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export const diagram = {
|
|||||||
return new FlowDB();
|
return new FlowDB();
|
||||||
},
|
},
|
||||||
renderer,
|
renderer,
|
||||||
|
capabilities: {
|
||||||
|
handDrawn: true,
|
||||||
|
},
|
||||||
styles: flowStyles,
|
styles: flowStyles,
|
||||||
init: (cnf: MermaidConfig) => {
|
init: (cnf: MermaidConfig) => {
|
||||||
if (!cnf.flowchart) {
|
if (!cnf.flowchart) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const draw: DrawDefinition = (text, id, _version, diagObj) => {
|
|||||||
const group: SVGGroup = svg.append('g');
|
const group: SVGGroup = svg.append('g');
|
||||||
group.attr('transform', 'translate(' + pieWidth / 2 + ',' + height / 2 + ')');
|
group.attr('transform', 'translate(' + pieWidth / 2 + ',' + height / 2 + ')');
|
||||||
|
|
||||||
const { themeVariables } = globalConfig;
|
const { themeVariables, look } = globalConfig;
|
||||||
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
|
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
|
||||||
outerStrokeWidth ??= 2;
|
outerStrokeWidth ??= 2;
|
||||||
|
|
||||||
@@ -59,12 +59,14 @@ export const draw: DrawDefinition = (text, id, _version, diagObj) => {
|
|||||||
.innerRadius(radius * textPosition)
|
.innerRadius(radius * textPosition)
|
||||||
.outerRadius(radius * textPosition);
|
.outerRadius(radius * textPosition);
|
||||||
|
|
||||||
group
|
if (look !== 'handDrawn') {
|
||||||
.append('circle')
|
group
|
||||||
.attr('cx', 0)
|
.append('circle')
|
||||||
.attr('cy', 0)
|
.attr('cx', 0)
|
||||||
.attr('r', radius + outerStrokeWidth / 2)
|
.attr('cy', 0)
|
||||||
.attr('class', 'pieOuterCircle');
|
.attr('r', radius + outerStrokeWidth / 2)
|
||||||
|
.attr('class', 'pieOuterCircle');
|
||||||
|
}
|
||||||
|
|
||||||
const sections: Sections = db.getSections();
|
const sections: Sections = db.getSections();
|
||||||
const arcs: d3.PieArcDatum<D3Section>[] = createPieArcs(sections);
|
const arcs: d3.PieArcDatum<D3Section>[] = createPieArcs(sections);
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ export const diagram: DiagramDefinition = {
|
|||||||
get db() {
|
get db() {
|
||||||
return new RequirementDB();
|
return new RequirementDB();
|
||||||
},
|
},
|
||||||
|
capabilities: {
|
||||||
|
handDrawn: true,
|
||||||
|
},
|
||||||
renderer,
|
renderer,
|
||||||
styles,
|
styles,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ export const diagram: DiagramDefinition = {
|
|||||||
get db() {
|
get db() {
|
||||||
return new StateDB(2);
|
return new StateDB(2);
|
||||||
},
|
},
|
||||||
|
capabilities: {
|
||||||
|
handDrawn: true,
|
||||||
|
},
|
||||||
renderer,
|
renderer,
|
||||||
styles,
|
styles,
|
||||||
init: (cnf) => {
|
init: (cnf) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user