From 3bc0dfb5ed69d749d6a34ffbc12d7a3d5bdf02dc Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Wed, 2 Oct 2013 18:21:20 +0200 Subject: [PATCH] Initial work on allowing ports to decline new connections, refs #74 --- build/dataflow.build.js | 29 ++++++++++++++++++++++++++--- build/dataflow.min.js | 6 +++--- build/dataflow.min.js.map | 2 +- debug.html | 2 ++ src/modules/input-view.js | 5 +++++ src/modules/input.js | 14 +++++++++++++- src/modules/output-view.js | 5 +++++ src/modules/output.js | 3 ++- 8 files changed, 57 insertions(+), 9 deletions(-) diff --git a/build/dataflow.build.js b/build/dataflow.build.js index 129b7ee..c862cf2 100644 --- a/build/dataflow.build.js +++ b/build/dataflow.build.js @@ -1,4 +1,4 @@ -/*! dataflow.js - v0.0.7 - 2013-10-02 (5:27:30 PM GMT+0200) +/*! dataflow.js - v0.0.7 - 2013-10-02 (6:20:43 PM GMT+0200) * Copyright (c) 2013 Forrest Oliphant; Licensed MIT, GPL */ // Thanks bobnice http://stackoverflow.com/a/1583281/592125 @@ -710,7 +710,8 @@ CircularBuffer.IndexError= {}; id: "input", description: "", label: "", - type: "all" + type: "all", + multiple: true }, initialize: function() { this.parentNode = this.get("parentNode"); @@ -719,7 +720,18 @@ CircularBuffer.IndexError= {}; } this.connected = []; }, + canConnect: function (edge) { + if (!this.get('multiple') && this.connected.length) { + // This port doesn't allow multiple connections and + // there is a connection already, decline + return false; + } + return true; + }, connect: function(edge){ + if (!this.canConnect(edge)) { + return; + } this.connected.push(edge); this.connected = _.uniq(this.connected); this.trigger('connected'); @@ -757,7 +769,8 @@ CircularBuffer.IndexError= {}; id: "output", label: "", type: "all", - description: "" + description: "", + multiple: true } }); @@ -1924,6 +1937,11 @@ CircularBuffer.IndexError= {}; return false; } + if (!this.model.canConnect()) { + // Port declined the connection, abort + return; + } + var route = 0; if (ui.helper.data("route") !== undefined) { route = ui.helper.data("route"); @@ -2226,6 +2244,11 @@ CircularBuffer.IndexError= {}; return false; } + if (!this.model.canConnect()) { + // Port declined the connection, abort + return; + } + var route = 0; if (ui.helper.data("route") !== undefined) { route = ui.helper.data("route"); diff --git a/build/dataflow.min.js b/build/dataflow.min.js index 618495f..55caa0a 100644 --- a/build/dataflow.min.js +++ b/build/dataflow.min.js @@ -1,5 +1,5 @@ -/*! dataflow.js - v0.0.7 - 2013-10-02 (5:27:30 PM GMT+0200) +/*! dataflow.js - v0.0.7 - 2013-10-02 (6:20:43 PM GMT+0200) * Copyright (c) 2013 Forrest Oliphant; Licensed MIT, GPL */ -function CircularBuffer(a){this._array=new Array(a),this.length=0}CircularBuffer.prototype.toString=function(){return"[object CircularBuffer("+this._array.length+") length "+this.length+"]"},CircularBuffer.prototype.get=function(a){return 0>a||aa||athis.length;)this._array[this.length%this._array.length]=void 0,this.length++;this._array[a%this._array.length]=b,a==this.length&&this.length++},CircularBuffer.prototype.push=function(a){this._array[this.length%this._array.length]=a,this.length++},CircularBuffer.IndexError={},function(){var a=Backbone.Model.extend({$:function(a){return this.$el.find(a)},initialize:function(){this.el=document.createElement("div"),this.el.className="dataflow",this.$el=$(this.el),this.$el.data("dataflow",this);var a=Dataflow.prototype.module("card");if(this.shownCards=new a.Collection,this.shownCards.view=new a.CollectionView({collection:this.shownCards}),this.$el.append(this.shownCards.view.$el),this.debug=this.get("debug"),this.controls=this.get("controls"),this.controls!==!1&&(this.controls=!0),this.controls)for(var b in this.plugins)this.plugins[b].initialize&&this.plugins[b].initialize(this);this.inputs=this.get("inputs"),this.inputs!==!1&&(this.inputs=!0),this.editable=this.get("editable"),this.editable!==!1&&(this.editable=!0);var c=this.get("appendTo");c=c?c:"body","body"===c&&$("html, body").css({margin:"0px",padding:"0px",width:"100%",height:"100%"}),$(c).append(this.el),this.id||(this.id=$(c).attr("id")),this.loadState()},modules:{},module:function(a){return this.modules[a]?this.modules[a]:(this.modules[a]={},this.modules[a])},nodes:{},node:function(a){return this.nodes[a]?this.nodes[a]:(this.nodes[a]={description:""},this.nodes[a])},plugins:{},plugin:function(a){return this.plugins[a]?this.plugins[a]:(this.plugins[a]={},this.plugins[a])},addCard:function(a,b){b||this.hideCards(),this.shownCards.get(a)?this.shownCards.view.bringToTop(a):this.shownCards.add(a)},removeCard:function(a){this.shownCards.remove(a)},hideCards:function(){var a=this.shownCards.where({pinned:!1});this.shownCards.remove(a)},addPlugin:function(a){var b=this.plugins[a.id];if(b||(this.plugins[a.id]=b={}),b.info=a,b.enabled=!0,a.menu){var c=Dataflow.prototype.module("card"),d=new c.Model({dataflow:this,card:{el:a.menu},pinned:a.pinned?!0:!1});b.card=d,this.plugins.menu.addPlugin({id:a.id,icon:a.icon,label:a.label,showLabel:!1})}},showPlugin:function(a){this.plugins[a]&&this.plugins[a].card&&(this.addCard(this.plugins[a].card),"function"==typeof this.plugins[a].onShow&&this.plugins[a].onShow())},enablePlugin:function(a){var b=this.plugins[a];b&&this.addPlugin(b.info)},disablePlugin:function(a){this.plugins.menu.disablePlugin(a)},showContextBar:function(){this.contextBar.view.$el.show()},hideContextBar:function(){this.contextBar.view.$el.hide()},contexts:{},prepareContext:function(a){if(this.contexts[a])return this.contexts[a];var b=this.module("menucard");return this.contexts[a]=new b.Model({id:"context-"+a,dataflow:this,pinned:!0}),this.contexts[a].view=new b.View({model:this.contexts[a]}),this.contexts[a]},addContext:function(a){_.each(a.contexts,function(b){var c=this.prepareContext(b);c.menu.add(a)},this)},changeContext:function(a,b){var c=function(a,b){this.contexts[a]&&(this.contexts[a].set("label",b),this.shownCards.get("context-"+a)||this.shownCards.add(this.contexts[a]))}.bind(this),d=function(a){this.shownCards.get("context-"+a)&&this.shownCards.remove("context-"+a)}.bind(this);a.length>1?(c("nodes",a.length+" nodes"),d("node")):1===a.length?(c("node",a[0].get("label")),d("nodes")):(d("node"),d("nodes")),b.length>1?(c("edges",b.length+" edges"),d("edge")):1===b.length?(c("edge",b[0].id),d("edges")):(d("edge"),d("edges"))},loadGraph:function(a){this.graph&&(this.currentGraph.view&&this.currentGraph.view.remove(),this.graph.view&&this.graph.view.remove(),this.graph.remove());var b=this.module("graph");a.dataflow=this;var c=new b.Model(a);return c.view=new b.View({model:c}),this.$el.append(c.view.render().el),this.graph=this.currentGraph=c,c},showGraph:function(a){this.currentGraph.view.$el.detach(),this.$el.append(a.view.el),a.view.render(),this.currentGraph=a},debug:!1,log:function(a){this.trigger("log",a,arguments),this.debug&&console.log("Dataflow: ",arguments)},types:["all","canvas:2d","canvas:webgl","string","number","int","object","array"]});window.Dataflow=a,"object"==typeof exports&&(exports.Dataflow=a),Backbone.View.prototype.addEvents=function(a){this.delegateEvents(_.extend(_.clone(this.events),a))},Backbone.CollectionView=Backbone.Model.extend({prepend:!1,initialize:function(a){a.tagName&&(this.tagName=a.tagName),a.className&&(this.className=a.className),a.itemView&&(this.itemView=a.itemView),this.el=document.createElement(this.tagName),this.el.className=this.className,this.$el=$(this.el),this.parent=a.parent;var b=this.collection=this.get("collection");b.each(this.addItem,this),b.on("add",this.addItem,this),b.on("remove",this.removeItem,this)},addItem:function(a){a.view||(a.view=new this.itemView({model:a,parent:this.parent}),a.view.render()),this.prepend?this.$el.prepend(a.view.el):this.$el.append(a.view.el)},removeItem:function(a){a.view.remove()}})}(),function(a){var b=Backbone.Model.extend({});a.prototype.loadState=function(){var a="dataflow-"+(this.id?this.id:this.cid),c=JSON.parse(window.localStorage.getItem(a));c||(c={});var d=new b(c);this.set("state",d),d.on("change",function(b){window.localStorage.setItem(a,JSON.stringify(b.toJSON()))})}}(Dataflow),function(a){var b=a.prototype.module("graph"),c=a.prototype.module("node"),d=a.prototype.module("edge");b.Model=Backbone.Model.extend({defaults:{nodes:[],edges:[],panX:0,panY:0,zoom:1},initialize:function(){this.dataflow=this.get("dataflow");var a,b=this.nodes=new c.Collection;b.parentGraph=this,b.on("all",function(){this.trigger("change")},this),b.on("add",function(a){this.dataflow.trigger("node:add",this,a)},this),b.on("remove",function(a){a.remove(),this.dataflow.trigger("node:remove",this,a)},this);var e=this.get("nodes");for(a=0;a0;)this.nodes.remove(this.nodes.at(this.nodes.length-1))},toJSON:function(){return{nodes:this.nodes,edges:this.edges}}})}(Dataflow),function(a){var b=a.prototype.module("node"),c=a.prototype.module("input"),d=a.prototype.module("output");b.Model=Backbone.Model.extend({defaults:function(){return{label:"",description:"",type:"test",x:200,y:100,state:{},selected:!1}},initialize:function(){this.parentGraph=this.get("parentGraph"),this.type=this.get("type"),""===this.get("label")&&this.set({label:this.get("type")});var a=this.inputs;this.inputs=new c.Collection,this.inputs.parentNode=this;for(var b=0;b0;)this.connected[0].remove()}}),b.Collection=Backbone.Collection.extend({model:b.Model})}(Dataflow),function(a){var b=a.prototype.module("input"),c=a.prototype.module("output");c.Model=b.Model.extend({defaults:{id:"output",label:"",type:"all",description:""}}),c.Collection=Backbone.Collection.extend({model:c.Model})}(Dataflow),function(a){var b=a.prototype.module("edge");b.Model=Backbone.Model.extend({defaults:{z:0,route:0,selected:!1,log:null},initialize:function(){var a,b,c,d=this.get("preview");if(this.parentGraph=this.get("parentGraph"),this.attributes.log=new CircularBuffer(50),d){a=this.get("parentGraph").nodes;var e=this.get("source"),f=this.get("target");e?(b=a.get(this.get("source").node),this.source=b.outputs.get(this.get("source").port)):f&&(c=a.get(this.get("target").node),this.target=c.inputs.get(this.get("target").port))}else{a=this.parentGraph.nodes;try{b=a.get(this.get("source").node),this.source=b.outputs.get(this.get("source").port),c=a.get(this.get("target").node),this.target=c.inputs.get(this.get("target").port)}catch(g){}this.source.connect(this),this.target.connect(this),b.on("send:"+this.source.id,this.send,this),this.bringToTop(),this.on("select",this.select,this)}},select:function(){this.parentGraph.trigger("select:edge",this)},send:function(a){this.target.parentNode.recieve(this.target.id,a)},isConnectedToPort:function(a){return this.source===a||this.target===a},isConnectedToNode:function(a){return this.source.parentNode===a||this.target.parentNode===a},toString:function(){return this.id?this.id:this.get("source").node+":"+this.get("source").port+"::"+this.get("target").node+":"+this.get("target").port},toJSON:function(){return{source:this.get("source"),target:this.get("target"),route:this.get("route")}},bringToTop:function(){var a=0;this.parentGraph.edges.each(function(b){if(b!==this){var c=b.get("z");c>a&&(a=c),b.view&&b.view.unhighlight()}},this),this.set("z",a+1)},remove:function(){this.source.disconnect(this),this.target.disconnect(this),this.collection&&this.collection.remove(this),this.source.parentNode.off("send:"+this.source.id,this.send,this),this.trigger("remove")}}),b.Collection=Backbone.Collection.extend({model:b.Model,comparator:function(a){return a.get("z")}})}(Dataflow),function(a){var b=a.prototype.module("graph");a.prototype.module("node");var c=a.prototype.module("edge"),d=.2,e=1.1;document.createElement("div").style.hasOwnProperty("zoom");var f='
';b.View=Backbone.View.extend({template:_.template(f),className:"dataflow-g",events:{"click .dataflow-graph":"deselect","dragstart .dataflow-graph-panzoom":"panStart","drag .dataflow-graph-panzoom":"pan","dragstop .dataflow-graph-panzoom":"panStop","click .dataflow-graph-gotoparent":"gotoParent",mousewheel:"mouseWheel"},initialize:function(){this.$el.html(this.template(this.model.toJSON()));var a=this.model.get("nodes"),b=this.model.get("edges");this.nodes=a.view={},this.model.nodes.each(this.addNode,this),this.model.nodes.on("add",this.addNode,this),this.model.nodes.on("remove",this.removeNode,this),this.edges=b.view={},this.model.edges.each(this.addEdge,this),this.model.edges.on("add",this.addEdge,this),this.model.edges.on("remove",this.removeEdge,this);var c=this.model.get("parentNode");c||this.$(".dataflow-graph-controls").hide(),this.$(".dataflow-graph-panzoom").draggable({helper:function(){var a=$("
");return this.model.dataflow.$el.append(a),a}.bind(this)}),this.$graphEl=this.$(".dataflow-graph"),this.graphEl=this.$(".dataflow-graph")[0],this.$graphEl.css({transform:"translate3d(0, 0, 0) scale3d(1, 1, 1) ",transformOrigin:"left top"}),this.bindInteraction()},panStartOffset:null,panStart:function(a,b){b&&(this.panStartOffset=b.offset)},pan:function(a,b){if(b){var c=this.model.get("zoom"),d=b.offset.left-this.panStartOffset.left,e=b.offset.top-this.panStartOffset.top;this.$(".dataflow-graph").css({transform:"translate3d("+d/c+"px, "+e/c+"px, 0)"})}},panStop:function(a,b){this.$(".dataflow-graph").css({transform:"translate3d(0, 0, 0)"});var c=this.model.get("zoom"),d=b.offset.left-this.panStartOffset.left,e=b.offset.top-this.panStartOffset.top;this.model.set({panX:this.model.get("panX")+d/c,panY:this.model.get("panY")+e/c})},tempPanX:0,tempPanY:0,setPanDebounce:_.debounce(function(){this.$(".dataflow-graph").css({transform:"translate3d(0, 0, 0)"}),this.model.set({panX:this.model.get("panX")+this.tempPanX,panY:this.model.get("panY")+this.tempPanY}),this.tempPanX=0,this.tempPanY=0},250),mouseWheel:function(a){a.preventDefault();var b=a.originalEvent;this.tempPanX+=b.wheelDeltaX/6,this.tempPanY+=b.wheelDeltaY/6,this.$(".dataflow-graph").css({transform:"translate3d("+this.tempPanX+"px, "+this.tempPanY+"px, 0)"}),this.setPanDebounce()},gotoParent:function(){var a=this.model.get("parentNode");a&&this.model.dataflow.showGraph(a.parentGraph)},bindInteraction:function(){this.bindZoom(),this.bindScroll()},bindZoom:function(){if(window.Hammer){var a,b,c,f,g,h,i,j,k,l,m=this;Hammer(this.$(".dataflow-graph-panzoom")[0]).on("transformstart",function(d){a=m.model.get("zoom"),b=d.gesture.center.pageX,c=d.gesture.center.pageY,f=b/a,g=c/a;var e=m.$el.offset();k=f-e.left,l=g-e.top,m.$graphEl.css({transformOrigin:f+"px "+g+"px"})}).on("transform",function(f){h=Math.max(d/a,Math.min(f.gesture.scale,e/a)),i=(f.gesture.center.pageX-b)/a,j=(f.gesture.center.pageY-c)/a,m.$graphEl.css({transform:"translate3d("+i+"px,"+j+"px, 0) "+"scale3d("+h+","+h+", 1) "})}).on("transformend",function(){m.$graphEl.css({transform:"translate3d(0, 0, 0) scale3d(1, 1, 1) "});var b=a*h;b=Math.max(d,Math.min(b,e)),m.model.set("zoom",b),k*=b,l*=b,m.model.set({panX:m.model.get("panX")+i,panY:m.model.get("panY")+j}),console.log(m.model.attributes)});var n=function(){var a=m.model.get("zoom"),b=m.zoomClass;m.zoomClass=.5>a?"zoom-tiny":.8>a?"zoom-small":1.3>a?"zoom-normal":"zoom-big",m.$graphEl.removeClass(b).addClass(m.zoomClass),m.graphEl.style.zoom=m.model.get("zoom")};this.model.on("change:zoom",n),1!==this.model.get("zoom")&&n()}},zoomClass:1,zoomIn:function(){var a=this.model.get("zoom"),b=.9*a;b=Math.max(d,b),b!==a&&this.model.set("zoom",b)},zoomOut:function(){var a=this.model.get("zoom"),b=1.1*a;b=Math.min(e,b),b!==a&&this.model.set("zoom",b)},zoomCenter:function(){var a=this.model.get("zoom"),b=1;b!==a&&this.model.set("zoom",1)},bindScroll:function(){},render:function(){var a=this;return _.defer(function(){a.rerenderEdges()},this),this},addNode:function(a){var b=this.model.dataflow.nodes[a.type];if(b&&b.View)a.view=new b.View({model:a,graph:this});else{var c=this.model.dataflow.node("base");a.view=new c.View({model:a,graph:this})}this.nodes[a.id]=a.view,a.view.render(),this.$(".dataflow-nodes").append(a.view.el)},removeNode:function(a){a.view.remove(),this.nodes[a.id]=null,delete this.nodes[a.id]},addEdge:function(a){a.view=new c.View({model:a}),this.edges[a.id]=a.view,a.view.render(),this.$(".dataflow-svg-edges")[0].appendChild(a.view.el)},removeEdge:function(a){a.view&&a.view.remove(),this.edges[a.id]=null,delete this.edges[a.id]},rerenderEdges:function(){_.each(this.edges,function(a){a.render()},this)},sizeSVG:function(){try{var a=this.$(".dataflow-svg-edges")[0],b=a.getBBox(),c=Math.max(Math.round(b.x+b.width+50),50),d=Math.max(Math.round(b.y+b.height+50),50);a.setAttribute("width",c),a.setAttribute("height",d)}catch(e){}},deselect:function(){this.model.nodes.invoke("set",{selected:!1}),this.model.edges.invoke("set",{selected:!1}),this.model.trigger("selectionChanged"),this.unfade(),this.model.dataflow.hideCards()},fade:function(){this.model.nodes.each(function(a){a.view&&(a.get("selected")||a.view.fade())}),this.fadeEdges()},fadeEdges:function(){this.model.edges.each(function(a){a.get("selected")||a.source.parentNode.get("selected")||a.target.parentNode.get("selected")?a.view.unfade():a.view.fade()})},unfade:function(){this.model.nodes.each(function(a){a.view&&a.view.unfade()}),this.model.edges.each(function(a){a.view&&a.view.unfade()})}})}(Dataflow),function(a){var b,c=a.prototype.module("node"),d=a.prototype.module("input"),e=a.prototype.module("output"),f='

<%- label %>

',g="";c.View=Backbone.View.extend({template:_.template(f),innerTemplate:_.template(g),className:"dataflow-node",events:function(){return{"click .dataflow-node-header":"select",dragstart:"dragStart",drag:"drag",dragstop:"dragStop"}},initialize:function(a){this.$el.html(this.template(this.model.toJSON())),this.graph=a.graph,this.$el.addClass(this.model.type),this.model.parentGraph.dataflow.editable||this.$(".dataflow-node-edit").hide(),this.inputs=this.model.inputs.view=new d.CollectionView({collection:this.model.inputs,parent:this}),this.outputs=this.model.outputs.view=new e.CollectionView({collection:this.model.outputs,parent:this}),this.$el.draggable({handle:"h1",helper:function(){return $("
")}}),this.$el.data("dataflow-node-view",this),this.$(".dataflow-node-inner").append(this.innerTemplate),this.listenTo(this.model.parentGraph,"change:panX change:panY",this.bumpPosition),this.listenTo(this.model,"change:selected",this.selectedChanged),this.listenTo(this.model,"change:label",this.changeLabel),this.listenTo(this.model,"remove",this.hideInspector),this.$inner=this.$(".dataflow-node-inner")},render:function(){return this.$el.css({left:this.model.get("x")+this.model.parentGraph.get("panX"),top:this.model.get("y")+this.model.parentGraph.get("panY")}),this.$(".dataflow-node-ins").html(this.inputs.el),this.$(".dataflow-node-outs").html(this.outputs.el),this.$(".dataflow-node-controls").hide(),this.$(".label-edit").hide(),this},_alsoDrag:[],_dragDelta:{},$dragHelpers:$('
'),dragStart:function(a,c){c&&(this.model.get("selected")||this.select(a,!0),a.stopPropagation(),b=this.model.parentGraph.get("zoom"),this.$dragHelpers.css({transform:"translate3d(0,0,0)"}),this.$el.parent().append(this.$dragHelpers),this._alsoDrag=this.model.collection.where({selected:!0}),_.each(this._alsoDrag,function(a){var b=a.view.$el,c=$('
').css({width:b.width(),height:b.height(),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)});this.$dragHelpers.append(c)},this))},changeLabel:function(){var a=this.model.get("label"),b=this.model.get("type");this.$(".dataflow-node-title").text(a).attr("title",a+": "+b)},drag:function(a,c){if(c){a.stopPropagation();var d=(c.position.left-c.originalPosition.left)/b,e=(c.position.top-c.originalPosition.top)/b;this.$dragHelpers.css({transform:"translate3d("+d+"px,"+e+"px,0)"})}},dragStop:function(a,c){if(c){a.stopPropagation(),this.model.parentGraph.get("panX"),this.model.parentGraph.get("panY");var d=(c.position.left-c.originalPosition.left)/b,e=(c.position.top-c.originalPosition.top)/b;this._alsoDrag.length&&(_.each(this._alsoDrag,function(a){a.view.moveToPosition(a.get("x")+d,a.get("y")+e)},this),this._alsoDrag=[]),this.$dragHelpers.empty(),this.$dragHelpers.remove()}},bumpPosition:function(){this.$el.css({left:this.model.get("x")+this.model.parentGraph.get("panX"),top:this.model.get("y")+this.model.parentGraph.get("panY")}),this.model.trigger("change:x change:y")},moveToPosition:function(a,b){this.model.set({x:a,y:b},{silent:!0}),this.bumpPosition()},removeModel:function(){this.model.remove()},bringToTop:function(){var a=0;this.model.collection.each(function(b){var c=parseInt(b.view.el.style.zIndex,10);c>a&&(a=c)},this),this.el.style.zIndex=a+1},select:function(a){a&&a.stopPropagation();var b=!1,c=this.model.get("selected");a&&(a.ctrlKey||a.metaKey)?(b=!0,c=!c,this.model.set("selected",c),c||this.fade()):(this.model.parentGraph.edges.invoke("set",{selected:!1}),this.model.parentGraph.nodes.invoke("set",{selected:!1}),this.model.parentGraph.view.fade(),c=!0,this.model.set("selected",!0)),this.bringToTop(),this.model.parentGraph.view.fadeEdges(),this.model.parentGraph.trigger("selectionChanged")},inspector:null,getInspector:function(){if(!this.inspector){var b=new c.InspectView({model:this.model}),d=a.prototype.module("card");this.inspector=new d.Model({dataflow:this.model.parentGraph.dataflow,card:b})}return this.inspector},showInspector:function(a){this.model.parentGraph.dataflow.addCard(this.getInspector(),a)},hideInspector:function(){this.model.parentGraph.dataflow.removeCard(this.getInspector())},fade:function(){this.$el.addClass("fade"),this.$el.removeClass("ui-selected")},unfade:function(){this.$el.removeClass("fade")},selectedChanged:function(){this.model.get("selected")?(this.highlight(),this.showInspector()):(this.unhighlight(),this.hideInspector())},highlight:function(){this.$el.removeClass("fade"),this.$el.addClass("ui-selected")},unhighlight:function(){this.$el.removeClass("ui-selected")}})}(Dataflow),function(a){var b=a.prototype.module("input"),c=a.prototype.module("edge"),d='',e=1;b.View=Backbone.View.extend({template:_.template(d),tagName:"li",className:"dataflow-port dataflow-in",events:{click:"getTopEdge",drop:"connectEdge","dragstart .dataflow-port-hole":"newEdgeStart","drag .dataflow-port-hole":"newEdgeDrag","dragstop .dataflow-port-hole":"newEdgeStop","dragstart .dataflow-port-plug":"changeEdgeStart","drag .dataflow-port-plug":"changeEdgeDrag","dragstop .dataflow-port-plug":"changeEdgeStop"},$input:null,initialize:function(a){this.$el.html(this.template(this.model.toJSON())),this.$el.addClass(this.model.get("type")),this.parent=a.parent;var b=this.parent.model,c=b.parentGraph;this.listenTo(b,"change:x change:y",function(){this._holePosition=null}.bind(this)),this.listenTo(c,"change:panX change:panY",function(){this._holePosition=null}.bind(this));var d=b.get("state");if(d&&d[this.model.id]&&this.$el.addClass("hasvalue"),this.model.parentNode.parentGraph.dataflow.editable){var e=this;if(this.$(".dataflow-port-plug").draggable({cursor:"pointer",helper:function(){var a=$('');return e.parent.graph.$el.append(a),a},disabled:!0,distance:10,delay:100}),this.$(".dataflow-port-hole").draggable({cursor:"pointer",helper:function(){var a=$('').data({port:e.model});return e.parent.graph.$el.append(a),a}}),this.$el.droppable({accept:".dataflow-port-plug.in, .dataflow-port-hole.out",activeClassType:"droppable-hover",refreshPositions:!0}),this.model.parentNode.parentGraph.dataflow.inputs){var f=this.model.get("type"),g=this.model.parentNode.get("state");if(a=this.model.get("options"),void 0!==a&&(_.isString(a)&&(a=a.split(" "),this.model.set("options",a)),_.isArray(a))){for(var h={},i=0;i').append(k).prepend(""+this.model.get("label")+" ");this.$input=l,this.model.connected.length&&l.addClass("connected"),this.model.on("connected",function(){this.$input.addClass("connected")},this),this.model.on("disconnected",function(){this.$input.removeClass("connected")},this)}}},renderInput:function(a,b){var c;if(b){c=$('').attr(f).addClass("int"===a?"input-int":"input-float"),"int"==a?c.change(this.inputInt.bind(this)):c.change(this.inputFloat.bind(this)),c;case"boolean":return c=$('
'),c.change(this.inputBoolean.bind(this)),c;case"object":return c=$(''),c.on("change, keyup",this.inputObject.bind(this)),c;case"bang":return c=$(''),c.click(this.inputBang.bind(this)),c;default:return c=$(''),c.change(this.inputString.bind(this)),c}},setInputValue:function(a,b,c){return a?"SELECT"===a[0].tagName?($("option",a).each(function(){var a=$(this).data("val");$(this).prop("selected",a==c)}),void 0):"boolean"===b?(a.prop("checked",c),void 0):"object"===b?(a.text(JSON.stringify(c,null,2)),void 0):(a.val(c),void 0):void 0},inputSelect:function(a){var b=$(a.target).find(":selected").data("val");this.model.parentNode.setState(this.model.id,b)},inputInt:function(a){this.model.parentNode.setState(this.model.id,parseInt($(a.target).val(),10))},inputFloat:function(a){this.model.parentNode.setState(this.model.id,parseFloat($(a.target).val()))},inputString:function(a){this.model.parentNode.setState(this.model.id,$(a.target).val())},inputBoolean:function(a){this.model.parentNode.setState(this.model.id,$(a.target).prop("checked"))},inputObject:function(a){try{var b=JSON.parse($(a.target).text());this.model.parentNode.setState(this.model.id,b)}catch(c){}},inputBang:function(){this.model.parentNode.setBang(this.model.id)},render:function(){return this},newEdgeStart:function(a,b){if(b){a.stopPropagation(),b.helper.data({route:this.topRoute}),this.previewEdgeNew=new c.Model({target:{node:this.model.parentNode.id,port:this.model.id},parentGraph:this.model.parentNode.parentGraph,preview:!0,route:this.topRoute}),this.previewEdgeNewView=new c.View({model:this.previewEdgeNew});var d=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];d.appendChild(this.previewEdgeNewView.el),e=this.model.parentNode.parentGraph.get("zoom")}},newEdgeDrag:function(a,b){if(this.previewEdgeNewView&&b){a.stopPropagation(),b.position.top=a.clientY/e,b.position.left=a.clientX/e;var c=this.model.parentNode.parentGraph.view.el;b.position.left+=c.scrollLeft,b.position.top+=c.scrollTop,this.previewEdgeNewView.render({left:b.position.left-c.scrollLeft,top:b.position.top-c.scrollTop}),this.model.parentNode.parentGraph.view.sizeSVG()}},newEdgeStop:function(a){a.stopPropagation(),this.previewEdgeNewView.remove(),delete this.previewEdgeNew,delete this.previewEdgeNewView},getTopEdge:function(){var a,b=-1;return this.isConnected&&(this.model.parentNode.parentGraph.edges.each(function(c){var d=c.get("z");c.target===this.model&&d>b&&(a=c,b=d),c.view&&c.view.unhighlight()},this),a&&a.view&&a.view.bringToTop()),a},changeEdgeStart:function(a,b){if(b&&(a.stopPropagation(),this.isConnected)){var d=this.getTopEdge();if(d){d.remove(),b&&b.helper.data({port:d.source,route:d.get("route")}),this.previewEdgeChange=new c.Model({source:d.get("source"),route:d.get("route"),parentGraph:this.model.parentNode.parentGraph,preview:!0}),this.previewEdgeChangeView=new c.View({model:this.previewEdgeChange});var f=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];f.appendChild(this.previewEdgeChangeView.el),e=this.model.parentNode.parentGraph.get("zoom")}}},changeEdgeDrag:function(a,b){b&&(a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.render(b.offset),this.model.parentNode.parentGraph.view.sizeSVG()))},changeEdgeStop:function(a){a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.remove(),delete this.previewEdgeChange,delete this.previewEdgeChangeView)},connectEdge:function(a,b){var c=b.helper.data("port"),d=this.model.parentNode.parentGraph.edges.length;if(c.parentNode.parentGraph.dataflow!==this.model.parentNode.parentGraph.dataflow)return!1;var e=0;void 0!==b.helper.data("route")&&(e=b.helper.data("route")),this.model.parentNode.parentGraph.edges.add({id:c.parentNode.id+":"+c.id+"::"+this.model.parentNode.id+":"+this.model.id,parentGraph:this.model.parentNode.parentGraph,source:{node:c.parentNode.id,port:c.id},target:{node:this.model.parentNode.id,port:this.model.id},route:e}),b.helper.data("removeChangeEdge",db&&(a=c,b=d)}},this),a)this.bringToTop(a); -else{try{this.$(".dataflow-port-plug").draggable("disable")}catch(c){}this.$(".dataflow-port-plug, .dataflow-port-hole").removeClass("active"),this.isConnected=!1}},topRoute:0,bringToTop:function(a){var b=a.get("route");void 0!==b&&(this.$(".dataflow-port-hole, .dataflow-port-plug").removeClass("route"+this.topRoute),this.$(".dataflow-port-hole, .dataflow-port-plug").addClass("route"+b),this.topRoute=b)}}),b.CollectionView=Backbone.CollectionView.extend({tagName:"ul",itemView:b.View})}(Dataflow),function(a){var b=a.prototype.module("output"),c=a.prototype.module("edge"),d='<%= label %>',e=1;b.View=Backbone.View.extend({template:_.template(d),tagName:"li",className:"dataflow-port dataflow-out",events:{click:"getTopEdge",drop:"connectEdge","dragstart .dataflow-port-hole":"newEdgeStart","drag .dataflow-port-hole":"newEdgeDrag","dragstop .dataflow-port-hole":"newEdgeStop","dragstart .dataflow-port-plug":"changeEdgeStart","drag .dataflow-port-plug":"changeEdgeDrag","dragstop .dataflow-port-plug":"changeEdgeStop"},initialize:function(a){this.$el.html(this.template(this.model.toJSON())),this.$el.addClass(this.model.get("type")),this.parent=a.parent;var b=this.parent.model,c=b.parentGraph;if(this.listenTo(b,"change:x change:y change:w",function(){this._holePosition=null}.bind(this)),this.listenTo(c,"change:panX change:panY",function(){this._holePosition=null}.bind(this)),this.model.parentNode.parentGraph.dataflow.editable){var d=this;this.$(".dataflow-port-plug").draggable({cursor:"pointer",helper:function(){var a=$('');return d.parent.graph.$el.append(a),a},disabled:!0,distance:10,delay:100}),this.$(".dataflow-port-hole").draggable({cursor:"pointer",helper:function(){var a=$('').data({port:d.model});return d.parent.graph.$el.append(a),a}}),this.$el.droppable({accept:".dataflow-port-plug.out, .dataflow-port-hole.in",activeClassType:"droppable-hover"})}},render:function(){return this},newEdgeStart:function(a,b){if(a.stopPropagation(),b){b.helper.data({route:this.topRoute}),this.previewEdge=new c.Model({source:{node:this.model.parentNode.id,port:this.model.id},parentGraph:this.model.parentNode.parentGraph,preview:!0,route:this.topRoute}),this.previewEdgeView=new c.View({model:this.previewEdge});var d=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];d.appendChild(this.previewEdgeView.el),e=this.model.parentNode.parentGraph.get("zoom")}},newEdgeDrag:function(a,b){if(a.stopPropagation(),this.previewEdgeView&&b){b.position.top=a.clientY/e,b.position.left=a.clientX/e;var c=this.model.parentNode.parentGraph.view.el;b.position.left+=c.scrollLeft,b.position.top+=c.scrollTop,this.previewEdgeView.render({left:b.position.left-c.scrollLeft,top:b.position.top-c.scrollTop})}},newEdgeStop:function(a){a.stopPropagation(),this.previewEdgeView.remove(),delete this.previewEdge,delete this.previewEdgeView},getTopEdge:function(){var a,b=-1;return this.isConnected&&(this.model.parentNode.parentGraph.edges.each(function(c){var d=c.get("z");c.source===this.model&&d>b&&(a=c,b=d),c.view&&c.view.unhighlight()},this),a&&a.view&&a.view.bringToTop()),a},changeEdgeStart:function(a,b){if(b&&(a.stopPropagation(),this.isConnected)){var d=this.getTopEdge();if(d){d.remove(),b&&b.helper.data({port:d.target,route:d.get("route")}),this.previewEdgeChange=new c.Model({target:d.get("target"),route:d.get("route"),parentGraph:this.model.parentNode.parentGraph,preview:!0}),this.previewEdgeChangeView=new c.View({model:this.previewEdgeChange});var f=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];f.appendChild(this.previewEdgeChangeView.el),e=this.model.parentNode.parentGraph.get("zoom")}}},changeEdgeDrag:function(a,b){b&&(a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.render(b.offset),this.model.parentNode.parentGraph.view.sizeSVG()))},changeEdgeStop:function(a){a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.remove(),delete this.previewEdgeChange,delete this.previewEdgeChangeView)},connectEdge:function(a,b){var c=b.helper.data("port"),d=this.model.parentNode.parentGraph.edges.length;if(c.parentNode.parentGraph.dataflow!==this.model.parentNode.parentGraph.dataflow)return!1;var e=0;void 0!==b.helper.data("route")&&(e=b.helper.data("route")),this.model.parentNode.parentGraph.edges.add({id:this.model.parentNode.id+":"+this.model.id+"::"+c.parentNode.id+":"+c.id,parentGraph:this.model.parentNode.parentGraph,source:{node:this.model.parentNode.id,port:this.model.id},target:{node:c.parentNode.id,port:c.id},route:e}),b.helper.data("removeChangeEdge",db&&(a=c,b=d)}},this),a)this.bringToTop(a);else{try{this.$(".dataflow-port-plug").draggable("disable")}catch(c){}this.$(".dataflow-port-plug, .dataflow-port-hole").removeClass("active"),this.isConnected=!1}},topRoute:0,bringToTop:function(a){var b=a.get("route");void 0!==b&&(this.$(".dataflow-port-hole").removeClass("route"+this.topRoute),this.$(".dataflow-port-hole").addClass("route"+b),this.topRoute=b)}}),b.CollectionView=Backbone.CollectionView.extend({tagName:"ul",itemView:b.View})}(Dataflow),function(a){var b=a.prototype.module("edge"),c=function(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)"xlink:href"===d?c.setAttributeNS("http://www.w3.org/1999/xlink","href",b[d]):c.setAttribute(d,b[d]);return c},d=function(a,b){a.classList?a.classList.add(b):a.className="dataflow-edge "+b},e=function(a,b){a.classList?a.classList.remove(b):a.className="dataflow-edge"};b.View=Backbone.View.extend({tagName:"div",className:"dataflow-edge",positions:null,initialize:function(){this.positions={from:null,to:null},this.model.source&&this.model.source.parentNode.on("change:x change:y change:w",this.render,this),this.model.target&&this.model.target.parentNode.on("change:x change:y",this.render,this),this.model.source&&this.model.source.view&&(this.model.source.view.plugSetActive(),this.model.source.view.bringToTop(this.model)),this.model.target&&this.model.target.view&&(this.model.target.view.plugSetActive(),this.model.target.view.bringToTop(this.model)),this.el=c("g",{"class":"dataflow-edge"}),this.elEdge=c("path",{"class":"dataflow-edge-wire"}),this.elShadow=c("path",{"class":"dataflow-edge-shadow"}),void 0!==this.model.get("route")&&this.elEdge.setAttribute("class","dataflow-edge-wire route"+this.model.get("route"));var a=this;this.model.on("change:route",function(){a.elEdge.setAttribute("class","dataflow-edge-wire route"+a.model.get("route")),a.bringToTop()}),this.el.appendChild(this.elShadow),this.el.appendChild(this.elEdge),this.el.addEventListener("click",function(b){a.click(b)}),this.listenTo(this.model,"change:selected",this.selectedChange),this.listenTo(this.model,"remove",this.hideInspector)},render:function(a){var b,c=this.model.source,d=this.model.target;c?this.positions.from=c.view.holePosition():(b=this.model.parentGraph.dataflow.$el.parent().position(),graph=this.model.parentGraph.view.$el,this.positions.from={left:graph.scrollLeft()+a.left-5-b.left,top:graph.scrollTop()+a.top+5-b.top}),d?this.positions.to=d.view.holePosition():(b=this.model.parentGraph.dataflow.$el.parent().position(),graph=this.model.parentGraph.view.$el,this.positions.to={left:graph.scrollLeft()+a.left+15-b.left,top:graph.scrollTop()+a.top+5-b.top});var e=this.edgePath(this.positions);this.elEdge.setAttribute("d",e),this.elShadow.setAttribute("d",e),this.model.parentGraph&&this.model.parentGraph.view&&this.model.parentGraph.view.sizeSVG()},fade:function(){this.model.source.parentNode.get("selected")||this.model.target.parentNode.get("selected")||d(this.el,"fade")},unfade:function(){e(this.el,"fade")},selectedChange:function(){this.model.get("selected")?(this.highlight(),this.showInspector()):(this.unhighlight(),this.hideInspector()),this.model.parentGraph.trigger("selectionChanged")},highlight:function(){d(this.el,"highlight")},unhighlight:function(){e(this.el,"highlight")},edgePath:function(a){var b=20,c=a.to.left-b-(a.from.left+b),d=Math.floor(c/2),e=c-d,f=a.to.top-a.from.top,g=Math.floor(f/2),h=f-g,i="",j="";return Math.abs(f)>Math.abs(c)?f>0?c>0?(i=" L "+(a.from.left+b+d)+" "+(a.from.top+d),j=" L "+(a.to.left-b-e)+" "+(a.to.top-e)):0>c&&(i=" L "+(a.from.left+b+d)+" "+(a.from.top-d),j=" L "+(a.to.left-b-e)+" "+(a.to.top+e)):0>f&&(c>0?(i=" L "+(a.from.left+b+d)+" "+(a.from.top-d),j=" L "+(a.to.left-b-e)+" "+(a.to.top+e)):0>c&&(i=" L "+(a.from.left+b+d)+" "+(a.from.top+d),j=" L "+(a.to.left-b-e)+" "+(a.to.top-e))):Math.abs(f)0?f>0?(i=" L "+(a.from.left+b+g)+" "+(a.from.top+g),j=" L "+(a.to.left-b-h)+" "+(a.to.top-h)):0>f&&(i=" L "+(a.from.left+b-g)+" "+(a.from.top+g),j=" L "+(a.to.left-b+h)+" "+(a.to.top-h)):0>c&&(f>0?(i=" L "+(a.from.left+b-g)+" "+(a.from.top+g),j=" L "+(a.to.left-b+h)+" "+(a.to.top-h)):0>f&&(i=" L "+(a.from.left+b+g)+" "+(a.from.top+g),j=" L "+(a.to.left-b-h)+" "+(a.to.top-h)))),"M "+a.from.left+" "+a.from.top+" L "+(a.from.left+b)+" "+a.from.top+i+j+" L "+(a.to.left-b)+" "+a.to.top+" L "+a.to.left+" "+a.to.top},remove:function(){var a=this.model.source,b=this.model.target;a&&a.parentNode.off(null,null,this),b&&b.parentNode.off(null,null,this),a&&a.view.plugCheckActive(),b&&b.view.plugCheckActive(),this.el.parentNode.removeChild(this.el)},click:function(a){a&&a.stopPropagation();var b;a&&(a.ctrlKey||a.metaKey)?(b=this.model.get("selected"),b=!b):(b=!0,this.model.parentGraph.nodes.invoke("set",{selected:!1}),this.model.collection.invoke("set",{selected:!1})),this.model.set({selected:b}),b&&(this.bringToTop(),this.model.trigger("select"),this.unfade()),this.model.parentGraph.view.fade()},bringToTop:function(){this.model.bringToTop();var a=this.el.parentNode;a&&a.appendChild(this.el),this.model.source.view.bringToTop(this.model),this.model.target.view.bringToTop(this.model)},inspector:null,getInspector:function(){if(!this.inspector){var c=new b.InspectView({model:this.model}),d=a.prototype.module("card");this.inspector=new d.Model({dataflow:this.model.parentGraph.dataflow,card:c})}return this.inspector},showInspector:function(a){this.model.parentGraph.dataflow.addCard(this.getInspector(),a)},hideInspector:function(){this.model.parentGraph.dataflow.removeCard(this.getInspector())}})}(Dataflow),function(a){var b=a.prototype.module("card");b.Model=Backbone.Model.extend({defaults:{pinned:!1},initialize:function(){this.dataflow=this.get("dataflow")},hide:function(){this.dataflow.shownCards.remove(this)}}),b.Collection=Backbone.Collection.extend({model:b.Model})}(Dataflow),function(a){var b=a.prototype.module("card"),c='
';b.View=Backbone.View.extend({tagName:"div",className:"dataflow-card",template:_.template(c),events:{"click .dataflow-card-pin":"togglePin","click .dataflow-card-close":"hide"},initialize:function(){this.$el.html(this.template()),this.card=this.model.get("card"),this.$el.append(this.card.el),this.listenTo(this.model,"change:pinned",this.pinnedChanged),this.pinnedChanged()},animate:function(a){"function"==typeof this.card.animate&&this.card.animate(a)},togglePin:function(){var a=!this.model.get("pinned");this.model.set("pinned",a),a||this.hide()},pinnedChanged:function(){this.model.get("pinned")?this.$(".dataflow-card-pin").addClass("active"):this.$(".dataflow-card-pin").removeClass("active")},hide:function(){this.model.hide()},remove:function(){this.$el.detach()}}),window.requestAnimationFrame||(window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,50)}}()),b.CollectionView=Backbone.CollectionView.extend({tagName:"div",className:"dataflow-cards",itemView:b.View,prepend:!0,initialize:function(){Backbone.CollectionView.prototype.initialize.apply(this,arguments);var a=function(b){window.requestAnimationFrame(a),this.collection.each(function(a){a.view&&a.view.animate(b)})}.bind(this);a()},bringToTop:function(a){this.$el.prepend(a.view.el)}})}(Dataflow),function(a){var b=Backbone.Model.extend({defaults:{label:"",icon:"",action:null}}),c=Backbone.Collection.extend({model:b}),d=a.prototype.module("card"),e=a.prototype.module("menucard");e.Model=d.Model.extend({initialize:function(){this.menu=new c,d.Model.prototype.initialize.call(this)}})}(Dataflow),function(a){var b=a.prototype.module("card"),c=a.prototype.module("menucard"),d=Backbone.View.extend({tagName:"li",template:'',events:{click:"clicked"},render:function(){this.$el.html(_.template(this.template,this.model.toJSON()))},clicked:function(){this.model.get("action")&&this.model.get("action")()}});c.View=b.View.extend({initialize:function(){this.model.set("card",new Backbone.CollectionView({tagName:"ul",className:"dataflow-menu",collection:this.model.menu,itemView:d})),b.View.prototype.initialize.call(this)}})}(Dataflow),function(a){var b=a.prototype.module("node"),c='

<%- label %>

<%- type %>

',d=function(a,b,c){a[0].contentEditable=!0;var d=a.text(),e=function(){b.set(c,a.text())},f=function(){a.text(d)};a.focus(function(){d=a.text()}).blur(function(){e()}).keydown(function(b){27===b.which?(f(),a.blur()):13===b.which&&a.blur()})};b.InspectView=Backbone.View.extend({template:_.template(c),className:"dataflow-node-inspector",events:{},initialize:function(){this.$el.html(this.template(this.model.toJSON()));var a=this.$el.children(".dataflow-node-inspector-inputs");this.model.inputs.each(function(b){b.view&&b.view.$input&&a.append(b.view.$input)},this),d(this.$(".dataflow-node-inspector-label"),this.model,"label")},render:function(){return this},removeModel:function(){this.model.remove()}})}(Dataflow),function(a){var b=a.prototype.module("edge"),c='

Edge

<%= id %>

    ';b.InspectView=Backbone.View.extend({tagName:"div",className:"dataflow-edge-inspector",positions:null,template:_.template(c),initialize:function(){var a=this.model.toJSON();this.model.id&&(a.id=this.model.id.replace("->","→")),this.$el.html(this.template(a));var b=this.$el.children(".dataflow-edge-inspector-route-choose");this.$log=this.$el.children(".dataflow-edge-inspector-events");for(var c=function(a){var b=$(a.target).data("route");this.model.set("route",b)}.bind(this),d=0;12>d;d++){var e=$("



    ');h.children(".selectall").click(c),b.selectAll=c,b.removeSelected=function(){var b=a.currentGraph.nodes.where({selected:!0});_.each(b,function(a){a.remove()})},h.children(".cut").click(d),b.cut=d,b.removeEdge=e;var i={};h.children(".copy").click(f),b.copy=f,h.children(".paste").click(g),b.paste=g,a.addContext({id:"cut",icon:"cut",label:"cut",action:d,contexts:["node","nodes"]}),a.addContext({id:"copy",icon:"copy",label:"copy",action:f,contexts:["node","nodes"]}),a.addContext({id:"paste",icon:"paste",label:"paste",action:g,contexts:["node","nodes"]}),a.addContext({id:"edgeRemove",icon:"remove",label:"remove edge",action:e,contexts:["edge"]}),a.addContext({id:"edgeRemove",icon:"remove",label:"remove edges",action:e,contexts:["edges"]}),b.onSearch=function(b,c){if(a.currentGraph){var d=[];a.currentGraph.nodes.each(function(a){-1!==a.get("label").toLowerCase().indexOf(b.toLowerCase())&&d.push({source:"edit",icon:"sign-blank",label:a.get("label"),description:a.type,action:function(){a.view.select()}})}),c(d)}}}}(Dataflow),function(a){var b=a.prototype.plugin("elements");b.list=[{type:"div",attributes:["id","class","style"],events:["pointermove","pointerover","pointerout"]},{type:"button",attributes:["id","class","style"],events:["pointerdown","pointerup"]}]}(Dataflow),function(a){var b=a.prototype.plugin("library");b.initialize=function(a){var c=$('
    '),d=$('
      ');c.append(d),b.excluded=["base","base-resizable"];var e=function(b,c,d){return function(){a.currentGraph.view.$(".dataflow-node").removeClass("ui-selected"),zoom=a.currentGraph.get("zoom");for(var e=1;a.currentGraph.nodes.get(e);)e++;c=void 0===c?200:c,d=void 0===d?200:d,c=c/zoom-a.currentGraph.get("panX"),d=d/zoom-a.currentGraph.get("panY");var f=new b.Model({id:e,x:c,y:d,parentGraph:a.currentGraph});a.currentGraph.nodes.add(f),f.view.select()}},f='
    • <%- name %><%-description %>
    • ',g=function(b,c){var g=$(_.template(f,{name:b,description:c.description}));$(".button",g).attr("title","click or drag").draggable({helper:function(){var c=$('
      '+b+"
      ");return a.$el.append(c),c},stop:function(a,b){e(c,b.position.left,b.position.top).call()}}).click(e(c)),d.append(g)},h=function(c){c=c?c:{},b.excluded=c.exclude?c.exclude:b.excluded,d.empty();var e=_.sortBy(Object.keys(a.nodes),function(a){return a});_.each(e,function(c){-1===b.excluded.indexOf(c)&&g(c,a.nodes[c])})};h(),a.addPlugin({id:"library",label:"library",name:"",menu:c,icon:"plus",pinned:!1}),b.update=h,b.onSearch=function(c,d){var f=[];_.each(a.nodes,function(a,d){-1===b.excluded.indexOf(d)&&-1!==d.toLowerCase().indexOf(c.toLowerCase())&&f.push({source:"library",icon:"plus",action:function(){e(a).call()},label:d,description:a.description})}),d(f)}}}(Dataflow),function(a){var b=a.prototype.plugin("source");b.updateAllowed=!0,b.initialize=function(a){var c=$('

      '),d=c.find(".code");a.addPlugin({id:"source",label:"view source",name:"",menu:c,icon:"code",pinned:!0}),b.show=function(a){var b=d.prop("scrollTop");d.val(a),d.scrollTop(b)};var e=function(){a.graph&&b.show(JSON.stringify(a.graph.toJSON(),null," "))};b.listeners=function(b){b?a.on("change",e):a.off("change",e)},b.listeners(!0),b.allowUpdate=function(a){var e=c.find(".apply");return a?(b.updateAllowed=!0,e.show(),d.removeAttr("readonly"),void 0):(b.updateAllowed=!1,e.hide(),d.attr("readonly","readonly"),void 0)},c.submit(function(){return b.updateGraph(d,a),!1})},b.updateGraph=function(a,c){if(b.updateAllowed){var d;try{d=JSON.parse(a.val())}catch(e){return c.log("Invalid JSON"),!1}if(d){var f=c.loadGraph(d);f.trigger("change")}}}}(Dataflow),function(a){var b=a.prototype.plugin("log");b.initialize=function(a){function c(a){a=_.escape(a),d.children(".loglist").append("
    • "+a+"
    • "),d.scrollTop(d.prop("scrollHeight"))}var d=$('
        ');a.addPlugin({id:"log",label:"log",name:"",menu:d,icon:"th-list",pinned:!0}),b.add=c;var e=function(a){c("log: "+a)},f=function(a,b){c("node added: "+b.toString())},g=function(a,b){c("node removed: "+b.toString())},h=function(a,b){c("edge added: "+b.toString())},i=function(a,b){c("edge removed: "+b.toString())};b.listeners=function(b){b?(a.on("log",e),a.on("node:add",f),a.on("node:remove",g),a.on("edge:add",h),a.on("edge:remove",i)):(a.off("log",e),a.off("node:add",f),a.off("node:remove",g),a.off("edge:add",h),a.off("edge:remove",i))},b.listeners(!0)}}(Dataflow),function(a){var b=a.prototype.plugin("inspector");b.initialize=function(a){function b(){var b=a.currentGraph.nodes.where({selected:!0});b.forEach(function(b){var c=b.view.getInspector();c.set("pinned",!0),a.addCard(c)});var c=a.currentGraph.edges.where({selected:!0});c.forEach(function(b){var c=b.view.getInspector();c.set("pinned",!0),a.addCard(c)})}a.addContext({id:"inspector",icon:"info-sign",label:"inspect",action:b,contexts:["one","twoplus"]})}}(Dataflow),function(a){var b=a.prototype.plugin("keybinding"),c=a.prototype.plugin("edit");b.initialize=function(a){function d(){a&&a.currentGraph&&a.currentGraph.view&&a.currentGraph.view.zoomIn()}function e(){a&&a.currentGraph&&a.currentGraph.view&&a.currentGraph.view.zoomOut()}function f(){a&&a.currentGraph&&a.currentGraph.view&&a.currentGraph.view.zoomCenter()}function g(a){if("TEXTAREA"!==a.target.tagName&&"INPUT"!==a.target.tagName&&"true"!==a.target.contentEditable&&(a.ctrlKey||a.metaKey))switch(a.which){case 189:a.preventDefault(),d();break;case 187:a.preventDefault(),e();break;case 48:a.preventDefault(),f();break;case 65:c.selectAll();break;case 88:c.cut();break;case 67:c.copy();break;case 86:c.paste();break;case 90:}}b.listeners=function(a){a?$(document).on("keydown",g):$(document).off("keydown",g)},b.listeners(!0)}}(Dataflow),function(a){var b=a.prototype.plugin("notification"),c=window.webkitNotifications?!0:!1;b.requestPermission=function(){c&&(b.hasPermission()||window.webkitNotifications.requestPermission())},b.hasPermission=function(){return c?0!==window.webkitNotifications.checkPermission()?!1:!0:!1},b.notify=function(a,c,d){if(!b.hasPermission()){if(!console||!console.log)return;return console.log(c+": "+d),void 0}var e=window.webkitNotifications.createNotification(a,c,d);e.show()}}(Dataflow),function(a){var b=a.prototype.plugin("search"),c=Backbone.Model.extend({defaults:{source:"",icon:"",action:null,label:"",description:""}}),d=Backbone.Collection.extend({model:c,initialize:function(a,b){b||(b={}),this.search=b.search}}),e=Backbone.View.extend({tagName:"li",template:'<%- label %><%- description %>',events:{click:"clicked"},render:function(){this.$el.html(_.template(this.template,this.model.toJSON()))},clicked:function(){this.model.get("action")&&this.model.get("action")()}});b.initialize=function(a){var c=$(''),d=c.find("input"),e=c.find("button");a.$el.prepend(c),d.on("keyup search webkitspeechchange",function(){return d.val()?(b.search(d.val(),a),void 0):(a.removeCard("searchresults"),void 0)}),e.on("click",function(){a.showPlugin("menu")})},b.search=function(c,f){var g=a.prototype.module("card"),h=new d([],{search:c}),i=new Backbone.CollectionView({tagName:"ul",className:"dataflow-plugin-search-results",collection:h});i.itemView=e;var j=new g.Model({id:"searchresults",dataflow:f,card:i,pinned:!1});h.on("add",function(){f.addCard(j)}),b.results=h,_.each(f.plugins,function(a){a.onSearch&&b.searchPlugin(h,c,a)})},b.searchPlugin=function(a,c,d){d.onSearch(c,function(d){c===b.results.search&&d.forEach(function(b){a.add(b)})})}}(Dataflow),function(a){var b=a.prototype.module("node"),c=a.prototype.node("base");c.Model=b.Model.extend({defaults:function(){var a=b.Model.prototype.defaults.call(this);return a.type="base",a},initialize:function(){b.Model.prototype.initialize.call(this)},unload:function(){},inputs:[],outputs:[]}),c.View=b.View.extend({})}(Dataflow),function(a){var b=a.prototype.node("base"),c=a.prototype.node("base-resizable");c.Model=b.Model.extend({defaults:function(){var a=b.Model.prototype.defaults.call(this);return a.type="base-resizable",a.w=200,a.h=200,a},initialize:function(){b.Model.prototype.initialize.call(this)},unload:function(){},toJSON:function(){var a=b.Model.prototype.toJSON.call(this);return a.w=this.get("w"),a.h=this.get("h"),a},inputs:[],outputs:[]}),c.View=b.View.extend({initialize:function(a){b.View.prototype.initialize.call(this,a),this.$el.css({width:this.model.get("w"),height:this.model.get("h")});var c=this;this.$el.resizable({helper:"dataflow-node helper",minHeight:100,minWidth:120,stop:function(a,b){c.resizeStop(a,b)}})},resizeStop:function(a,b){this.model.set({w:b.size.width,h:b.size.height})}})}(Dataflow),function(a){var b=a.prototype.node("base-resizable"),c=a.prototype.node("dataflow-subgraph"),d=a.prototype.module("graph"),e=a.prototype.module("input"),f=a.prototype.module("output");c.Model=b.Model.extend({defaults:function(){var a=b.Model.prototype.defaults.call(this);return a.label="subgraph",a.type="dataflow-subgraph",a.graph={nodes:[{id:"1",label:"in",type:"dataflow-input",x:180,y:15},{id:"99",label:"out",type:"dataflow-output",x:975,y:500}]},a},initialize:function(){b.Model.prototype.initialize.call(this);var a=this.get("graph");a.parentNode=this,a.dataflow=this.parentGraph.dataflow,this.graph=new d.Model(a);var c=this.graph.nodes.filter(function(a){return"dataflow-input"===a.type});_.each(c,this.addInput,this);var e=this.graph.nodes.filter(function(a){return"dataflow-output"===a.type});_.each(e,this.addOutput,this),this.graph.nodes.on("add",function(a){"dataflow-input"===a.type?this.addInput(a):"dataflow-output"===a.type&&this.addOutput(a)},this),this.graph.nodes.on("remove",function(a){"dataflow-input"===a.type?this.removeInput(a):"dataflow-output"===a.type&&this.removeOutput(a)},this)},addInput:function(a){var b=new e.Model({id:a.id,label:a.get("label"),type:a.get("input-type"),parentNode:this,inputNode:a});this.inputs.add(b)},recieve:function(a,b){var c=this.inputs.get(a).get("inputNode");c&&c.send("data",b)},addOutput:function(a){var b=new f.Model({id:a.id,label:a.get("label"),type:a.get("output-type"),parentNode:this,outputNode:a});this.outputs.add(b),a.set("parentNode",this)},removeInput:function(a){var b=this.inputs.get(a.id);b.remove(),this.inputs.remove(b)},removeOutput:function(a){var b=this.outputs.get(a.id);b.remove(),this.outputs.remove(b)},toJSON:function(){var a=b.Model.prototype.toJSON.call(this);return a.graph=this.graph,a},remove:function(){b.Model.prototype.remove.call(this),this.graph.remove()},inputs:[],outputs:[]});var g='';c.View=b.View.extend({events:function(){var a=b.View.prototype.events.call(this);return a["click .show-subgraph"]="showSubgraph",a},innerTemplate:_.template(g),initialize:function(a){b.View.prototype.initialize.call(this,a),this.model.graph.view=new d.View({model:this.model.graph}),this.model.inputs.each(this.addInput,this),this.model.inputs.on("add",this.addInput,this),this.model.outputs.each(this.addOutput,this),this.model.outputs.on("add",this.addOutput,this)},addInput:function(a){a.get("inputNode")&&a.get("inputNode").on("change:label",function(b){a.view.$(".label").text(b.get("label"))},this)},addOutput:function(a){a.get("outputNode")&&a.get("outputNode").on("change:label",function(b){a.view.$(".label").text(b.get("label"))},this)},showSubgraph:function(){this.model.graph.dataflow.showGraph(this.model.graph)}})}(Dataflow); +function CircularBuffer(a){this._array=new Array(a),this.length=0}CircularBuffer.prototype.toString=function(){return"[object CircularBuffer("+this._array.length+") length "+this.length+"]"},CircularBuffer.prototype.get=function(a){return 0>a||aa||athis.length;)this._array[this.length%this._array.length]=void 0,this.length++;this._array[a%this._array.length]=b,a==this.length&&this.length++},CircularBuffer.prototype.push=function(a){this._array[this.length%this._array.length]=a,this.length++},CircularBuffer.IndexError={},function(){var a=Backbone.Model.extend({$:function(a){return this.$el.find(a)},initialize:function(){this.el=document.createElement("div"),this.el.className="dataflow",this.$el=$(this.el),this.$el.data("dataflow",this);var a=Dataflow.prototype.module("card");if(this.shownCards=new a.Collection,this.shownCards.view=new a.CollectionView({collection:this.shownCards}),this.$el.append(this.shownCards.view.$el),this.debug=this.get("debug"),this.controls=this.get("controls"),this.controls!==!1&&(this.controls=!0),this.controls)for(var b in this.plugins)this.plugins[b].initialize&&this.plugins[b].initialize(this);this.inputs=this.get("inputs"),this.inputs!==!1&&(this.inputs=!0),this.editable=this.get("editable"),this.editable!==!1&&(this.editable=!0);var c=this.get("appendTo");c=c?c:"body","body"===c&&$("html, body").css({margin:"0px",padding:"0px",width:"100%",height:"100%"}),$(c).append(this.el),this.id||(this.id=$(c).attr("id")),this.loadState()},modules:{},module:function(a){return this.modules[a]?this.modules[a]:(this.modules[a]={},this.modules[a])},nodes:{},node:function(a){return this.nodes[a]?this.nodes[a]:(this.nodes[a]={description:""},this.nodes[a])},plugins:{},plugin:function(a){return this.plugins[a]?this.plugins[a]:(this.plugins[a]={},this.plugins[a])},addCard:function(a,b){b||this.hideCards(),this.shownCards.get(a)?this.shownCards.view.bringToTop(a):this.shownCards.add(a)},removeCard:function(a){this.shownCards.remove(a)},hideCards:function(){var a=this.shownCards.where({pinned:!1});this.shownCards.remove(a)},addPlugin:function(a){var b=this.plugins[a.id];if(b||(this.plugins[a.id]=b={}),b.info=a,b.enabled=!0,a.menu){var c=Dataflow.prototype.module("card"),d=new c.Model({dataflow:this,card:{el:a.menu},pinned:a.pinned?!0:!1});b.card=d,this.plugins.menu.addPlugin({id:a.id,icon:a.icon,label:a.label,showLabel:!1})}},showPlugin:function(a){this.plugins[a]&&this.plugins[a].card&&(this.addCard(this.plugins[a].card),"function"==typeof this.plugins[a].onShow&&this.plugins[a].onShow())},enablePlugin:function(a){var b=this.plugins[a];b&&this.addPlugin(b.info)},disablePlugin:function(a){this.plugins.menu.disablePlugin(a)},showContextBar:function(){this.contextBar.view.$el.show()},hideContextBar:function(){this.contextBar.view.$el.hide()},contexts:{},prepareContext:function(a){if(this.contexts[a])return this.contexts[a];var b=this.module("menucard");return this.contexts[a]=new b.Model({id:"context-"+a,dataflow:this,pinned:!0}),this.contexts[a].view=new b.View({model:this.contexts[a]}),this.contexts[a]},addContext:function(a){_.each(a.contexts,function(b){var c=this.prepareContext(b);c.menu.add(a)},this)},changeContext:function(a,b){var c=function(a,b){this.contexts[a]&&(this.contexts[a].set("label",b),this.shownCards.get("context-"+a)||this.shownCards.add(this.contexts[a]))}.bind(this),d=function(a){this.shownCards.get("context-"+a)&&this.shownCards.remove("context-"+a)}.bind(this);a.length>1?(c("nodes",a.length+" nodes"),d("node")):1===a.length?(c("node",a[0].get("label")),d("nodes")):(d("node"),d("nodes")),b.length>1?(c("edges",b.length+" edges"),d("edge")):1===b.length?(c("edge",b[0].id),d("edges")):(d("edge"),d("edges"))},loadGraph:function(a){this.graph&&(this.currentGraph.view&&this.currentGraph.view.remove(),this.graph.view&&this.graph.view.remove(),this.graph.remove());var b=this.module("graph");a.dataflow=this;var c=new b.Model(a);return c.view=new b.View({model:c}),this.$el.append(c.view.render().el),this.graph=this.currentGraph=c,c},showGraph:function(a){this.currentGraph.view.$el.detach(),this.$el.append(a.view.el),a.view.render(),this.currentGraph=a},debug:!1,log:function(a){this.trigger("log",a,arguments),this.debug&&console.log("Dataflow: ",arguments)},types:["all","canvas:2d","canvas:webgl","string","number","int","object","array"]});window.Dataflow=a,"object"==typeof exports&&(exports.Dataflow=a),Backbone.View.prototype.addEvents=function(a){this.delegateEvents(_.extend(_.clone(this.events),a))},Backbone.CollectionView=Backbone.Model.extend({prepend:!1,initialize:function(a){a.tagName&&(this.tagName=a.tagName),a.className&&(this.className=a.className),a.itemView&&(this.itemView=a.itemView),this.el=document.createElement(this.tagName),this.el.className=this.className,this.$el=$(this.el),this.parent=a.parent;var b=this.collection=this.get("collection");b.each(this.addItem,this),b.on("add",this.addItem,this),b.on("remove",this.removeItem,this)},addItem:function(a){a.view||(a.view=new this.itemView({model:a,parent:this.parent}),a.view.render()),this.prepend?this.$el.prepend(a.view.el):this.$el.append(a.view.el)},removeItem:function(a){a.view.remove()}})}(),function(a){var b=Backbone.Model.extend({});a.prototype.loadState=function(){var a="dataflow-"+(this.id?this.id:this.cid),c=JSON.parse(window.localStorage.getItem(a));c||(c={});var d=new b(c);this.set("state",d),d.on("change",function(b){window.localStorage.setItem(a,JSON.stringify(b.toJSON()))})}}(Dataflow),function(a){var b=a.prototype.module("graph"),c=a.prototype.module("node"),d=a.prototype.module("edge");b.Model=Backbone.Model.extend({defaults:{nodes:[],edges:[],panX:0,panY:0,zoom:1},initialize:function(){this.dataflow=this.get("dataflow");var a,b=this.nodes=new c.Collection;b.parentGraph=this,b.on("all",function(){this.trigger("change")},this),b.on("add",function(a){this.dataflow.trigger("node:add",this,a)},this),b.on("remove",function(a){a.remove(),this.dataflow.trigger("node:remove",this,a)},this);var e=this.get("nodes");for(a=0;a0;)this.nodes.remove(this.nodes.at(this.nodes.length-1))},toJSON:function(){return{nodes:this.nodes,edges:this.edges}}})}(Dataflow),function(a){var b=a.prototype.module("node"),c=a.prototype.module("input"),d=a.prototype.module("output");b.Model=Backbone.Model.extend({defaults:function(){return{label:"",description:"",type:"test",x:200,y:100,state:{},selected:!1}},initialize:function(){this.parentGraph=this.get("parentGraph"),this.type=this.get("type"),""===this.get("label")&&this.set({label:this.get("type")});var a=this.inputs;this.inputs=new c.Collection,this.inputs.parentNode=this;for(var b=0;b0;)this.connected[0].remove()}}),b.Collection=Backbone.Collection.extend({model:b.Model})}(Dataflow),function(a){var b=a.prototype.module("input"),c=a.prototype.module("output");c.Model=b.Model.extend({defaults:{id:"output",label:"",type:"all",description:"",multiple:!0}}),c.Collection=Backbone.Collection.extend({model:c.Model})}(Dataflow),function(a){var b=a.prototype.module("edge");b.Model=Backbone.Model.extend({defaults:{z:0,route:0,selected:!1,log:null},initialize:function(){var a,b,c,d=this.get("preview");if(this.parentGraph=this.get("parentGraph"),this.attributes.log=new CircularBuffer(50),d){a=this.get("parentGraph").nodes;var e=this.get("source"),f=this.get("target");e?(b=a.get(this.get("source").node),this.source=b.outputs.get(this.get("source").port)):f&&(c=a.get(this.get("target").node),this.target=c.inputs.get(this.get("target").port))}else{a=this.parentGraph.nodes;try{b=a.get(this.get("source").node),this.source=b.outputs.get(this.get("source").port),c=a.get(this.get("target").node),this.target=c.inputs.get(this.get("target").port)}catch(g){}this.source.connect(this),this.target.connect(this),b.on("send:"+this.source.id,this.send,this),this.bringToTop(),this.on("select",this.select,this)}},select:function(){this.parentGraph.trigger("select:edge",this)},send:function(a){this.target.parentNode.recieve(this.target.id,a)},isConnectedToPort:function(a){return this.source===a||this.target===a},isConnectedToNode:function(a){return this.source.parentNode===a||this.target.parentNode===a},toString:function(){return this.id?this.id:this.get("source").node+":"+this.get("source").port+"::"+this.get("target").node+":"+this.get("target").port},toJSON:function(){return{source:this.get("source"),target:this.get("target"),route:this.get("route")}},bringToTop:function(){var a=0;this.parentGraph.edges.each(function(b){if(b!==this){var c=b.get("z");c>a&&(a=c),b.view&&b.view.unhighlight()}},this),this.set("z",a+1)},remove:function(){this.source.disconnect(this),this.target.disconnect(this),this.collection&&this.collection.remove(this),this.source.parentNode.off("send:"+this.source.id,this.send,this),this.trigger("remove")}}),b.Collection=Backbone.Collection.extend({model:b.Model,comparator:function(a){return a.get("z")}})}(Dataflow),function(a){var b=a.prototype.module("graph");a.prototype.module("node");var c=a.prototype.module("edge"),d=.2,e=1.1;document.createElement("div").style.hasOwnProperty("zoom");var f='
        ';b.View=Backbone.View.extend({template:_.template(f),className:"dataflow-g",events:{"click .dataflow-graph":"deselect","dragstart .dataflow-graph-panzoom":"panStart","drag .dataflow-graph-panzoom":"pan","dragstop .dataflow-graph-panzoom":"panStop","click .dataflow-graph-gotoparent":"gotoParent",mousewheel:"mouseWheel"},initialize:function(){this.$el.html(this.template(this.model.toJSON()));var a=this.model.get("nodes"),b=this.model.get("edges");this.nodes=a.view={},this.model.nodes.each(this.addNode,this),this.model.nodes.on("add",this.addNode,this),this.model.nodes.on("remove",this.removeNode,this),this.edges=b.view={},this.model.edges.each(this.addEdge,this),this.model.edges.on("add",this.addEdge,this),this.model.edges.on("remove",this.removeEdge,this);var c=this.model.get("parentNode");c||this.$(".dataflow-graph-controls").hide(),this.$(".dataflow-graph-panzoom").draggable({helper:function(){var a=$("
        ");return this.model.dataflow.$el.append(a),a}.bind(this)}),this.$graphEl=this.$(".dataflow-graph"),this.graphEl=this.$(".dataflow-graph")[0],this.$graphEl.css({transform:"translate3d(0, 0, 0) scale3d(1, 1, 1) ",transformOrigin:"left top"}),this.bindInteraction()},panStartOffset:null,panStart:function(a,b){b&&(this.panStartOffset=b.offset)},pan:function(a,b){if(b){var c=this.model.get("zoom"),d=b.offset.left-this.panStartOffset.left,e=b.offset.top-this.panStartOffset.top;this.$(".dataflow-graph").css({transform:"translate3d("+d/c+"px, "+e/c+"px, 0)"})}},panStop:function(a,b){this.$(".dataflow-graph").css({transform:"translate3d(0, 0, 0)"});var c=this.model.get("zoom"),d=b.offset.left-this.panStartOffset.left,e=b.offset.top-this.panStartOffset.top;this.model.set({panX:this.model.get("panX")+d/c,panY:this.model.get("panY")+e/c})},tempPanX:0,tempPanY:0,setPanDebounce:_.debounce(function(){this.$(".dataflow-graph").css({transform:"translate3d(0, 0, 0)"}),this.model.set({panX:this.model.get("panX")+this.tempPanX,panY:this.model.get("panY")+this.tempPanY}),this.tempPanX=0,this.tempPanY=0},250),mouseWheel:function(a){a.preventDefault();var b=a.originalEvent;this.tempPanX+=b.wheelDeltaX/6,this.tempPanY+=b.wheelDeltaY/6,this.$(".dataflow-graph").css({transform:"translate3d("+this.tempPanX+"px, "+this.tempPanY+"px, 0)"}),this.setPanDebounce()},gotoParent:function(){var a=this.model.get("parentNode");a&&this.model.dataflow.showGraph(a.parentGraph)},bindInteraction:function(){this.bindZoom(),this.bindScroll()},bindZoom:function(){if(window.Hammer){var a,b,c,f,g,h,i,j,k,l,m=this;Hammer(this.$(".dataflow-graph-panzoom")[0]).on("transformstart",function(d){a=m.model.get("zoom"),b=d.gesture.center.pageX,c=d.gesture.center.pageY,f=b/a,g=c/a;var e=m.$el.offset();k=f-e.left,l=g-e.top,m.$graphEl.css({transformOrigin:f+"px "+g+"px"})}).on("transform",function(f){h=Math.max(d/a,Math.min(f.gesture.scale,e/a)),i=(f.gesture.center.pageX-b)/a,j=(f.gesture.center.pageY-c)/a,m.$graphEl.css({transform:"translate3d("+i+"px,"+j+"px, 0) "+"scale3d("+h+","+h+", 1) "})}).on("transformend",function(){m.$graphEl.css({transform:"translate3d(0, 0, 0) scale3d(1, 1, 1) "});var b=a*h;b=Math.max(d,Math.min(b,e)),m.model.set("zoom",b),k*=b,l*=b,m.model.set({panX:m.model.get("panX")+i,panY:m.model.get("panY")+j}),console.log(m.model.attributes)});var n=function(){var a=m.model.get("zoom"),b=m.zoomClass;m.zoomClass=.5>a?"zoom-tiny":.8>a?"zoom-small":1.3>a?"zoom-normal":"zoom-big",m.$graphEl.removeClass(b).addClass(m.zoomClass),m.graphEl.style.zoom=m.model.get("zoom")};this.model.on("change:zoom",n),1!==this.model.get("zoom")&&n()}},zoomClass:1,zoomIn:function(){var a=this.model.get("zoom"),b=.9*a;b=Math.max(d,b),b!==a&&this.model.set("zoom",b)},zoomOut:function(){var a=this.model.get("zoom"),b=1.1*a;b=Math.min(e,b),b!==a&&this.model.set("zoom",b)},zoomCenter:function(){var a=this.model.get("zoom"),b=1;b!==a&&this.model.set("zoom",1)},bindScroll:function(){},render:function(){var a=this;return _.defer(function(){a.rerenderEdges()},this),this},addNode:function(a){var b=this.model.dataflow.nodes[a.type];if(b&&b.View)a.view=new b.View({model:a,graph:this});else{var c=this.model.dataflow.node("base");a.view=new c.View({model:a,graph:this})}this.nodes[a.id]=a.view,a.view.render(),this.$(".dataflow-nodes").append(a.view.el)},removeNode:function(a){a.view.remove(),this.nodes[a.id]=null,delete this.nodes[a.id]},addEdge:function(a){a.view=new c.View({model:a}),this.edges[a.id]=a.view,a.view.render(),this.$(".dataflow-svg-edges")[0].appendChild(a.view.el)},removeEdge:function(a){a.view&&a.view.remove(),this.edges[a.id]=null,delete this.edges[a.id]},rerenderEdges:function(){_.each(this.edges,function(a){a.render()},this)},sizeSVG:function(){try{var a=this.$(".dataflow-svg-edges")[0],b=a.getBBox(),c=Math.max(Math.round(b.x+b.width+50),50),d=Math.max(Math.round(b.y+b.height+50),50);a.setAttribute("width",c),a.setAttribute("height",d)}catch(e){}},deselect:function(){this.model.nodes.invoke("set",{selected:!1}),this.model.edges.invoke("set",{selected:!1}),this.model.trigger("selectionChanged"),this.unfade(),this.model.dataflow.hideCards()},fade:function(){this.model.nodes.each(function(a){a.view&&(a.get("selected")||a.view.fade())}),this.fadeEdges()},fadeEdges:function(){this.model.edges.each(function(a){a.get("selected")||a.source.parentNode.get("selected")||a.target.parentNode.get("selected")?a.view.unfade():a.view.fade()})},unfade:function(){this.model.nodes.each(function(a){a.view&&a.view.unfade()}),this.model.edges.each(function(a){a.view&&a.view.unfade()})}})}(Dataflow),function(a){var b,c=a.prototype.module("node"),d=a.prototype.module("input"),e=a.prototype.module("output"),f='

        <%- label %>

        ',g="";c.View=Backbone.View.extend({template:_.template(f),innerTemplate:_.template(g),className:"dataflow-node",events:function(){return{"click .dataflow-node-header":"select",dragstart:"dragStart",drag:"drag",dragstop:"dragStop"}},initialize:function(a){this.$el.html(this.template(this.model.toJSON())),this.graph=a.graph,this.$el.addClass(this.model.type),this.model.parentGraph.dataflow.editable||this.$(".dataflow-node-edit").hide(),this.inputs=this.model.inputs.view=new d.CollectionView({collection:this.model.inputs,parent:this}),this.outputs=this.model.outputs.view=new e.CollectionView({collection:this.model.outputs,parent:this}),this.$el.draggable({handle:"h1",helper:function(){return $("
        ")}}),this.$el.data("dataflow-node-view",this),this.$(".dataflow-node-inner").append(this.innerTemplate),this.listenTo(this.model.parentGraph,"change:panX change:panY",this.bumpPosition),this.listenTo(this.model,"change:selected",this.selectedChanged),this.listenTo(this.model,"change:label",this.changeLabel),this.listenTo(this.model,"remove",this.hideInspector),this.$inner=this.$(".dataflow-node-inner")},render:function(){return this.$el.css({left:this.model.get("x")+this.model.parentGraph.get("panX"),top:this.model.get("y")+this.model.parentGraph.get("panY")}),this.$(".dataflow-node-ins").html(this.inputs.el),this.$(".dataflow-node-outs").html(this.outputs.el),this.$(".dataflow-node-controls").hide(),this.$(".label-edit").hide(),this},_alsoDrag:[],_dragDelta:{},$dragHelpers:$('
        '),dragStart:function(a,c){c&&(this.model.get("selected")||this.select(a,!0),a.stopPropagation(),b=this.model.parentGraph.get("zoom"),this.$dragHelpers.css({transform:"translate3d(0,0,0)"}),this.$el.parent().append(this.$dragHelpers),this._alsoDrag=this.model.collection.where({selected:!0}),_.each(this._alsoDrag,function(a){var b=a.view.$el,c=$('
        ').css({width:b.width(),height:b.height(),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)});this.$dragHelpers.append(c)},this))},changeLabel:function(){var a=this.model.get("label"),b=this.model.get("type");this.$(".dataflow-node-title").text(a).attr("title",a+": "+b)},drag:function(a,c){if(c){a.stopPropagation();var d=(c.position.left-c.originalPosition.left)/b,e=(c.position.top-c.originalPosition.top)/b;this.$dragHelpers.css({transform:"translate3d("+d+"px,"+e+"px,0)"})}},dragStop:function(a,c){if(c){a.stopPropagation(),this.model.parentGraph.get("panX"),this.model.parentGraph.get("panY");var d=(c.position.left-c.originalPosition.left)/b,e=(c.position.top-c.originalPosition.top)/b;this._alsoDrag.length&&(_.each(this._alsoDrag,function(a){a.view.moveToPosition(a.get("x")+d,a.get("y")+e)},this),this._alsoDrag=[]),this.$dragHelpers.empty(),this.$dragHelpers.remove()}},bumpPosition:function(){this.$el.css({left:this.model.get("x")+this.model.parentGraph.get("panX"),top:this.model.get("y")+this.model.parentGraph.get("panY")}),this.model.trigger("change:x change:y")},moveToPosition:function(a,b){this.model.set({x:a,y:b},{silent:!0}),this.bumpPosition()},removeModel:function(){this.model.remove()},bringToTop:function(){var a=0;this.model.collection.each(function(b){var c=parseInt(b.view.el.style.zIndex,10);c>a&&(a=c)},this),this.el.style.zIndex=a+1},select:function(a){a&&a.stopPropagation();var b=!1,c=this.model.get("selected");a&&(a.ctrlKey||a.metaKey)?(b=!0,c=!c,this.model.set("selected",c),c||this.fade()):(this.model.parentGraph.edges.invoke("set",{selected:!1}),this.model.parentGraph.nodes.invoke("set",{selected:!1}),this.model.parentGraph.view.fade(),c=!0,this.model.set("selected",!0)),this.bringToTop(),this.model.parentGraph.view.fadeEdges(),this.model.parentGraph.trigger("selectionChanged")},inspector:null,getInspector:function(){if(!this.inspector){var b=new c.InspectView({model:this.model}),d=a.prototype.module("card");this.inspector=new d.Model({dataflow:this.model.parentGraph.dataflow,card:b})}return this.inspector},showInspector:function(a){this.model.parentGraph.dataflow.addCard(this.getInspector(),a)},hideInspector:function(){this.model.parentGraph.dataflow.removeCard(this.getInspector())},fade:function(){this.$el.addClass("fade"),this.$el.removeClass("ui-selected")},unfade:function(){this.$el.removeClass("fade")},selectedChanged:function(){this.model.get("selected")?(this.highlight(),this.showInspector()):(this.unhighlight(),this.hideInspector())},highlight:function(){this.$el.removeClass("fade"),this.$el.addClass("ui-selected")},unhighlight:function(){this.$el.removeClass("ui-selected")}})}(Dataflow),function(a){var b=a.prototype.module("input"),c=a.prototype.module("edge"),d='',e=1;b.View=Backbone.View.extend({template:_.template(d),tagName:"li",className:"dataflow-port dataflow-in",events:{click:"getTopEdge",drop:"connectEdge","dragstart .dataflow-port-hole":"newEdgeStart","drag .dataflow-port-hole":"newEdgeDrag","dragstop .dataflow-port-hole":"newEdgeStop","dragstart .dataflow-port-plug":"changeEdgeStart","drag .dataflow-port-plug":"changeEdgeDrag","dragstop .dataflow-port-plug":"changeEdgeStop"},$input:null,initialize:function(a){this.$el.html(this.template(this.model.toJSON())),this.$el.addClass(this.model.get("type")),this.parent=a.parent;var b=this.parent.model,c=b.parentGraph;this.listenTo(b,"change:x change:y",function(){this._holePosition=null}.bind(this)),this.listenTo(c,"change:panX change:panY",function(){this._holePosition=null}.bind(this));var d=b.get("state");if(d&&d[this.model.id]&&this.$el.addClass("hasvalue"),this.model.parentNode.parentGraph.dataflow.editable){var e=this;if(this.$(".dataflow-port-plug").draggable({cursor:"pointer",helper:function(){var a=$('');return e.parent.graph.$el.append(a),a},disabled:!0,distance:10,delay:100}),this.$(".dataflow-port-hole").draggable({cursor:"pointer",helper:function(){var a=$('').data({port:e.model});return e.parent.graph.$el.append(a),a}}),this.$el.droppable({accept:".dataflow-port-plug.in, .dataflow-port-hole.out",activeClassType:"droppable-hover",refreshPositions:!0}),this.model.parentNode.parentGraph.dataflow.inputs){var f=this.model.get("type"),g=this.model.parentNode.get("state");if(a=this.model.get("options"),void 0!==a&&(_.isString(a)&&(a=a.split(" "),this.model.set("options",a)),_.isArray(a))){for(var h={},i=0;i').append(k).prepend(""+this.model.get("label")+" ");this.$input=l,this.model.connected.length&&l.addClass("connected"),this.model.on("connected",function(){this.$input.addClass("connected")},this),this.model.on("disconnected",function(){this.$input.removeClass("connected")},this)}}},renderInput:function(a,b){var c;if(b){c=$('').attr(f).addClass("int"===a?"input-int":"input-float"),"int"==a?c.change(this.inputInt.bind(this)):c.change(this.inputFloat.bind(this)),c;case"boolean":return c=$('
        '),c.change(this.inputBoolean.bind(this)),c;case"object":return c=$(''),c.on("change, keyup",this.inputObject.bind(this)),c;case"bang":return c=$(''),c.click(this.inputBang.bind(this)),c;default:return c=$(''),c.change(this.inputString.bind(this)),c}},setInputValue:function(a,b,c){return a?"SELECT"===a[0].tagName?($("option",a).each(function(){var a=$(this).data("val");$(this).prop("selected",a==c)}),void 0):"boolean"===b?(a.prop("checked",c),void 0):"object"===b?(a.text(JSON.stringify(c,null,2)),void 0):(a.val(c),void 0):void 0},inputSelect:function(a){var b=$(a.target).find(":selected").data("val");this.model.parentNode.setState(this.model.id,b)},inputInt:function(a){this.model.parentNode.setState(this.model.id,parseInt($(a.target).val(),10))},inputFloat:function(a){this.model.parentNode.setState(this.model.id,parseFloat($(a.target).val()))},inputString:function(a){this.model.parentNode.setState(this.model.id,$(a.target).val())},inputBoolean:function(a){this.model.parentNode.setState(this.model.id,$(a.target).prop("checked"))},inputObject:function(a){try{var b=JSON.parse($(a.target).text());this.model.parentNode.setState(this.model.id,b)}catch(c){}},inputBang:function(){this.model.parentNode.setBang(this.model.id)},render:function(){return this},newEdgeStart:function(a,b){if(b){a.stopPropagation(),b.helper.data({route:this.topRoute}),this.previewEdgeNew=new c.Model({target:{node:this.model.parentNode.id,port:this.model.id},parentGraph:this.model.parentNode.parentGraph,preview:!0,route:this.topRoute}),this.previewEdgeNewView=new c.View({model:this.previewEdgeNew});var d=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];d.appendChild(this.previewEdgeNewView.el),e=this.model.parentNode.parentGraph.get("zoom")}},newEdgeDrag:function(a,b){if(this.previewEdgeNewView&&b){a.stopPropagation(),b.position.top=a.clientY/e,b.position.left=a.clientX/e;var c=this.model.parentNode.parentGraph.view.el;b.position.left+=c.scrollLeft,b.position.top+=c.scrollTop,this.previewEdgeNewView.render({left:b.position.left-c.scrollLeft,top:b.position.top-c.scrollTop}),this.model.parentNode.parentGraph.view.sizeSVG()}},newEdgeStop:function(a){a.stopPropagation(),this.previewEdgeNewView.remove(),delete this.previewEdgeNew,delete this.previewEdgeNewView},getTopEdge:function(){var a,b=-1;return this.isConnected&&(this.model.parentNode.parentGraph.edges.each(function(c){var d=c.get("z");c.target===this.model&&d>b&&(a=c,b=d),c.view&&c.view.unhighlight()},this),a&&a.view&&a.view.bringToTop()),a},changeEdgeStart:function(a,b){if(b&&(a.stopPropagation(),this.isConnected)){var d=this.getTopEdge();if(d){d.remove(),b&&b.helper.data({port:d.source,route:d.get("route")}),this.previewEdgeChange=new c.Model({source:d.get("source"),route:d.get("route"),parentGraph:this.model.parentNode.parentGraph,preview:!0}),this.previewEdgeChangeView=new c.View({model:this.previewEdgeChange});var f=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];f.appendChild(this.previewEdgeChangeView.el),e=this.model.parentNode.parentGraph.get("zoom")}}},changeEdgeDrag:function(a,b){b&&(a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.render(b.offset),this.model.parentNode.parentGraph.view.sizeSVG()))},changeEdgeStop:function(a){a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.remove(),delete this.previewEdgeChange,delete this.previewEdgeChangeView)},connectEdge:function(a,b){var c=b.helper.data("port"),d=this.model.parentNode.parentGraph.edges.length;if(c.parentNode.parentGraph.dataflow!==this.model.parentNode.parentGraph.dataflow)return!1;if(this.model.canConnect()){var e=0;void 0!==b.helper.data("route")&&(e=b.helper.data("route")),this.model.parentNode.parentGraph.edges.add({id:c.parentNode.id+":"+c.id+"::"+this.model.parentNode.id+":"+this.model.id,parentGraph:this.model.parentNode.parentGraph,source:{node:c.parentNode.id,port:c.id},target:{node:this.model.parentNode.id,port:this.model.id},route:e}),b.helper.data("removeChangeEdge",db&&(a=c,b=d)}},this),a)this.bringToTop(a);else{try{this.$(".dataflow-port-plug").draggable("disable")}catch(c){}this.$(".dataflow-port-plug, .dataflow-port-hole").removeClass("active"),this.isConnected=!1}},topRoute:0,bringToTop:function(a){var b=a.get("route");void 0!==b&&(this.$(".dataflow-port-hole, .dataflow-port-plug").removeClass("route"+this.topRoute),this.$(".dataflow-port-hole, .dataflow-port-plug").addClass("route"+b),this.topRoute=b)}}),b.CollectionView=Backbone.CollectionView.extend({tagName:"ul",itemView:b.View})}(Dataflow),function(a){var b=a.prototype.module("output"),c=a.prototype.module("edge"),d='<%= label %>',e=1;b.View=Backbone.View.extend({template:_.template(d),tagName:"li",className:"dataflow-port dataflow-out",events:{click:"getTopEdge",drop:"connectEdge","dragstart .dataflow-port-hole":"newEdgeStart","drag .dataflow-port-hole":"newEdgeDrag","dragstop .dataflow-port-hole":"newEdgeStop","dragstart .dataflow-port-plug":"changeEdgeStart","drag .dataflow-port-plug":"changeEdgeDrag","dragstop .dataflow-port-plug":"changeEdgeStop"},initialize:function(a){this.$el.html(this.template(this.model.toJSON())),this.$el.addClass(this.model.get("type")),this.parent=a.parent;var b=this.parent.model,c=b.parentGraph;if(this.listenTo(b,"change:x change:y change:w",function(){this._holePosition=null}.bind(this)),this.listenTo(c,"change:panX change:panY",function(){this._holePosition=null}.bind(this)),this.model.parentNode.parentGraph.dataflow.editable){var d=this;this.$(".dataflow-port-plug").draggable({cursor:"pointer",helper:function(){var a=$('');return d.parent.graph.$el.append(a),a},disabled:!0,distance:10,delay:100}),this.$(".dataflow-port-hole").draggable({cursor:"pointer",helper:function(){var a=$('').data({port:d.model});return d.parent.graph.$el.append(a),a}}),this.$el.droppable({accept:".dataflow-port-plug.out, .dataflow-port-hole.in",activeClassType:"droppable-hover"})}},render:function(){return this},newEdgeStart:function(a,b){if(a.stopPropagation(),b){b.helper.data({route:this.topRoute}),this.previewEdge=new c.Model({source:{node:this.model.parentNode.id,port:this.model.id},parentGraph:this.model.parentNode.parentGraph,preview:!0,route:this.topRoute}),this.previewEdgeView=new c.View({model:this.previewEdge});var d=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];d.appendChild(this.previewEdgeView.el),e=this.model.parentNode.parentGraph.get("zoom")}},newEdgeDrag:function(a,b){if(a.stopPropagation(),this.previewEdgeView&&b){b.position.top=a.clientY/e,b.position.left=a.clientX/e;var c=this.model.parentNode.parentGraph.view.el;b.position.left+=c.scrollLeft,b.position.top+=c.scrollTop,this.previewEdgeView.render({left:b.position.left-c.scrollLeft,top:b.position.top-c.scrollTop})}},newEdgeStop:function(a){a.stopPropagation(),this.previewEdgeView.remove(),delete this.previewEdge,delete this.previewEdgeView},getTopEdge:function(){var a,b=-1;return this.isConnected&&(this.model.parentNode.parentGraph.edges.each(function(c){var d=c.get("z");c.source===this.model&&d>b&&(a=c,b=d),c.view&&c.view.unhighlight()},this),a&&a.view&&a.view.bringToTop()),a},changeEdgeStart:function(a,b){if(b&&(a.stopPropagation(),this.isConnected)){var d=this.getTopEdge();if(d){d.remove(),b&&b.helper.data({port:d.target,route:d.get("route")}),this.previewEdgeChange=new c.Model({target:d.get("target"),route:d.get("route"),parentGraph:this.model.parentNode.parentGraph,preview:!0}),this.previewEdgeChangeView=new c.View({model:this.previewEdgeChange});var f=this.model.parentNode.parentGraph.view.$(".dataflow-svg-edges")[0];f.appendChild(this.previewEdgeChangeView.el),e=this.model.parentNode.parentGraph.get("zoom")}}},changeEdgeDrag:function(a,b){b&&(a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.render(b.offset),this.model.parentNode.parentGraph.view.sizeSVG()))},changeEdgeStop:function(a){a.stopPropagation(),this.previewEdgeChange&&(this.previewEdgeChangeView.remove(),delete this.previewEdgeChange,delete this.previewEdgeChangeView)},connectEdge:function(a,b){var c=b.helper.data("port"),d=this.model.parentNode.parentGraph.edges.length;if(c.parentNode.parentGraph.dataflow!==this.model.parentNode.parentGraph.dataflow)return!1;if(this.model.canConnect()){var e=0;void 0!==b.helper.data("route")&&(e=b.helper.data("route")),this.model.parentNode.parentGraph.edges.add({id:this.model.parentNode.id+":"+this.model.id+"::"+c.parentNode.id+":"+c.id,parentGraph:this.model.parentNode.parentGraph,source:{node:this.model.parentNode.id,port:this.model.id},target:{node:c.parentNode.id,port:c.id},route:e}),b.helper.data("removeChangeEdge",db&&(a=c,b=d)}},this),a)this.bringToTop(a);else{try{this.$(".dataflow-port-plug").draggable("disable")}catch(c){}this.$(".dataflow-port-plug, .dataflow-port-hole").removeClass("active"),this.isConnected=!1}},topRoute:0,bringToTop:function(a){var b=a.get("route");void 0!==b&&(this.$(".dataflow-port-hole").removeClass("route"+this.topRoute),this.$(".dataflow-port-hole").addClass("route"+b),this.topRoute=b)}}),b.CollectionView=Backbone.CollectionView.extend({tagName:"ul",itemView:b.View})}(Dataflow),function(a){var b=a.prototype.module("edge"),c=function(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)"xlink:href"===d?c.setAttributeNS("http://www.w3.org/1999/xlink","href",b[d]):c.setAttribute(d,b[d]);return c},d=function(a,b){a.classList?a.classList.add(b):a.className="dataflow-edge "+b},e=function(a,b){a.classList?a.classList.remove(b):a.className="dataflow-edge"};b.View=Backbone.View.extend({tagName:"div",className:"dataflow-edge",positions:null,initialize:function(){this.positions={from:null,to:null},this.model.source&&this.model.source.parentNode.on("change:x change:y change:w",this.render,this),this.model.target&&this.model.target.parentNode.on("change:x change:y",this.render,this),this.model.source&&this.model.source.view&&(this.model.source.view.plugSetActive(),this.model.source.view.bringToTop(this.model)),this.model.target&&this.model.target.view&&(this.model.target.view.plugSetActive(),this.model.target.view.bringToTop(this.model)),this.el=c("g",{"class":"dataflow-edge"}),this.elEdge=c("path",{"class":"dataflow-edge-wire"}),this.elShadow=c("path",{"class":"dataflow-edge-shadow"}),void 0!==this.model.get("route")&&this.elEdge.setAttribute("class","dataflow-edge-wire route"+this.model.get("route"));var a=this;this.model.on("change:route",function(){a.elEdge.setAttribute("class","dataflow-edge-wire route"+a.model.get("route")),a.bringToTop()}),this.el.appendChild(this.elShadow),this.el.appendChild(this.elEdge),this.el.addEventListener("click",function(b){a.click(b)}),this.listenTo(this.model,"change:selected",this.selectedChange),this.listenTo(this.model,"remove",this.hideInspector)},render:function(a){var b,c=this.model.source,d=this.model.target;c?this.positions.from=c.view.holePosition():(b=this.model.parentGraph.dataflow.$el.parent().position(),graph=this.model.parentGraph.view.$el,this.positions.from={left:graph.scrollLeft()+a.left-5-b.left,top:graph.scrollTop()+a.top+5-b.top}),d?this.positions.to=d.view.holePosition():(b=this.model.parentGraph.dataflow.$el.parent().position(),graph=this.model.parentGraph.view.$el,this.positions.to={left:graph.scrollLeft()+a.left+15-b.left,top:graph.scrollTop()+a.top+5-b.top});var e=this.edgePath(this.positions);this.elEdge.setAttribute("d",e),this.elShadow.setAttribute("d",e),this.model.parentGraph&&this.model.parentGraph.view&&this.model.parentGraph.view.sizeSVG()},fade:function(){this.model.source.parentNode.get("selected")||this.model.target.parentNode.get("selected")||d(this.el,"fade")},unfade:function(){e(this.el,"fade")},selectedChange:function(){this.model.get("selected")?(this.highlight(),this.showInspector()):(this.unhighlight(),this.hideInspector()),this.model.parentGraph.trigger("selectionChanged")},highlight:function(){d(this.el,"highlight")},unhighlight:function(){e(this.el,"highlight")},edgePath:function(a){var b=20,c=a.to.left-b-(a.from.left+b),d=Math.floor(c/2),e=c-d,f=a.to.top-a.from.top,g=Math.floor(f/2),h=f-g,i="",j="";return Math.abs(f)>Math.abs(c)?f>0?c>0?(i=" L "+(a.from.left+b+d)+" "+(a.from.top+d),j=" L "+(a.to.left-b-e)+" "+(a.to.top-e)):0>c&&(i=" L "+(a.from.left+b+d)+" "+(a.from.top-d),j=" L "+(a.to.left-b-e)+" "+(a.to.top+e)):0>f&&(c>0?(i=" L "+(a.from.left+b+d)+" "+(a.from.top-d),j=" L "+(a.to.left-b-e)+" "+(a.to.top+e)):0>c&&(i=" L "+(a.from.left+b+d)+" "+(a.from.top+d),j=" L "+(a.to.left-b-e)+" "+(a.to.top-e))):Math.abs(f)0?f>0?(i=" L "+(a.from.left+b+g)+" "+(a.from.top+g),j=" L "+(a.to.left-b-h)+" "+(a.to.top-h)):0>f&&(i=" L "+(a.from.left+b-g)+" "+(a.from.top+g),j=" L "+(a.to.left-b+h)+" "+(a.to.top-h)):0>c&&(f>0?(i=" L "+(a.from.left+b-g)+" "+(a.from.top+g),j=" L "+(a.to.left-b+h)+" "+(a.to.top-h)):0>f&&(i=" L "+(a.from.left+b+g)+" "+(a.from.top+g),j=" L "+(a.to.left-b-h)+" "+(a.to.top-h)))),"M "+a.from.left+" "+a.from.top+" L "+(a.from.left+b)+" "+a.from.top+i+j+" L "+(a.to.left-b)+" "+a.to.top+" L "+a.to.left+" "+a.to.top},remove:function(){var a=this.model.source,b=this.model.target;a&&a.parentNode.off(null,null,this),b&&b.parentNode.off(null,null,this),a&&a.view.plugCheckActive(),b&&b.view.plugCheckActive(),this.el.parentNode.removeChild(this.el)},click:function(a){a&&a.stopPropagation();var b;a&&(a.ctrlKey||a.metaKey)?(b=this.model.get("selected"),b=!b):(b=!0,this.model.parentGraph.nodes.invoke("set",{selected:!1}),this.model.collection.invoke("set",{selected:!1})),this.model.set({selected:b}),b&&(this.bringToTop(),this.model.trigger("select"),this.unfade()),this.model.parentGraph.view.fade()},bringToTop:function(){this.model.bringToTop();var a=this.el.parentNode;a&&a.appendChild(this.el),this.model.source.view.bringToTop(this.model),this.model.target.view.bringToTop(this.model)},inspector:null,getInspector:function(){if(!this.inspector){var c=new b.InspectView({model:this.model}),d=a.prototype.module("card");this.inspector=new d.Model({dataflow:this.model.parentGraph.dataflow,card:c})}return this.inspector},showInspector:function(a){this.model.parentGraph.dataflow.addCard(this.getInspector(),a)},hideInspector:function(){this.model.parentGraph.dataflow.removeCard(this.getInspector())}})}(Dataflow),function(a){var b=a.prototype.module("card");b.Model=Backbone.Model.extend({defaults:{pinned:!1},initialize:function(){this.dataflow=this.get("dataflow")},hide:function(){this.dataflow.shownCards.remove(this)}}),b.Collection=Backbone.Collection.extend({model:b.Model})}(Dataflow),function(a){var b=a.prototype.module("card"),c='
        ';b.View=Backbone.View.extend({tagName:"div",className:"dataflow-card",template:_.template(c),events:{"click .dataflow-card-pin":"togglePin","click .dataflow-card-close":"hide"},initialize:function(){this.$el.html(this.template()),this.card=this.model.get("card"),this.$el.append(this.card.el),this.listenTo(this.model,"change:pinned",this.pinnedChanged),this.pinnedChanged()},animate:function(a){"function"==typeof this.card.animate&&this.card.animate(a)},togglePin:function(){var a=!this.model.get("pinned");this.model.set("pinned",a),a||this.hide()},pinnedChanged:function(){this.model.get("pinned")?this.$(".dataflow-card-pin").addClass("active"):this.$(".dataflow-card-pin").removeClass("active")},hide:function(){this.model.hide()},remove:function(){this.$el.detach()}}),window.requestAnimationFrame||(window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,50)}}()),b.CollectionView=Backbone.CollectionView.extend({tagName:"div",className:"dataflow-cards",itemView:b.View,prepend:!0,initialize:function(){Backbone.CollectionView.prototype.initialize.apply(this,arguments);var a=function(b){window.requestAnimationFrame(a),this.collection.each(function(a){a.view&&a.view.animate(b)})}.bind(this);a()},bringToTop:function(a){this.$el.prepend(a.view.el)}})}(Dataflow),function(a){var b=Backbone.Model.extend({defaults:{label:"",icon:"",action:null}}),c=Backbone.Collection.extend({model:b}),d=a.prototype.module("card"),e=a.prototype.module("menucard");e.Model=d.Model.extend({initialize:function(){this.menu=new c,d.Model.prototype.initialize.call(this)}})}(Dataflow),function(a){var b=a.prototype.module("card"),c=a.prototype.module("menucard"),d=Backbone.View.extend({tagName:"li",template:'',events:{click:"clicked"},render:function(){this.$el.html(_.template(this.template,this.model.toJSON()))},clicked:function(){this.model.get("action")&&this.model.get("action")()}});c.View=b.View.extend({initialize:function(){this.model.set("card",new Backbone.CollectionView({tagName:"ul",className:"dataflow-menu",collection:this.model.menu,itemView:d})),b.View.prototype.initialize.call(this)}})}(Dataflow),function(a){var b=a.prototype.module("node"),c='

        <%- label %>

        <%- type %>

        ',d=function(a,b,c){a[0].contentEditable=!0;var d=a.text(),e=function(){b.set(c,a.text())},f=function(){a.text(d)};a.focus(function(){d=a.text()}).blur(function(){e()}).keydown(function(b){27===b.which?(f(),a.blur()):13===b.which&&a.blur()})};b.InspectView=Backbone.View.extend({template:_.template(c),className:"dataflow-node-inspector",events:{},initialize:function(){this.$el.html(this.template(this.model.toJSON()));var a=this.$el.children(".dataflow-node-inspector-inputs");this.model.inputs.each(function(b){b.view&&b.view.$input&&a.append(b.view.$input)},this),d(this.$(".dataflow-node-inspector-label"),this.model,"label")},render:function(){return this},removeModel:function(){this.model.remove()}})}(Dataflow),function(a){var b=a.prototype.module("edge"),c='

        Edge

        <%= id %>

          ';b.InspectView=Backbone.View.extend({tagName:"div",className:"dataflow-edge-inspector",positions:null,template:_.template(c),initialize:function(){var a=this.model.toJSON();this.model.id&&(a.id=this.model.id.replace("->","→")),this.$el.html(this.template(a));var b=this.$el.children(".dataflow-edge-inspector-route-choose");this.$log=this.$el.children(".dataflow-edge-inspector-events");for(var c=function(a){var b=$(a.target).data("route");this.model.set("route",b)}.bind(this),d=0;12>d;d++){var e=$("



          ');h.children(".selectall").click(c),b.selectAll=c,b.removeSelected=function(){var b=a.currentGraph.nodes.where({selected:!0});_.each(b,function(a){a.remove()})},h.children(".cut").click(d),b.cut=d,b.removeEdge=e;var i={};h.children(".copy").click(f),b.copy=f,h.children(".paste").click(g),b.paste=g,a.addContext({id:"cut",icon:"cut",label:"cut",action:d,contexts:["node","nodes"]}),a.addContext({id:"copy",icon:"copy",label:"copy",action:f,contexts:["node","nodes"]}),a.addContext({id:"paste",icon:"paste",label:"paste",action:g,contexts:["node","nodes"]}),a.addContext({id:"edgeRemove",icon:"remove",label:"remove edge",action:e,contexts:["edge"]}),a.addContext({id:"edgeRemove",icon:"remove",label:"remove edges",action:e,contexts:["edges"]}),b.onSearch=function(b,c){if(a.currentGraph){var d=[];a.currentGraph.nodes.each(function(a){-1!==a.get("label").toLowerCase().indexOf(b.toLowerCase())&&d.push({source:"edit",icon:"sign-blank",label:a.get("label"),description:a.type,action:function(){a.view.select()}})}),c(d)}}}}(Dataflow),function(a){var b=a.prototype.plugin("elements");b.list=[{type:"div",attributes:["id","class","style"],events:["pointermove","pointerover","pointerout"]},{type:"button",attributes:["id","class","style"],events:["pointerdown","pointerup"]}]}(Dataflow),function(a){var b=a.prototype.plugin("library");b.initialize=function(a){var c=$('
          '),d=$('
            ');c.append(d),b.excluded=["base","base-resizable"];var e=function(b,c,d){return function(){a.currentGraph.view.$(".dataflow-node").removeClass("ui-selected"),zoom=a.currentGraph.get("zoom");for(var e=1;a.currentGraph.nodes.get(e);)e++;c=void 0===c?200:c,d=void 0===d?200:d,c=c/zoom-a.currentGraph.get("panX"),d=d/zoom-a.currentGraph.get("panY");var f=new b.Model({id:e,x:c,y:d,parentGraph:a.currentGraph});a.currentGraph.nodes.add(f),f.view.select()}},f='
          • <%- name %><%-description %>
          • ',g=function(b,c){var g=$(_.template(f,{name:b,description:c.description}));$(".button",g).attr("title","click or drag").draggable({helper:function(){var c=$('
            '+b+"
            ");return a.$el.append(c),c},stop:function(a,b){e(c,b.position.left,b.position.top).call()}}).click(e(c)),d.append(g)},h=function(c){c=c?c:{},b.excluded=c.exclude?c.exclude:b.excluded,d.empty();var e=_.sortBy(Object.keys(a.nodes),function(a){return a});_.each(e,function(c){-1===b.excluded.indexOf(c)&&g(c,a.nodes[c])})};h(),a.addPlugin({id:"library",label:"library",name:"",menu:c,icon:"plus",pinned:!1}),b.update=h,b.onSearch=function(c,d){var f=[];_.each(a.nodes,function(a,d){-1===b.excluded.indexOf(d)&&-1!==d.toLowerCase().indexOf(c.toLowerCase())&&f.push({source:"library",icon:"plus",action:function(){e(a).call()},label:d,description:a.description})}),d(f)}}}(Dataflow),function(a){var b=a.prototype.plugin("source");b.updateAllowed=!0,b.initialize=function(a){var c=$('

            '),d=c.find(".code");a.addPlugin({id:"source",label:"view source",name:"",menu:c,icon:"code",pinned:!0}),b.show=function(a){var b=d.prop("scrollTop");d.val(a),d.scrollTop(b)};var e=function(){a.graph&&b.show(JSON.stringify(a.graph.toJSON(),null," "))};b.listeners=function(b){b?a.on("change",e):a.off("change",e)},b.listeners(!0),b.allowUpdate=function(a){var e=c.find(".apply");return a?(b.updateAllowed=!0,e.show(),d.removeAttr("readonly"),void 0):(b.updateAllowed=!1,e.hide(),d.attr("readonly","readonly"),void 0)},c.submit(function(){return b.updateGraph(d,a),!1})},b.updateGraph=function(a,c){if(b.updateAllowed){var d;try{d=JSON.parse(a.val())}catch(e){return c.log("Invalid JSON"),!1}if(d){var f=c.loadGraph(d);f.trigger("change")}}}}(Dataflow),function(a){var b=a.prototype.plugin("log");b.initialize=function(a){function c(a){a=_.escape(a),d.children(".loglist").append("
          • "+a+"
          • "),d.scrollTop(d.prop("scrollHeight"))}var d=$('
              ');a.addPlugin({id:"log",label:"log",name:"",menu:d,icon:"th-list",pinned:!0}),b.add=c;var e=function(a){c("log: "+a)},f=function(a,b){c("node added: "+b.toString())},g=function(a,b){c("node removed: "+b.toString())},h=function(a,b){c("edge added: "+b.toString())},i=function(a,b){c("edge removed: "+b.toString())};b.listeners=function(b){b?(a.on("log",e),a.on("node:add",f),a.on("node:remove",g),a.on("edge:add",h),a.on("edge:remove",i)):(a.off("log",e),a.off("node:add",f),a.off("node:remove",g),a.off("edge:add",h),a.off("edge:remove",i))},b.listeners(!0)}}(Dataflow),function(a){var b=a.prototype.plugin("inspector");b.initialize=function(a){function b(){var b=a.currentGraph.nodes.where({selected:!0});b.forEach(function(b){var c=b.view.getInspector();c.set("pinned",!0),a.addCard(c)});var c=a.currentGraph.edges.where({selected:!0});c.forEach(function(b){var c=b.view.getInspector();c.set("pinned",!0),a.addCard(c)})}a.addContext({id:"inspector",icon:"info-sign",label:"inspect",action:b,contexts:["one","twoplus"]})}}(Dataflow),function(a){var b=a.prototype.plugin("keybinding"),c=a.prototype.plugin("edit");b.initialize=function(a){function d(){a&&a.currentGraph&&a.currentGraph.view&&a.currentGraph.view.zoomIn()}function e(){a&&a.currentGraph&&a.currentGraph.view&&a.currentGraph.view.zoomOut()}function f(){a&&a.currentGraph&&a.currentGraph.view&&a.currentGraph.view.zoomCenter()}function g(a){if("TEXTAREA"!==a.target.tagName&&"INPUT"!==a.target.tagName&&"true"!==a.target.contentEditable&&(a.ctrlKey||a.metaKey))switch(a.which){case 189:a.preventDefault(),d();break;case 187:a.preventDefault(),e();break;case 48:a.preventDefault(),f();break;case 65:c.selectAll();break;case 88:c.cut();break;case 67:c.copy();break;case 86:c.paste();break;case 90:}}b.listeners=function(a){a?$(document).on("keydown",g):$(document).off("keydown",g)},b.listeners(!0)}}(Dataflow),function(a){var b=a.prototype.plugin("notification"),c=window.webkitNotifications?!0:!1;b.requestPermission=function(){c&&(b.hasPermission()||window.webkitNotifications.requestPermission())},b.hasPermission=function(){return c?0!==window.webkitNotifications.checkPermission()?!1:!0:!1},b.notify=function(a,c,d){if(!b.hasPermission()){if(!console||!console.log)return;return console.log(c+": "+d),void 0}var e=window.webkitNotifications.createNotification(a,c,d);e.show()}}(Dataflow),function(a){var b=a.prototype.plugin("search"),c=Backbone.Model.extend({defaults:{source:"",icon:"",action:null,label:"",description:""}}),d=Backbone.Collection.extend({model:c,initialize:function(a,b){b||(b={}),this.search=b.search}}),e=Backbone.View.extend({tagName:"li",template:'<%- label %><%- description %>',events:{click:"clicked"},render:function(){this.$el.html(_.template(this.template,this.model.toJSON()))},clicked:function(){this.model.get("action")&&this.model.get("action")()}});b.initialize=function(a){var c=$(''),d=c.find("input"),e=c.find("button");a.$el.prepend(c),d.on("keyup search webkitspeechchange",function(){return d.val()?(b.search(d.val(),a),void 0):(a.removeCard("searchresults"),void 0)}),e.on("click",function(){a.showPlugin("menu")})},b.search=function(c,f){var g=a.prototype.module("card"),h=new d([],{search:c}),i=new Backbone.CollectionView({tagName:"ul",className:"dataflow-plugin-search-results",collection:h});i.itemView=e;var j=new g.Model({id:"searchresults",dataflow:f,card:i,pinned:!1});h.on("add",function(){f.addCard(j)}),b.results=h,_.each(f.plugins,function(a){a.onSearch&&b.searchPlugin(h,c,a)})},b.searchPlugin=function(a,c,d){d.onSearch(c,function(d){c===b.results.search&&d.forEach(function(b){a.add(b)})})}}(Dataflow),function(a){var b=a.prototype.module("node"),c=a.prototype.node("base");c.Model=b.Model.extend({defaults:function(){var a=b.Model.prototype.defaults.call(this);return a.type="base",a},initialize:function(){b.Model.prototype.initialize.call(this)},unload:function(){},inputs:[],outputs:[]}),c.View=b.View.extend({})}(Dataflow),function(a){var b=a.prototype.node("base"),c=a.prototype.node("base-resizable");c.Model=b.Model.extend({defaults:function(){var a=b.Model.prototype.defaults.call(this);return a.type="base-resizable",a.w=200,a.h=200,a},initialize:function(){b.Model.prototype.initialize.call(this)},unload:function(){},toJSON:function(){var a=b.Model.prototype.toJSON.call(this);return a.w=this.get("w"),a.h=this.get("h"),a},inputs:[],outputs:[]}),c.View=b.View.extend({initialize:function(a){b.View.prototype.initialize.call(this,a),this.$el.css({width:this.model.get("w"),height:this.model.get("h")});var c=this;this.$el.resizable({helper:"dataflow-node helper",minHeight:100,minWidth:120,stop:function(a,b){c.resizeStop(a,b)}})},resizeStop:function(a,b){this.model.set({w:b.size.width,h:b.size.height})}})}(Dataflow),function(a){var b=a.prototype.node("base-resizable"),c=a.prototype.node("dataflow-subgraph"),d=a.prototype.module("graph"),e=a.prototype.module("input"),f=a.prototype.module("output");c.Model=b.Model.extend({defaults:function(){var a=b.Model.prototype.defaults.call(this);return a.label="subgraph",a.type="dataflow-subgraph",a.graph={nodes:[{id:"1",label:"in",type:"dataflow-input",x:180,y:15},{id:"99",label:"out",type:"dataflow-output",x:975,y:500}]},a},initialize:function(){b.Model.prototype.initialize.call(this);var a=this.get("graph");a.parentNode=this,a.dataflow=this.parentGraph.dataflow,this.graph=new d.Model(a);var c=this.graph.nodes.filter(function(a){return"dataflow-input"===a.type});_.each(c,this.addInput,this);var e=this.graph.nodes.filter(function(a){return"dataflow-output"===a.type});_.each(e,this.addOutput,this),this.graph.nodes.on("add",function(a){"dataflow-input"===a.type?this.addInput(a):"dataflow-output"===a.type&&this.addOutput(a)},this),this.graph.nodes.on("remove",function(a){"dataflow-input"===a.type?this.removeInput(a):"dataflow-output"===a.type&&this.removeOutput(a)},this)},addInput:function(a){var b=new e.Model({id:a.id,label:a.get("label"),type:a.get("input-type"),parentNode:this,inputNode:a});this.inputs.add(b)},recieve:function(a,b){var c=this.inputs.get(a).get("inputNode");c&&c.send("data",b)},addOutput:function(a){var b=new f.Model({id:a.id,label:a.get("label"),type:a.get("output-type"),parentNode:this,outputNode:a});this.outputs.add(b),a.set("parentNode",this)},removeInput:function(a){var b=this.inputs.get(a.id);b.remove(),this.inputs.remove(b)},removeOutput:function(a){var b=this.outputs.get(a.id);b.remove(),this.outputs.remove(b)},toJSON:function(){var a=b.Model.prototype.toJSON.call(this);return a.graph=this.graph,a},remove:function(){b.Model.prototype.remove.call(this),this.graph.remove()},inputs:[],outputs:[]});var g='';c.View=b.View.extend({events:function(){var a=b.View.prototype.events.call(this);return a["click .show-subgraph"]="showSubgraph",a},innerTemplate:_.template(g),initialize:function(a){b.View.prototype.initialize.call(this,a),this.model.graph.view=new d.View({model:this.model.graph}),this.model.inputs.each(this.addInput,this),this.model.inputs.on("add",this.addInput,this),this.model.outputs.each(this.addOutput,this),this.model.outputs.on("add",this.addOutput,this)},addInput:function(a){a.get("inputNode")&&a.get("inputNode").on("change:label",function(b){a.view.$(".label").text(b.get("label"))},this)},addOutput:function(a){a.get("outputNode")&&a.get("outputNode").on("change:label",function(b){a.view.$(".label").text(b.get("label"))},this)},showSubgraph:function(){this.model.graph.dataflow.showGraph(this.model.graph)}})}(Dataflow); //# sourceMappingURL=dataflow.min.js.map \ No newline at end of file diff --git a/build/dataflow.min.js.map b/build/dataflow.min.js.map index 5a0a865..16b7e14 100644 --- a/build/dataflow.min.js.map +++ b/build/dataflow.min.js.map @@ -1 +1 @@ -{"version":3,"file":"build/dataflow.min.js","sources":["build/dataflow.build.js"],"names":["CircularBuffer","n","this","_array","Array","length","prototype","toString","get","i","undefined","set","v","IndexError","push","App","Backbone","Model","extend","$","query","$el","find","initialize","el","document","createElement","className","data","Card","Dataflow","module","shownCards","Collection","view","CollectionView","collection","append","debug","controls","name","plugins","inputs","editable","appendTo","css","margin","padding","width","height","id","attr","loadState","modules","nodes","node","description","plugin","addCard","card","leaveUnpinned","hideCards","bringToTop","add","removeCard","remove","unpinned","where","pinned","addPlugin","info","enabled","menu","dataflow","icon","label","showLabel","showPlugin","onShow","enablePlugin","disablePlugin","showContextBar","contextBar","show","hideContextBar","hide","contexts","prepareContext","ctx","MenuCard","View","model","addContext","_","each","context","changeContext","selectedNodes","selectedEdges","bind","loadGraph","source","graph","currentGraph","Graph","newGraph","render","showGraph","detach","log","message","trigger","arguments","console","types","window","exports","addEvents","events","delegateEvents","clone","prepend","options","tagName","itemView","parent","addItem","on","removeItem","item","StateModel","stateKey","cid","stateData","JSON","parse","localStorage","getItem","state","stateInstance","setItem","stringify","toJSON","Node","Edge","defaults","edges","panX","panY","zoom","parentGraph","nodesArray","type","edge","edgesArray","port","target","sourceNode","targetNode","outputs","selectionChanged","selectNode","selectEdge","selected","at","Input","Output","x","y","inputArray","parentNode","input","value","outputArray","output","changeSelected","setState","setBang","send","self","defer","recieve","unload","comparator","connected","connect","uniq","disconnect","without","z","route","preview","attributes","e","select","isConnectedToPort","isConnectedToNode","topZ","thisZ","unhighlight","off","minZoom","maxZoom","style","hasOwnProperty","template","click .dataflow-graph","dragstart .dataflow-graph-panzoom","drag .dataflow-graph-panzoom","dragstop .dataflow-graph-panzoom","click .dataflow-graph-gotoparent","mousewheel","html","addNode","removeNode","addEdge","removeEdge","draggable","helper","h","$graphEl","graphEl","transform","transformOrigin","bindInteraction","panStartOffset","panStart","event","ui","offset","pan","scale","deltaX","left","deltaY","top","panStop","tempPanX","tempPanY","setPanDebounce","debounce","mouseWheel","preventDefault","oe","originalEvent","wheelDeltaX","wheelDeltaY","gotoParent","bindZoom","bindScroll","Hammer","currentZoom","startX","startY","originX","originY","distance_to_origin_x","distance_to_origin_y","gesture","center","pageX","pageY","graphOffset","Math","max","min","onZoom","lastClass","zoomClass","removeClass","addClass","zoomIn","zoomOut","zoomCenter","rerenderEdges","CustomType","BaseNode","appendChild","edgeView","sizeSVG","svg","rect","getBBox","round","setAttribute","error","deselect","invoke","unfade","fade","fadeEdges","innerTemplate","click .dataflow-node-header","dragstart","drag","dragstop","handle","listenTo","bumpPosition","selectedChanged","changeLabel","hideInspector","$inner","_alsoDrag","_dragDelta","$dragHelpers","dragStart","stopPropagation","parseInt","text","position","originalPosition","dragStop","moveToPosition","empty","silent","removeModel","zIndex","toggle","ctrlKey","metaKey","inspector","getInspector","inspect","InspectView","showInspector","highlight","click","drop","dragstart .dataflow-port-hole","drag .dataflow-port-hole","dragstop .dataflow-port-hole","dragstart .dataflow-port-plug","drag .dataflow-port-plug","dragstop .dataflow-port-plug","$input","_holePosition","nodeState","cursor","disabled","distance","delay","droppable","accept","activeClassType","refreshPositions","isString","split","isArray","o","val","renderInput","setInputValue","option","change","inputSelect","step","inputInt","inputFloat","inputBoolean","inputObject","inputBang","inputString","selectVal","prop","parseFloat","obj","err","newEdgeStart","topRoute","previewEdgeNew","previewEdgeNewView","graphSVGElement","newEdgeDrag","clientY","clientX","df","scrollLeft","scrollTop","newEdgeStop","getTopEdge","topEdge","isConnected","changeEdgeStart","changeEdge","previewEdgeChange","previewEdgeChangeView","changeEdgeDrag","changeEdgeStop","connectEdge","otherPort","oldLength","holePosition","index","plugSetActive","plugCheckActive","topEdgeZ","previewEdge","previewEdgeView","makeSvgElement","tag","attrs","createElementNS","k","setAttributeNS","classList","positions","from","to","class","elEdge","elShadow","addEventListener","selectedChange","previewPosition","dataflowParent","pathD","edgePath","halfX","floor","halfX2","halfY","halfY2","control1","control2","abs","removeChild","click .dataflow-card-pin","click .dataflow-card-close","pinnedChanged","animate","timestamp","togglePin","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","callback","setTimeout","apply","loop","MenuItem","action","Menu","call","MenuItemView","clicked","makeEditable","attribute","contentEditable","initial","revert","focus","blur","keydown","which","$inputs","children","templateData","replace","$choose","$log","changeRoute","button","showLogs","lastLog","logs","renderLogs","firstToShow","li","group","first","scrollHeight","Edit","selectAll","cut","copy","copied","removeSelected","forEach","connectedSource","any","connectedTarget","paste","oldId","newNode","newEdge","buttons","toRemove","onSearch","results","toLowerCase","indexOf","Elements","list","Library","$container","$library","excluded","itemTemplate","addLibraryItem","$item","stop","update","exclude","sortedLibrary","sortBy","Object","keys","Source","updateAllowed","$form","$code","scrollBackTop","listeners","boo","allowUpdate","allowed","$button","removeAttr","submit","updateGraph","g","Log","escape","logged","nodeAdded","nodeRemoved","edgeAdded","edgeRemoved","Inspector","KeyBinding","keyDown","Notification","webNotifications","webkitNotifications","requestPermission","hasPermission","checkPermission","notify","title","notification","createNotification","Search","SearchResult","SearchResults","models","search","ResultView","$search","ResultsView","ResultsCard","searchPlugin","pluginResults","result","Base","BaseResizable","w","json","resizable","minHeight","minWidth","resizeStop","size","DataflowSubgraph","filter","addInput","addOutput","removeInput","removeOutput","newInput","inputNode","newOutput","outputNode","showSubgraph"],"mappings":"AASA,QAASA,gBAAeC,GACtBC,KAAKC,OAAQ,GAAIC,OAAMH,GACvBC,KAAKG,OAAQ,EAEfL,eAAeM,UAAUC,SAAU,WACjC,MAAO,0BAA0BL,KAAKC,OAAOE,OAAO,YAAYH,KAAKG,OAAO,KAE9EL,eAAeM,UAAUE,IAAK,SAASC,GACrC,MAAM,GAAFA,GAAOA,EAAEP,KAAKG,OAAOH,KAAKC,OAAOE,OAC5BK,OACFR,KAAKC,OAAOM,EAAEP,KAAKC,OAAOE,SAEnCL,eAAeM,UAAUK,IAAM,SAASF,EAAGG,GACzC,GAAM,EAAFH,GAAOA,EAAEP,KAAKG,OAAOH,KAAKC,OAAOE,OACnC,KAAML,gBAAea,UACvB,MAAOJ,EAAEP,KAAKG,QACZH,KAAKC,OAAOD,KAAKG,OAAOH,KAAKC,OAAOE,QAAUK,OAC9CR,KAAKG,QAEPH,MAAKC,OAAOM,EAAEP,KAAKC,OAAOE,QAAUO,EAChCH,GAAGP,KAAKG,QACVH,KAAKG,UAETL,eAAeM,UAAUQ,KAAO,SAASF,GACvCV,KAAKC,OAAOD,KAAKG,OAAOH,KAAKC,OAAOE,QAAUO,EAC9CV,KAAKG,UAEPL,eAAea,cAEd,WACC,GAAIE,GAAMC,SAASC,MAAMC,QACv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GAAG,MAAO7H,KAAKqjB,SAAUrjB,MAC3CA,KAAKyF,MAAMoE,QAAQjE,KAAK5F,KAAKsjB,UAAWtjB,MACxCA,KAAKyF,MAAMoE,QAAQhC,GAAG,MAAO7H,KAAKsjB,UAAWtjB,OAE/CqjB,SAAU,SAAS5Y,GAEZA,EAAMnK,IAAI,cAGfmK,EAAMnK,IAAI,aAAauH,GAAG,eAAgB,SAAStH,GACjDkK,EAAMzI,KAAKf,EAAE,UAAUkS,KAAK5S,EAAED,IAAI,WACjCN,OAELsjB,UAAW,SAAS1Y,GAEbA,EAAOtK,IAAI,eAGhBsK,EAAOtK,IAAI,cAAcuH,GAAG,eAAgB,SAAS8N,GACnD/K,EAAO5I,KAAKf,EAAE,UAAUkS,KAAKwC,EAAErV,IAAI,WAClCN,OAEL6jB,aAAc,WACZ7jB,KAAKyF,MAAMW,MAAM7B,SAASkC,UAAUzG,KAAKyF,MAAMW,WAInDxE"} \ No newline at end of file +{"version":3,"file":"build/dataflow.min.js","sources":["build/dataflow.build.js"],"names":["CircularBuffer","n","this","_array","Array","length","prototype","toString","get","i","undefined","set","v","IndexError","push","App","Backbone","Model","extend","$","query","$el","find","initialize","el","document","createElement","className","data","Card","Dataflow","module","shownCards","Collection","view","CollectionView","collection","append","debug","controls","name","plugins","inputs","editable","appendTo","css","margin","padding","width","height","id","attr","loadState","modules","nodes","node","description","plugin","addCard","card","leaveUnpinned","hideCards","bringToTop","add","removeCard","remove","unpinned","where","pinned","addPlugin","info","enabled","menu","dataflow","icon","label","showLabel","showPlugin","onShow","enablePlugin","disablePlugin","showContextBar","contextBar","show","hideContextBar","hide","contexts","prepareContext","ctx","MenuCard","View","model","addContext","_","each","context","changeContext","selectedNodes","selectedEdges","bind","loadGraph","source","graph","currentGraph","Graph","newGraph","render","showGraph","detach","log","message","trigger","arguments","console","types","window","exports","addEvents","events","delegateEvents","clone","prepend","options","tagName","itemView","parent","addItem","on","removeItem","item","StateModel","stateKey","cid","stateData","JSON","parse","localStorage","getItem","state","stateInstance","setItem","stringify","toJSON","Node","Edge","defaults","edges","panX","panY","zoom","parentGraph","nodesArray","type","edge","edgesArray","port","target","sourceNode","targetNode","outputs","selectionChanged","selectNode","selectEdge","selected","at","Input","Output","x","y","inputArray","parentNode","input","value","outputArray","output","changeSelected","setState","setBang","send","self","defer","recieve","unload","comparator","multiple","connected","canConnect","connect","uniq","disconnect","without","z","route","preview","attributes","e","select","isConnectedToPort","isConnectedToNode","topZ","thisZ","unhighlight","off","minZoom","maxZoom","style","hasOwnProperty","template","click .dataflow-graph","dragstart .dataflow-graph-panzoom","drag .dataflow-graph-panzoom","dragstop .dataflow-graph-panzoom","click .dataflow-graph-gotoparent","mousewheel","html","addNode","removeNode","addEdge","removeEdge","draggable","helper","h","$graphEl","graphEl","transform","transformOrigin","bindInteraction","panStartOffset","panStart","event","ui","offset","pan","scale","deltaX","left","deltaY","top","panStop","tempPanX","tempPanY","setPanDebounce","debounce","mouseWheel","preventDefault","oe","originalEvent","wheelDeltaX","wheelDeltaY","gotoParent","bindZoom","bindScroll","Hammer","currentZoom","startX","startY","originX","originY","distance_to_origin_x","distance_to_origin_y","gesture","center","pageX","pageY","graphOffset","Math","max","min","onZoom","lastClass","zoomClass","removeClass","addClass","zoomIn","zoomOut","zoomCenter","rerenderEdges","CustomType","BaseNode","appendChild","edgeView","sizeSVG","svg","rect","getBBox","round","setAttribute","error","deselect","invoke","unfade","fade","fadeEdges","innerTemplate","click .dataflow-node-header","dragstart","drag","dragstop","handle","listenTo","bumpPosition","selectedChanged","changeLabel","hideInspector","$inner","_alsoDrag","_dragDelta","$dragHelpers","dragStart","stopPropagation","parseInt","text","position","originalPosition","dragStop","moveToPosition","empty","silent","removeModel","zIndex","toggle","ctrlKey","metaKey","inspector","getInspector","inspect","InspectView","showInspector","highlight","click","drop","dragstart .dataflow-port-hole","drag .dataflow-port-hole","dragstop .dataflow-port-hole","dragstart .dataflow-port-plug","drag .dataflow-port-plug","dragstop .dataflow-port-plug","$input","_holePosition","nodeState","cursor","disabled","distance","delay","droppable","accept","activeClassType","refreshPositions","isString","split","isArray","o","val","renderInput","setInputValue","option","change","inputSelect","step","inputInt","inputFloat","inputBoolean","inputObject","inputBang","inputString","selectVal","prop","parseFloat","obj","err","newEdgeStart","topRoute","previewEdgeNew","previewEdgeNewView","graphSVGElement","newEdgeDrag","clientY","clientX","df","scrollLeft","scrollTop","newEdgeStop","getTopEdge","topEdge","isConnected","changeEdgeStart","changeEdge","previewEdgeChange","previewEdgeChangeView","changeEdgeDrag","changeEdgeStop","connectEdge","otherPort","oldLength","holePosition","index","plugSetActive","plugCheckActive","topEdgeZ","previewEdge","previewEdgeView","makeSvgElement","tag","attrs","createElementNS","k","setAttributeNS","classList","positions","from","to","class","elEdge","elShadow","addEventListener","selectedChange","previewPosition","dataflowParent","pathD","edgePath","halfX","floor","halfX2","halfY","halfY2","control1","control2","abs","removeChild","click .dataflow-card-pin","click .dataflow-card-close","pinnedChanged","animate","timestamp","togglePin","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","callback","setTimeout","apply","loop","MenuItem","action","Menu","call","MenuItemView","clicked","makeEditable","attribute","contentEditable","initial","revert","focus","blur","keydown","which","$inputs","children","templateData","replace","$choose","$log","changeRoute","button","showLogs","lastLog","logs","renderLogs","firstToShow","li","group","first","scrollHeight","Edit","selectAll","cut","copy","copied","removeSelected","forEach","connectedSource","any","connectedTarget","paste","oldId","newNode","newEdge","buttons","toRemove","onSearch","results","toLowerCase","indexOf","Elements","list","Library","$container","$library","excluded","itemTemplate","addLibraryItem","$item","stop","update","exclude","sortedLibrary","sortBy","Object","keys","Source","updateAllowed","$form","$code","scrollBackTop","listeners","boo","allowUpdate","allowed","$button","removeAttr","submit","updateGraph","g","Log","escape","logged","nodeAdded","nodeRemoved","edgeAdded","edgeRemoved","Inspector","KeyBinding","keyDown","Notification","webNotifications","webkitNotifications","requestPermission","hasPermission","checkPermission","notify","title","notification","createNotification","Search","SearchResult","SearchResults","models","search","ResultView","$search","ResultsView","ResultsCard","searchPlugin","pluginResults","result","Base","BaseResizable","w","json","resizable","minHeight","minWidth","resizeStop","size","DataflowSubgraph","filter","addInput","addOutput","removeInput","removeOutput","newInput","inputNode","newOutput","outputNode","showSubgraph"],"mappings":"AASA,QAASA,gBAAeC,GACtBC,KAAKC,OAAQ,GAAIC,OAAMH,GACvBC,KAAKG,OAAQ,EAEfL,eAAeM,UAAUC,SAAU,WACjC,MAAO,0BAA0BL,KAAKC,OAAOE,OAAO,YAAYH,KAAKG,OAAO,KAE9EL,eAAeM,UAAUE,IAAK,SAASC,GACrC,MAAM,GAAFA,GAAOA,EAAEP,KAAKG,OAAOH,KAAKC,OAAOE,OAC5BK,OACFR,KAAKC,OAAOM,EAAEP,KAAKC,OAAOE,SAEnCL,eAAeM,UAAUK,IAAM,SAASF,EAAGG,GACzC,GAAM,EAAFH,GAAOA,EAAEP,KAAKG,OAAOH,KAAKC,OAAOE,OACnC,KAAML,gBAAea,UACvB,MAAOJ,EAAEP,KAAKG,QACZH,KAAKC,OAAOD,KAAKG,OAAOH,KAAKC,OAAOE,QAAUK,OAC9CR,KAAKG,QAEPH,MAAKC,OAAOM,EAAEP,KAAKC,OAAOE,QAAUO,EAChCH,GAAGP,KAAKG,QACVH,KAAKG,UAETL,eAAeM,UAAUQ,KAAO,SAASF,GACvCV,KAAKC,OAAOD,KAAKG,OAAOH,KAAKC,OAAOE,QAAUO,EAC9CV,KAAKG,UAEPL,eAAea,cAEd,WACC,GAAIE,GAAMC,SAASC,MAAMC,QACvBC,EAAK,SAASC,GACZ,MAAOlB,MAAKmB,IAAIC,KAAKF,IAEvBG,WAAY,WACVrB,KAAKsB,GAAKC,SAASC,cAAc,OACjCxB,KAAKsB,GAAGG,UAAY,WACpBzB,KAAKmB,IAAMF,EAAEjB,KAAKsB,IAGlBtB,KAAKmB,IAAIO,KAAK,WAAY1B,KAG1B,IAAI2B,GAAOC,SAASxB,UAAUy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AKwjB,UAAWxjB,MACxCA,KAAKyF,MAAMoE,QAAQhC,GAAG,MAAO7H,KAAKwjB,UAAWxjB,OAE/CujB,SAAU,SAAS9Y,GAEZA,EAAMnK,IAAI,cAGfmK,EAAMnK,IAAI,aAAauH,GAAG,eAAgB,SAAStH,GACjDkK,EAAMzI,KAAKf,EAAE,UAAUoS,KAAK9S,EAAED,IAAI,WACjCN,OAELwjB,UAAW,SAAS5Y,GAEbA,EAAOtK,IAAI,eAGhBsK,EAAOtK,IAAI,cAAcuH,GAAG,eAAgB,SAASgO,GACnDjL,EAAO5I,KAAKf,EAAE,UAAUoS,KAAKwC,EAAEvV,IAAI,WAClCN,OAEL+jB,aAAc,WACZ/jB,KAAKyF,MAAMW,MAAM7B,SAASkC,UAAUzG,KAAKyF,MAAMW,WAInDxE"} \ No newline at end of file diff --git a/debug.html b/debug.html index 3a67ff6..588d15a 100644 --- a/debug.html +++ b/debug.html @@ -113,6 +113,8 @@ data: 'random' }); }, 500); + // Set one port to decline multiple connections + dataflow.graph.get('nodes').at(2).inputs.at(1).set('multiple', false); window.d = $(".dataflow").data("dataflow"); }); diff --git a/src/modules/input-view.js b/src/modules/input-view.js index 10b29a7..2d4fb78 100644 --- a/src/modules/input-view.js +++ b/src/modules/input-view.js @@ -389,6 +389,11 @@ return false; } + if (!this.model.canConnect()) { + // Port declined the connection, abort + return; + } + var route = 0; if (ui.helper.data("route") !== undefined) { route = ui.helper.data("route"); diff --git a/src/modules/input.js b/src/modules/input.js index e0d84cf..4379296 100644 --- a/src/modules/input.js +++ b/src/modules/input.js @@ -7,7 +7,8 @@ id: "input", description: "", label: "", - type: "all" + type: "all", + multiple: true }, initialize: function() { this.parentNode = this.get("parentNode"); @@ -16,7 +17,18 @@ } this.connected = []; }, + canConnect: function (edge) { + if (!this.get('multiple') && this.connected.length) { + // This port doesn't allow multiple connections and + // there is a connection already, decline + return false; + } + return true; + }, connect: function(edge){ + if (!this.canConnect(edge)) { + return; + } this.connected.push(edge); this.connected = _.uniq(this.connected); this.trigger('connected'); diff --git a/src/modules/output-view.js b/src/modules/output-view.js index d173be3..7d327b7 100644 --- a/src/modules/output-view.js +++ b/src/modules/output-view.js @@ -214,6 +214,11 @@ return false; } + if (!this.model.canConnect()) { + // Port declined the connection, abort + return; + } + var route = 0; if (ui.helper.data("route") !== undefined) { route = ui.helper.data("route"); diff --git a/src/modules/output.js b/src/modules/output.js index ecc0d30..004a05d 100644 --- a/src/modules/output.js +++ b/src/modules/output.js @@ -9,7 +9,8 @@ id: "output", label: "", type: "all", - description: "" + description: "", + multiple: true } });