mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-27 03:09:43 +02:00
#1386 Adding support for click events and links
This commit is contained in:
@@ -34,8 +34,10 @@ export const insertEdgeLabel = (elem, edge) => {
|
||||
|
||||
export const positionEdgeLabel = edge => {
|
||||
logger.info('Moving label', edge.id, edge.label, edgeLabels[edge.id]);
|
||||
const el = edgeLabels[edge.id];
|
||||
el.attr('transform', 'translate(' + edge.x + ', ' + edge.y + ')');
|
||||
if (edge.label) {
|
||||
const el = edgeLabels[edge.id];
|
||||
el.attr('transform', 'translate(' + edge.x + ', ' + edge.y + ')');
|
||||
}
|
||||
};
|
||||
|
||||
// const getRelationType = function(type) {
|
||||
|
@@ -255,7 +255,7 @@ const rect = (parent, node) => {
|
||||
const rect = shapeSvg.insert('rect', ':first-child');
|
||||
|
||||
rect
|
||||
.attr('class', 'basic')
|
||||
.attr('class', 'basic label-container')
|
||||
.attr('rx', node.rx)
|
||||
.attr('ry', node.ry)
|
||||
.attr('x', -bbox.width / 2 - halfPadding)
|
||||
|
@@ -46,5 +46,6 @@ export function insertPolygonShape(parent, w, h, points) {
|
||||
})
|
||||
.join(' ')
|
||||
)
|
||||
.attr('class', 'label-container')
|
||||
.attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
|
||||
}
|
||||
|
@@ -424,7 +424,7 @@ export const draw = function(text, id) {
|
||||
}
|
||||
|
||||
// Add label rects for non html labels
|
||||
if (!conf.htmlLabels) {
|
||||
if (!conf.htmlLabels || true) { // eslint-disable-line
|
||||
const labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||
for (let k = 0; k < labels.length; k++) {
|
||||
const label = labels[k];
|
||||
|
@@ -736,7 +736,7 @@ const render = function(id, _txt, cb, container) {
|
||||
}
|
||||
|
||||
// classDef
|
||||
if (graphType === 'flowchart') {
|
||||
if (graphType === 'flowchart' || graphType === 'flowchart-v2') {
|
||||
const classes = flowRenderer.getClasses(txt);
|
||||
for (const className in classes) {
|
||||
style += `\n.${className} > * { ${classes[className].styles.join(
|
||||
@@ -858,6 +858,7 @@ const render = function(id, _txt, cb, container) {
|
||||
if (typeof cb !== 'undefined') {
|
||||
switch (graphType) {
|
||||
case 'flowchart':
|
||||
case 'flowchart-v2':
|
||||
cb(svgCode, flowDb.bindFunctions);
|
||||
break;
|
||||
case 'gantt':
|
||||
|
Reference in New Issue
Block a user