Skip to content

Commit

Permalink
Merge pull request #598 from thomasleveil/pr/426
Browse files Browse the repository at this point in the history
fix #426 - add class .clickable on nodes with click function or link
  • Loading branch information
tylerlong authored Dec 26, 2017
2 parents c78d623 + 8cd0e3b commit 8edd89c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[Car]
click A "index.html#link-clicked" "link test"
click B testClick "click test"
</div>

<hr/>
Expand Down Expand Up @@ -101,5 +103,18 @@
<script>
mermaid.initialize({startOnLoad: true, theme: 'forest'});
</script>
<script>
function testClick(nodeId) {
console.log("clicked", nodeId);
var originalBgColor = document.querySelector('body').style.backgroundColor;
document.querySelector('body').style.backgroundColor = 'yellow';
setTimeout(function() {
document.querySelector('body').style.backgroundColor = originalBgColor;
}, 100);

}

</script>

</body>
</html>
2 changes: 2 additions & 0 deletions src/diagrams/flowchart/graphDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ export const setClickEvent = function (id, functionName, link, tooltip) {
setTooltip(id2, tooltip)
setClickFun(id2, functionName)
setLink(id2, link)
setClass(id, 'clickable')
})
} else {
setTooltip(id, tooltip)
setClickFun(id, functionName)
setLink(id, link)
setClass(id, 'clickable')
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/less/dark/flow.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
stroke-width: 1px;
}

.node.clickable {
cursor: pointer;
}

.arrowheadPath {
fill: @arrowheadColor;
}
Expand Down
4 changes: 4 additions & 0 deletions src/less/default/flow.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
stroke-width: 1px;
}

.node.clickable {
cursor: pointer;
}

.arrowheadPath {
fill: @arrowheadColor;
}
Expand Down
4 changes: 4 additions & 0 deletions src/less/forest/flow.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
stroke-width: 1px;
}

.node.clickable {
cursor: pointer;
}

.arrowheadPath {
fill: @arrowheadColor;
}
Expand Down

0 comments on commit 8edd89c

Please sign in to comment.