Message now to the right

This commit is contained in:
Ruben van de Ven 2019-02-25 15:56:59 +01:00
parent 9b5759a4ac
commit 6f8cacdaae

View file

@ -495,7 +495,7 @@ class Graph {
'on': { 'on': {
'click': ( e ) => { 'click': ( e ) => {
if(confirm("Do you want to remove this condition?")) { if(confirm("Do you want to remove this condition?")) {
console.log('remove condition for direction', condition, direction); // console.log('remove condition for direction', condition, direction);
panopticon.graph.rmCondition( condition, direction ); panopticon.graph.rmCondition( condition, direction );
} }
} }
@ -663,9 +663,9 @@ class Graph {
// checkboxes to true/false // checkboxes to true/false
let defs = g.getConditionTypes()[type]; let defs = g.getConditionTypes()[type];
console.log(defs); // console.log(defs);
for(let field in defs) { for(let field in defs) {
console.log(field); // console.log(field);
if(defs[field]['type'] == 'checkbox') { if(defs[field]['type'] == 'checkbox') {
console.info('configure checkbox', field); console.info('configure checkbox', field);
form.set(field, form.has(field)); form.set(field, form.has(field));
@ -681,7 +681,7 @@ class Graph {
vars = g._formPathToVars(pair[0], pair[1], vars); vars = g._formPathToVars(pair[0], pair[1], vars);
} }
// TODO: checkboxes // TODO: checkboxes
console.log("Createded", vars); // console.log("Createded", vars);
g.addConditionForDirection( type, label, vars, direction ); g.addConditionForDirection( type, label, vars, direction );
} }
} }
@ -863,6 +863,7 @@ class Graph {
createConnectedMsg(sourceMsg) { createConnectedMsg(sourceMsg) {
let newMsg = this.addMsg(); let newMsg = this.addMsg();
this.getNodeById(newMsg['@id']).y = this.getNodeById(sourceMsg['@id']).y
this.addDirection(sourceMsg, newMsg); this.addDirection(sourceMsg, newMsg);
this.build(); this.build();
@ -920,7 +921,7 @@ class Graph {
let toRemove = ['sourceX', 'sourceY', 'targetX', 'targetY', 'vx', 'vy'] let toRemove = ['sourceX', 'sourceY', 'targetX', 'targetY', 'vx', 'vy']
for ( let node of this.data ) { for ( let node of this.data ) {
let n = {}; let n = {};
console.log( node['source'] ); // console.log( node['source'] );
for ( let e in node ) { for ( let e in node ) {
if ( node.hasOwnProperty( e ) && toRemove.indexOf( e ) == -1 ) { if ( node.hasOwnProperty( e ) && toRemove.indexOf( e ) == -1 ) {
if ( this.data.indexOf( node[e] ) != -1 ) { if ( this.data.indexOf( node[e] ) != -1 ) {
@ -1040,10 +1041,10 @@ class Graph {
.force( "link", d3.forceLink( this.directions ).id( d => d['@id'] ).strength(0) ) .force( "link", d3.forceLink( this.directions ).id( d => d['@id'] ).strength(0) )
// .force( "charge", d3.forceManyBody().strength( 100 ) ) // .force( "charge", d3.forceManyBody().strength( 100 ) )
// .force( "center", d3.forceCenter( this.width / 2, this.height / 2 ) ) // .force( "center", d3.forceCenter( this.width / 2, this.height / 2 ) )
.force( "collide", d3.forceCollide( this.nodeSize * 2.3 ).strength(2) ) .force( "collide", d3.forceCollide( this.nodeSize * 1.5 ).strength(1) )
.force( "forceX", d3.forceX(function(m){ .force( "forceX", d3.forceX(function(m){
let fx = panopticon.graph.distances[m['@id']] !== null ? panopticon.graph.distances[m['@id']] * panopticon.graph.nodeSize * 4 : 0 let fx = panopticon.graph.distances[m['@id']] !== null ? panopticon.graph.distances[m['@id']] * panopticon.graph.nodeSize * 4 : 0
console.log('fx', m['@id'], panopticon.graph.distances[m['@id']], fx); // console.log('fx', m['@id'], panopticon.graph.distances[m['@id']], fx);
return fx; return fx;
}).strength(50)) }).strength(50))
// .force( "forceY", d3.forceY(m => panopticon.graph.distances[m['@id']] !== null ? 0 : panopticon.graph.nodeSize * 3 ).strength(30)) // .force( "forceY", d3.forceY(m => panopticon.graph.distances[m['@id']] !== null ? 0 : panopticon.graph.nodeSize * 3 ).strength(30))
@ -1229,7 +1230,7 @@ class Graph {
let targetsPerMsg = {}; let targetsPerMsg = {};
let sourcesPerMsg = {}; let sourcesPerMsg = {};
console.log("dir", this.directions); // console.log("dir", this.directions);
for(let direction of this.directions) { for(let direction of this.directions) {
let from = typeof direction['source'] == "string" ? direction['source'] : direction['source']['@id']; let from = typeof direction['source'] == "string" ? direction['source'] : direction['source']['@id'];
let to = typeof direction['target'] == "string" ? direction['target'] : direction['target']['@id']; let to = typeof direction['target'] == "string" ? direction['target'] : direction['target']['@id'];
@ -1248,7 +1249,7 @@ class Graph {
let traverseMsg = function(msgId, depth, goingDown) { let traverseMsg = function(msgId, depth, goingDown) {
let msgsPerMsg = goingDown ? targetsPerMsg : sourcesPerMsg; let msgsPerMsg = goingDown ? targetsPerMsg : sourcesPerMsg;
console.log(goingDown, msgId, depth); // console.log(goingDown, msgId, depth);
if(!msgsPerMsg.hasOwnProperty(msgId)) { if(!msgsPerMsg.hasOwnProperty(msgId)) {
// end of trail // end of trail
return; return;