Comparing version 0.1.9 to 0.1.10
{ | ||
"name": "nflow-vis", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "d3 visualisation for nflow", | ||
@@ -5,0 +5,0 @@ "main": "dist/nflow-vis.js", |
@@ -10,6 +10,6 @@ import nflow from 'nflow' | ||
.on('action', parseAction) | ||
/** | ||
* Parses a new action(eg. flow emitted action), | ||
* and stores the new tree state in the model | ||
* and stores the new tree state in the model | ||
*/ | ||
@@ -19,2 +19,3 @@ function parseAction(name, ...data){ | ||
if (actions[name]) { | ||
createParent(s, name, ...data) | ||
actions[name](s, ...data) | ||
@@ -40,2 +41,10 @@ updateProps(s, name, ...data) | ||
function createParent(s, name, f, newData, oldData){ | ||
var e = s.nodeMap[f.guid] | ||
if (!e){ | ||
let e = createNode(f,s) | ||
utils.updateHash(s.root) | ||
} | ||
} | ||
function updateProps(s, name, f, newData, oldData){ | ||
@@ -125,3 +134,3 @@ var e = s.nodeMap[f.guid] | ||
var e = s.nodeMap[f.guid] | ||
if (!e) return | ||
e.status = 'CANCELLED' | ||
utils.updateHash(e) | ||
@@ -177,3 +186,3 @@ } | ||
delete s.nodeMap[d.guid] | ||
} |
@@ -17,4 +17,4 @@ import utils from '../utils/utils' | ||
, initLogger) | ||
/** | ||
@@ -27,3 +27,3 @@ * Tracks a note and treats as the root of the subtree to visualise | ||
, ERRORS.invalidTrackArgs) | ||
f.emit('action', 'start', root.toObj('name', 'guid'), root.toObj('name', 'guid'), null) | ||
@@ -33,3 +33,3 @@ } | ||
/** | ||
* | ||
* | ||
*/ | ||
@@ -41,13 +41,13 @@ function initLogger(){ | ||
nflow.logger((flow, name, newData, oldData)=>{ | ||
// avoid circular tracking | ||
if (flow.parents.has(f.parent())) return | ||
// only track subnodes of the root node | ||
if (!model.nodeMap[flow.guid()]) { | ||
//console.warn('not tracking:', flow.name()) | ||
return; | ||
}; | ||
// if (!model.nodeMap[flow.guid()]) { | ||
// //console.warn('not tracking:', flow.name()) | ||
// return; | ||
// }; | ||
f.emit('action', name, | ||
f.emit('action', name, | ||
flow.toObj('name','guid') | ||
@@ -60,2 +60,2 @@ , utils.toObj(newData), utils.toObj(oldData)) | ||
} | ||
} |
@@ -80,12 +80,12 @@ import './tree.scss' | ||
if (!fd.nodesByDepth[d.depth]) fd.nodesByDepth[d.depth] = [] | ||
fd.nodesByDepth[d.depth].push(d) | ||
fd.nodeMap[d.f.guid]= d | ||
//d.y0 =d.y = d.depth*50+Math.random()*50 | ||
//d.y = d.depth * (root.hidden?40:fd.nodesize.height)+ (root.hidden?0:fd.nodesize.height); | ||
d.x+=fd.width/2 | ||
d.y-=fd.nodesize.height>>1 | ||
d.hidden = d.f.hidden | ||
d.needsUpdate = d.f.hash!=d.f.hash0 | ||
|| d.x!=d.x0 | ||
d.needsUpdate = d.f.hash!=d.f.hash0 | ||
|| d.x!=d.x0 | ||
|| d.y!=d.y0 | ||
@@ -95,6 +95,6 @@ | ||
d.f.hash0 = d.f.hash | ||
d.x0 = (d.x0!=null)?d.x:(d.parent&&!d.parent.hidden?d.parent.x:d.x) | ||
d.y0 = (d.y0!=null)?d.y:(d.parent&&!d.parent.hidden?d.parent.y:d.y) | ||
}); | ||
@@ -134,3 +134,3 @@ fd.nodesByDepth.forEach((nodes,i)=>{ | ||
d.tree = d3.layout.cluster() | ||
} | ||
} | ||
d.tree | ||
@@ -178,5 +178,5 @@ .separation((a,b)=>{ | ||
.classed('drag', true) | ||
d.zoom = d3.behavior.zoom() | ||
@@ -187,3 +187,3 @@ .scaleExtent([.1,2]) | ||
d.dragging | ||
d.dragging | ||
&& d.d3g | ||
@@ -206,3 +206,3 @@ .call(d.zoom) | ||
// this.target | ||
@@ -212,3 +212,3 @@ // .get('links') | ||
} | ||
@@ -223,5 +223,6 @@ | ||
function moveContents(d){ | ||
if (!d.dragging) return | ||
var t = d3.event? d3.event.translate: d.zoom.translate() | ||
var s = d3.event? d3.event.scale: d.zoom.scale() | ||
//zoom.translate(t); | ||
@@ -269,6 +270,6 @@ var maxBounds = d.d3overlay.node().getBBox() | ||
let d3dom = d3.select(d.dom) | ||
d.width = d.isSVG | ||
d.width = d.isSVG | ||
? parseInt(d3dom.attr('width')) | ||
: parseInt(d3dom.style('width')) | ||
d.height = d.isSVG | ||
d.height = d.isSVG | ||
? parseInt(d3dom.attr('height')) | ||
@@ -285,4 +286,1 @@ : parseInt(d3dom.style('height')) | ||
} | ||
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
1711929
38
18200
1
17