graflow: test for all directions

This commit is contained in:
STEINNI
2026-03-02 21:27:33 +00:00
parent 30a95ca009
commit f81ae0611c
5 changed files with 222 additions and 10 deletions
@@ -0,0 +1,59 @@
<style>
.bzgf-node {
font-family: Arial, Helvetica, sans-serif;
width: 50px;
height: 50px;
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);
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-wire{ stroke: var(--eicui-base-color-info); stroke-width: 4px; stroke-dasharray: 10,5; }
</style>
<template>
<div class="bzgf-node" data-nodetype="square">
<div class="body">
<div class="title">{title}</div>
<div class="subtitle">{subtitle}</div>
</div>
<div class="port" data-id="w" data-direction="w"></div>
<div class="port" data-id="n" data-direction="n"></div>
<div class="port" data-id="e" data-direction="e"></div>
<div class="port" data-id="s" data-direction="s"></div>
</div>
</template>
+2
View File
@@ -14,6 +14,8 @@
<li><a target="test4" href="./test4.html">test4 (EIC-ICMP + NON-ISOLATED)</a></li>
<li><a target="test4.5" href="./test4.5.html">test4.5 (EIC-ICMP + NON-ISOLATED + single-port, ortho, oriented, aligned top)</a></li>
<li><a target="test5" href="./test5.html">test5 (P42 graph + ISOLATED + EDITABLE)</a></li>
<li><a target="test6" href="./test6.html">test6 (16 port combinations)</a></li>
</ul>
</body>
</html>
+99
View File
@@ -0,0 +1,99 @@
<!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.compunet{ grid-column: 1 / -1; width: 100vw; height: 60vh; background:black; }
</style>
<script>
window.addEventListener('load',()=>{
let grflw1 = document.querySelector('bz-graflow.compunet')
grflw1.addEventListener('subflowLoaded',
(evt) => { grflw1 = evt.detail.subflow }
)
grflw1.addEventListener('subflowExited',
(evt) => { grflw1 = evt.target }
)
document.querySelector('[data-trigger="onAutoplace1H"]').addEventListener('click',
(evt) => { grflw1.autoPlace('horizontal', 80, 30, 1000, document.querySelector('[data-id="compunet"]').value) }
)
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>
<body>
<bz-graflow class="compunet" flow="/app/assets/json/bzGraflow/testFlow16ports.json" tension="60" isolated edit="move" >
<div class="demooptions"> <!-- just for demo purposes -->
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
<select name="align" data-id="compunet">
<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="compunet" type="number" size="2" value="60"></div>
</div>
</bz-graflow>
</body>
</html>
@@ -0,0 +1,53 @@
{
"nodesFile": "/app/assets/html/bzGraflow/nodes16ports.html",
"flow": {
"nodes":[
{ "nodeType": "square",
"id": "p1center",
"coords": { "x": 500, "y": 200},
"markup": {
"title": "Center",
"subtitle": "."
}
},
{ "nodeType": "square",
"id": "p1west",
"coords": { "x": 400, "y": 200},
"markup": {
"title": "West",
"subtitle": "."
}
},
{ "nodeType": "square",
"id": "p1north",
"coords": { "x": 500, "y": 100},
"markup": {
"title": "North",
"subtitle": "."
}
},
{ "nodeType": "square",
"id": "p1east",
"coords": { "x": 600, "y": 200},
"markup": {
"title": "East",
"subtitle": "."
}
},
{ "nodeType": "square",
"id": "p1south",
"coords": { "x": 500, "y": 300},
"markup": {
"title": "South",
"subtitle": "."
}
}
],
"links": [
{ "from": ["p1center", "s"], "to": ["p1south", "n"] },
{ "from": ["p1center", "e"], "to": ["p1east", "w"] },
{ "from": ["p1center", "n"], "to": ["p1north", "s"] },
{ "from": ["p1center", "w"], "to": ["p1west", "e"] }
]
}
}