mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
This commit is contained in:
@@ -1,13 +1,29 @@
|
|||||||
import mermaid from '../../dist/mermaid.core';
|
import mermaid from '../../dist/mermaid.core';
|
||||||
|
|
||||||
const code = `graph LR
|
let code = `flowchart LR
|
||||||
Power_Supply --> Transmitter_A
|
Power_Supply --> Transmitter_A
|
||||||
Power_Supply --> Transmitter_B
|
Power_Supply --> Transmitter_B
|
||||||
Transmitter_A --> D
|
Transmitter_A --> D
|
||||||
Transmitter_B --> D`;
|
Transmitter_B --> D`;
|
||||||
|
|
||||||
|
let code2 = `gantt
|
||||||
|
dateFormat YYYY-MM-DD
|
||||||
|
title Adding GANTT diagram functionality to mermaid
|
||||||
|
section A section
|
||||||
|
Completed task :done, des1, 2014-01-06,2014-01-08
|
||||||
|
Active task :active, des2, 2014-01-09, 3d
|
||||||
|
Future task : des3, after des2, 5d
|
||||||
|
Future task2 : des4, after des3, 5d
|
||||||
|
section Critical tasks
|
||||||
|
Completed task in the critical line :crit, done, 2014-01-06,24h
|
||||||
|
Implement parser and jison :crit, done, after des1, 2d
|
||||||
|
Create tests for parser :crit, active, 3d
|
||||||
|
Future task in critical line :crit, 5d
|
||||||
|
Create tests for renderer :2d
|
||||||
|
Add to mermaid :1d`;
|
||||||
|
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'default',
|
||||||
fontFamily: '"Lucida Console", Monaco, monospace',
|
fontFamily: '"Lucida Console", Monaco, monospace',
|
||||||
startOnLoad: false,
|
startOnLoad: false,
|
||||||
flowchart: {
|
flowchart: {
|
||||||
|
@@ -16,10 +16,15 @@ function intersectPolygon(node, polyPoints, point) {
|
|||||||
|
|
||||||
var minX = Number.POSITIVE_INFINITY;
|
var minX = Number.POSITIVE_INFINITY;
|
||||||
var minY = Number.POSITIVE_INFINITY;
|
var minY = Number.POSITIVE_INFINITY;
|
||||||
polyPoints.forEach(function(entry) {
|
if (typeof polyPoints.forEach === 'function') {
|
||||||
minX = Math.min(minX, entry.x);
|
polyPoints.forEach(function(entry) {
|
||||||
minY = Math.min(minY, entry.y);
|
minX = Math.min(minX, entry.x);
|
||||||
});
|
minY = Math.min(minY, entry.y);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
minX = Math.min(minX, polyPoints.x);
|
||||||
|
minY = Math.min(minY, polyPoints.y);
|
||||||
|
}
|
||||||
|
|
||||||
var left = x1 - node.width / 2 - minX;
|
var left = x1 - node.width / 2 - minX;
|
||||||
var top = y1 - node.height / 2 - minY;
|
var top = y1 - node.height / 2 - minY;
|
||||||
|
Reference in New Issue
Block a user