graflow: fix1 to ortho wires
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<style>
|
||||
.bzgf-node {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
width: 160px;
|
||||
height: 80px;
|
||||
color: black;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
padding: .5em;
|
||||
}
|
||||
.bzgf-node .body{
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--eicui-base-color-grey-25);
|
||||
border:2px solid var(--eicui-base-color-grey-50);
|
||||
border-radius: 6px;
|
||||
}
|
||||
.bzgf-node .title {
|
||||
font-weight: bold;
|
||||
color: var(--app-color-black);
|
||||
margin: .5em auto .2em auto;
|
||||
}
|
||||
.bzgf-node .subtitle {
|
||||
font-size: .9em;
|
||||
color: var(--eicui-base-color-primary-100);
|
||||
width: 90%;
|
||||
margin: auto;
|
||||
}
|
||||
.bzgf-node .port{
|
||||
position: absolute;
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
background: var(--eicui-base-color-info-25);
|
||||
opacity: 0;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.bzgf-node [data-direction="n"]{ top: -4px; left: 50%; transform: translateX(-50%);}
|
||||
.bzgf-node [data-direction="s"]{ bottom: -4px; left: 50%; transform: translateX(-50%);}
|
||||
.bzgf-node [data-direction="w"]{ left: -4px; top: 50%; transform: translateY(-50%);}
|
||||
.bzgf-node [data-direction="e"]{ right: -4px; top: 50%; transform: translateY(-50%);}
|
||||
|
||||
.bzgf-node[data-nodetype="refnodein"], .bzgf-node[data-nodetype="refnodeout"] {
|
||||
width:3em;
|
||||
height:3em;
|
||||
padding: 2px;
|
||||
}
|
||||
.bzgf-node[data-nodetype="refnodein"] .body, .bzgf-node[data-nodetype="refnodeout"] .body{
|
||||
border-radius: 50%;
|
||||
width: 3em;
|
||||
height: 3em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bzgf-node[data-nodetype="refnodein"] .body, .bzgf-node[data-nodetype="refnodeout"] .body{ background: var(--eicui-base-color-grey-25); }
|
||||
|
||||
.bzgf-wire{ stroke: var(--eicui-base-color-info); stroke-width: 4px; stroke-dasharray: 10,5; }
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="eicBasic">
|
||||
<div class="body">
|
||||
<div class="title">{title}</div>
|
||||
<div class="subtitle">{subtitle}</div>
|
||||
</div>
|
||||
<div class="port" data-type="in" data-id="in1" data-direction="w"></div>
|
||||
<div class="port" data-type="out" data-id="out1" data-direction="e"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="refnodein">
|
||||
<div class="body">{parentport}</div>
|
||||
<div class="port" data-type="out" data-id="out1" data-direction="e"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="refnodeout">
|
||||
<div class="body">{parentport}</div>
|
||||
<div class="port" data-type="in" data-id="in1" data-direction="w"></div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -12,6 +12,7 @@
|
||||
<li><a href="./test2.html">test2 (organigram) + ISOLATED</a></li>
|
||||
<li><a href="./test3.html">test3 (EIC simple + subflow + NON-ISOLATED)</a></li>
|
||||
<li><a href="./test4.html">test4 (EIC-ICMP + NON-ISOLATED)</a></li>
|
||||
<li><a href="./test4.5.html">test4.5 (EIC-ICMP + NON-ISOLATED + single-port)</a></li>
|
||||
<li><a href="./test5.html">test5 (P42 graph + ISOLATED + EDITABLE)</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
@@ -65,10 +65,12 @@
|
||||
document.querySelector('[data-trigger="onAutoplace1V"]').addEventListener('click',
|
||||
(evt) => { grflw1.autoPlace('vertical', 80, 30, 1000, document.querySelector('[data-id="compunet"]').value) }
|
||||
)
|
||||
|
||||
document.querySelector('input[data-id="compunet"]').addEventListener('change',
|
||||
(evt) => { grflw1.setAttribute('tension', evt.target.value); grflw1.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw1.setAttribute('wiretype', evt.target.value); grflw1.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
@@ -84,6 +86,11 @@
|
||||
<option value="last">Last</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="compunet" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
@@ -65,10 +65,12 @@
|
||||
document.querySelector('[data-trigger="onAutoplace3V"]').addEventListener('click',
|
||||
(evt) => { grflw3.autoPlace('vertical', 80, 30, 1000, document.querySelector('[data-id="organi"]').value) }
|
||||
)
|
||||
|
||||
document.querySelector('input[data-id="organi"]').addEventListener('change',
|
||||
(evt) => { grflw3.setAttribute('tension', evt.target.value); grflw3.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw3.setAttribute('wiretype', evt.target.value); grflw3.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
@@ -84,6 +86,11 @@
|
||||
<option value="last">Last</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="organi" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
@@ -68,6 +68,9 @@
|
||||
document.querySelector('input[data-id="eic"]').addEventListener('change',
|
||||
(evt) => { grflw2.setAttribute('tension', evt.target.value); grflw2.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw2.setAttribute('wiretype', evt.target.value); grflw2.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
@@ -83,6 +86,11 @@
|
||||
<option value="last">Last</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="eic" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../../thirdparty/buildoz/buildoz.css">
|
||||
<script src="../../thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="../../thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
body{
|
||||
display: grid;
|
||||
grid-gap: 5px;
|
||||
background:#888;
|
||||
font-size: 16px;
|
||||
}
|
||||
.demooptions{
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
width: 10em;
|
||||
background: #FFFB;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
z-index:999999;
|
||||
font-size: .7em;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
.demooptions button{
|
||||
text-transform: none;
|
||||
margin: 2px;
|
||||
font-size: 1em;
|
||||
}
|
||||
bz-graflow{
|
||||
overflow: scroll;
|
||||
border: 2px solid black;
|
||||
}
|
||||
bz-graflow.icmp{ grid-column: 1 / -1; width: 100vw; height: 80vh; background: var(--eicui-base-color-grey-10); }
|
||||
</style>
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw4 = document.querySelector('bz-graflow.icmp')
|
||||
grflw4.addEventListener('subflowLoaded',
|
||||
(evt) => { grflw4 = evt.detail.subflow }
|
||||
)
|
||||
grflw4.addEventListener('subflowExited',
|
||||
(evt) => { grflw4 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace4H"]').addEventListener('click',
|
||||
(evt) => { grflw4.autoPlace('horizontal', 100, 30, 1000, document.querySelector('[data-id="icmp"]').value) }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace4V"]').addEventListener('click',
|
||||
(evt) => { grflw4.autoPlace('vertical', 80, 80, 1000, document.querySelector('[data-id="icmp"]').value) }
|
||||
)
|
||||
document.querySelector('input[data-id="icmp"]').addEventListener('change',
|
||||
(evt) => { grflw4.setAttribute('tension', evt.target.value); grflw4.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw4.setAttribute('wiretype', evt.target.value); grflw4.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="icmp" flow="/app/assets/json/bzGraflow/testFlowICMP2.json" tension="60">
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace4H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace4V">Auto-place Vertical</button>
|
||||
<select name="align" data-id="icmp">
|
||||
<option value="center">Center</option>
|
||||
<option value="first">First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="icmp" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
</body>
|
||||
</html>
|
||||
@@ -65,10 +65,12 @@
|
||||
document.querySelector('[data-trigger="onAutoplace4V"]').addEventListener('click',
|
||||
(evt) => { grflw4.autoPlace('vertical', 80, 80, 1000, document.querySelector('[data-id="icmp"]').value) }
|
||||
)
|
||||
|
||||
document.querySelector('input[data-id="icmp"]').addEventListener('change',
|
||||
(evt) => { grflw4.setAttribute('tension', evt.target.value); grflw4.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw4.setAttribute('wiretype', evt.target.value); grflw4.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
@@ -84,6 +86,11 @@
|
||||
<option value="last">Last</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="icmp" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
@@ -65,12 +65,11 @@
|
||||
document.querySelector('[data-trigger="onAutoplace1V"]').addEventListener('click',
|
||||
(evt) => { grflw1.autoPlace('vertical', 80, 30, 1000, document.querySelector('[data-id="compunet"]').value) }
|
||||
)
|
||||
|
||||
document.querySelector('input[data-id="compunet"]').addEventListener('change',
|
||||
(evt) => { grflw1.setAttribute('tension', evt.target.value); grflw1.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw1.setAttribute('wiretype', evt.target.value); console.log('wiretype changed to', evt.target.value); grflw1.refresh() }
|
||||
(evt) => { grflw1.setAttribute('wiretype', evt.target.value); grflw1.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
@@ -87,7 +86,7 @@
|
||||
<option value="last">Last</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
<select name="wiretype" data-id="compunet">
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"nodesFile": "/app/assets/html/bzGraflow/nodesEIC2.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "eval",
|
||||
"markup": {
|
||||
"title": "Evaluations",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": { "node": "eval", "nodeId":null}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "gap",
|
||||
"ncoords": { "x": 100, "y": 220},
|
||||
"markup": {
|
||||
"title": "GAP",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": { "a": "a2", "b":"b2"}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "cid",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "CID",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": { "a": "a3", "b":"b3"}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "allocation",
|
||||
"markup": {
|
||||
"title": "Case Allocation",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "signature",
|
||||
"markup": {
|
||||
"title": "Grant Signature",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "grant"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "progress-meeting",
|
||||
"markup": {
|
||||
"title": "Progress Meetings",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "grant",
|
||||
"instanciable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "techdd",
|
||||
"markup": {
|
||||
"title": "Tech Due Diligences",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "kyc",
|
||||
"markup": {
|
||||
"title": "KYC",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "aifm-advisory",
|
||||
"markup": {
|
||||
"title": "AIFM Advisory Commitee",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "aifm-investment",
|
||||
"markup": {
|
||||
"title": "AIFM Investment Commitee",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity",
|
||||
"parent": "aifm-advisory"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeType": "eicBasic",
|
||||
"id": "agreement",
|
||||
"markup": {
|
||||
"title": "Investment Agreement",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity",
|
||||
"parent": "aifm-investment"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
{ "from": ["eval", "out1"], "to": ["gap", "in1"] },
|
||||
{ "from": ["eval", "out1"], "to": ["cid", "in1"] },
|
||||
{ "from": ["eval", "out1"], "to": ["allocation", "in1"] },
|
||||
{ "from": ["gap", "out1"], "to": ["signature", "in1"] },
|
||||
{ "from": ["signature", "out1"], "to": ["progress-meeting", "in1"] },
|
||||
{ "from": ["cid", "out1"], "to": ["techdd", "in1"] },
|
||||
{ "from": ["allocation", "out1"], "to": ["techdd", "in1"] },
|
||||
{ "from": ["allocation", "out1"], "to": ["kyc", "in1"] },
|
||||
{ "from": ["techdd", "out1"], "to": ["aifm-advisory", "in1"] },
|
||||
{ "from": ["kyc", "out1"], "to": ["aifm-advisory", "in1"] },
|
||||
{ "from": ["aifm-advisory", "out1"], "to": ["aifm-investment", "in1"] },
|
||||
{ "from": ["aifm-investment", "out1"], "to": ["agreement", "in1"] },
|
||||
{ "from": ["gap", "out1"], "to": ["aifm-investment", "in1"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+20
-6
@@ -499,14 +499,19 @@ class BZgraflow extends Buildoz{
|
||||
return(`M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`)
|
||||
}
|
||||
if(wireType === 'straight') {
|
||||
console.log('straight')
|
||||
// Straight segments through the same control points
|
||||
return(`M ${x1} ${y1} L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`)
|
||||
}
|
||||
return('')
|
||||
//return(`M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`)
|
||||
if(wireType === 'ortho') {
|
||||
let path = `M ${x1} ${y1} `
|
||||
if(['n', 's'].includes(port1.direction)) {
|
||||
path += `V ${(c1y+c2y)/2} H ${c2x} V ${y2}`
|
||||
} else {
|
||||
path += `H ${(c1x+c2x)/2} V ${c2y} H ${x2}`
|
||||
}
|
||||
return(path)
|
||||
}
|
||||
return('')
|
||||
}
|
||||
|
||||
linkInterNodes(idNode1, idPort1, idNode2, idPort2, interNodes, orientation='horizontal') {
|
||||
const tension = parseInt(this.getBZAttribute('tension')) || 60
|
||||
const wireType = this.getBZAttribute('wiretype') || 'bezier'
|
||||
@@ -541,7 +546,16 @@ class BZgraflow extends Buildoz{
|
||||
if(wireType === 'straight') {
|
||||
return(`L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`)
|
||||
}
|
||||
return(`C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`)
|
||||
if(wireType === 'ortho') {
|
||||
let path = `M ${x1} ${y1} `
|
||||
if(['n', 's'].includes(port1.direction)) {
|
||||
path += `V ${(c1y+c2y)/2} H ${c2x} V ${y2}`
|
||||
} else {
|
||||
path += `H ${(c1x+c2x)/2} V ${c2y} H ${x2}`
|
||||
}
|
||||
return(path)
|
||||
}
|
||||
return(``)
|
||||
}
|
||||
|
||||
// Start/end points in SVG coords (works for both bezier and line)
|
||||
|
||||
Reference in New Issue
Block a user