graflow: source grooming + demo panels subflow compatible
This commit is contained in:
18
bzGraflow.js
18
bzGraflow.js
@@ -288,7 +288,7 @@ class BZgraflow extends Buildoz{
|
|||||||
childEl.style.transform = 'none'
|
childEl.style.transform = 'none'
|
||||||
childEl.style.willChange = ''
|
childEl.style.willChange = ''
|
||||||
this.dispatchEvent(new CustomEvent('subflowLoaded', {
|
this.dispatchEvent(new CustomEvent('subflowLoaded', {
|
||||||
detail: { flowUrl },
|
detail: { subflow: childEl },
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
composed: true,
|
composed: true,
|
||||||
}))
|
}))
|
||||||
@@ -366,7 +366,7 @@ class BZgraflow extends Buildoz{
|
|||||||
this.hostContainer.style.visibility = 'visible'
|
this.hostContainer.style.visibility = 'visible'
|
||||||
childEl.style.willChange = ''
|
childEl.style.willChange = ''
|
||||||
this.dispatchEvent(new CustomEvent('subflowExited', {
|
this.dispatchEvent(new CustomEvent('subflowExited', {
|
||||||
detail: { },
|
detail: { subflow: childEl },
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
composed: true,
|
composed: true,
|
||||||
}))
|
}))
|
||||||
@@ -611,11 +611,14 @@ class BZgraflow extends Buildoz{
|
|||||||
|
|
||||||
// Compute indexes for each layer (int part) & add sub-index for ports
|
// Compute indexes for each layer (int part) & add sub-index for ports
|
||||||
// Also compute max width/height for each layer
|
// Also compute max width/height for each layer
|
||||||
let maxHeight = 0; let maxWidth = 0
|
let maxHeight = 0
|
||||||
const layerHeights = []; const layerWidths = [];
|
let maxWidth = 0
|
||||||
|
const layerHeights = []
|
||||||
|
const layerWidths = []
|
||||||
const indexes = {} // indexes[nid] = { base: <int>, ports: { [portId]: <float in [0,1)> } }
|
const indexes = {} // indexes[nid] = { base: <int>, ports: { [portId]: <float in [0,1)> } }
|
||||||
for(const layer of layers){
|
for(const layer of layers){
|
||||||
let totHeight = 0; let totWidth = 0
|
let totHeight = 0
|
||||||
|
let totWidth = 0
|
||||||
for(const [idx, nid] of layer.entries()){
|
for(const [idx, nid] of layer.entries()){
|
||||||
// Use offset* (not impacted by CSS transforms) to keep autoPlace stable during zoom animations.
|
// Use offset* (not impacted by CSS transforms) to keep autoPlace stable during zoom animations.
|
||||||
const bb = this.stagedNodes[nid].getBoundingClientRect()
|
const bb = this.stagedNodes[nid].getBoundingClientRect()
|
||||||
@@ -938,7 +941,7 @@ class BZgraflow extends Buildoz{
|
|||||||
if(links.some(l => l.from[0] === l.to[0])) return(true) // self-loops
|
if(links.some(l => l.from[0] === l.to[0])) return(true) // self-loops
|
||||||
|
|
||||||
const { adj } = this.buildGraphStructures(nodes, links)
|
const { adj } = this.buildGraphStructures(nodes, links)
|
||||||
const visiting = new Set();
|
const visiting = new Set()
|
||||||
const visited = new Set()
|
const visited = new Set()
|
||||||
const dfs = (nid) => {
|
const dfs = (nid) => {
|
||||||
if(visiting.has(nid)) {
|
if(visiting.has(nid)) {
|
||||||
@@ -961,7 +964,8 @@ class BZgraflow extends Buildoz{
|
|||||||
|
|
||||||
findBackEdges(nodes, links) {
|
findBackEdges(nodes, links) {
|
||||||
const { adj } = this.buildGraphStructures(nodes, links, true)
|
const { adj } = this.buildGraphStructures(nodes, links, true)
|
||||||
const color = {}; nodes.forEach(n => color[n.id] = 'white')
|
const color = {}
|
||||||
|
nodes.forEach(n => color[n.id] = 'white')
|
||||||
const backEdges = []
|
const backEdges = []
|
||||||
|
|
||||||
function dfs(u) {
|
function dfs(u) {
|
||||||
|
|||||||
Reference in New Issue
Block a user