Skip to content

Commit 48e671e

Browse files
committed
Show visually that a port has a state, fixes #71
1 parent 8d0d8aa commit 48e671e

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

build/dataflow.build.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dataflow.js - v0.0.7 - 2013-09-28 (9:41:38 PM GMT+0200)
1+
/*! dataflow.js - v0.0.7 - 2013-09-30 (12:00:46 PM GMT+0200)
22
* Copyright (c) 2013 Forrest Oliphant; Licensed MIT, GPL */
33
(function(Backbone) {
44
var ensure = function (obj, key, type) {
@@ -1910,6 +1910,11 @@
19101910
this._holePosition = null;
19111911
}.bind(this));
19121912

1913+
var nodeState = node.get('state');
1914+
if (nodeState && nodeState[this.model.id]) {
1915+
this.$el.addClass('hasvalue');
1916+
}
1917+
19131918
if (!this.model.parentNode.parentGraph.dataflow.editable) {
19141919
// No drag and drop
19151920
return;
@@ -1983,10 +1988,13 @@
19831988
this.model.parentNode.on('change:state', function () {
19841989
var state = this.model.parentNode.get('state');
19851990
if (!state || state[this.model.id] === undefined) {
1991+
this.$el.removeClass('hasvalue');
19861992
return;
19871993
}
19881994
this.setInputValue(input, type, state[this.model.id]);
1995+
this.$el.addClass('hasvalue');
19891996
}.bind(this));
1997+
19901998
var label = $('<label class="input-type-' + type + '">')
19911999
.append( input )
19922000
.prepend( '<span>' + this.model.get("label") + "</span> " );

build/dataflow.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/dataflow.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/default/dataflow.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/input-view.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
this._holePosition = null;
4646
}.bind(this));
4747

48+
var nodeState = node.get('state');
49+
if (nodeState && nodeState[this.model.id]) {
50+
this.$el.addClass('hasvalue');
51+
}
52+
4853
if (!this.model.parentNode.parentGraph.dataflow.editable) {
4954
// No drag and drop
5055
return;
@@ -118,10 +123,13 @@
118123
this.model.parentNode.on('change:state', function () {
119124
var state = this.model.parentNode.get('state');
120125
if (!state || state[this.model.id] === undefined) {
126+
this.$el.removeClass('hasvalue');
121127
return;
122128
}
123129
this.setInputValue(input, type, state[this.model.id]);
130+
this.$el.addClass('hasvalue');
124131
}.bind(this));
132+
125133
var label = $('<label class="input-type-' + type + '">')
126134
.append( input )
127135
.prepend( '<span>' + this.model.get("label") + "</span> " );

themes/default/modules/port.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@
137137
}
138138

139139
/* Port */
140+
.dataflow-node-ins .hasvalue .dataflow-port-hole {
141+
background-color: hsl( 210, 68%, 70%);
142+
}
140143

141144
.dataflow-node.fade .dataflow-port-hole.active.route0, .dataflow-port-hole.active.route0 { background-color: hsl( 0, 0%, 65%); }
142145
.dataflow-node.fade .dataflow-port-hole.active.route1, .dataflow-port-hole.active.route1 { background-color: hsl( 0, 68%, 70%); }

0 commit comments

Comments
 (0)