Skip to content

Commit

Permalink
switching to new list based terminal descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaranville committed Feb 12, 2016
1 parent 74ab1a2 commit 4b57654
Show file tree
Hide file tree
Showing 3 changed files with 1,207 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dataflow-editor-streamline-new.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<script src="jquery-extend.js"></script>
<!--<script src="dataflow-box-module.js"></script>-->
<script src="dataflow-editor-streamline-new.js"></script>
<script src="dataflow_ncnr_refl_module_defs.js"></script>
<script src="ncnr.refl.module_defs.js"></script>
<script>
window.onload = function() {

Expand Down
10 changes: 6 additions & 4 deletions dataflow-editor-streamline-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,16 @@ dataflow.editor = function(data) {
dataflow.grid_spacing = 5; // override if you don't want to snap to grid

dataflow.module = function(module_data) {
console.log(this, this.draw_wires);
var parentNode = this; // calling context
var group; // this will be the module group.
if (!('x' in module_data)) module_data.x = 100;
if (!('y' in module_data)) module_data.y = 100;

// look up terminals from module definition if not in module_data:
var terminals = module_data.terminals || dataflow.module_defs[module_data.module].terminals;
//var terminals = module_data.terminals || dataflow.module_defs[module_data.module].terminals;
var module_def = dataflow.module_defs[module_data.module] || {};
var input_terminals = module_data.inputs || module_def.inputs || [],
output_terminals = module_data.outputs || module_def.outputs || [];

var id = (module_data.module_id == undefined) ? d3.id() : module_data.module_id;
var padding = 5;
Expand Down Expand Up @@ -373,7 +375,7 @@ dataflow.module = function(module_data) {
.style("width", width)

var inputs = group.selectAll(".input")
.data(terminals.filter(function(t) {return t.use=="in"}))
.data(input_terminals)
.enter().append("g")
.attr("transform", function(d,i) { return "translate(-20," + (height * i).toFixed() + ")"})

Expand Down Expand Up @@ -411,7 +413,7 @@ dataflow.module = function(module_data) {


var outputs = group.selectAll(".output")
.data(terminals.filter(function(t) {return t.use=="out"}))
.data(output_terminals)
.enter().append("g")
.attr("transform", function(d,i) { return "translate(" + width.toFixed() + "," + (height * i).toFixed() + ")"})

Expand Down
Loading

0 comments on commit 4b57654

Please sign in to comment.