Skip to content

Instantly share code, notes, and snippets.

@averygoodplanet
Last active December 30, 2015 09:39
Show Gist options
  • Save averygoodplanet/7810353 to your computer and use it in GitHub Desktop.
Save averygoodplanet/7810353 to your computer and use it in GitHub Desktop.
Editing Loaded Map Errors
SETUP OF ERROR:
1. Login
2. Create a new map and save it.
3. From table screen click Load to load the map.
EVENTS THAT TRIGGER ERROR (from step 3 above):
-left-click once on node's title causes (a) nodes to swell large or to most of canvas size
-double-click (a) causes node shapes to disappear.
NOTICED change in data, i.e. fd.toJSON('graph')[0].data.$dim
In good situation (new map edit screen), the $dim is "7"
In error situation (load screen edit errors), the $dim goes "70", then "710" then "70-53-NaN"
HYPOTHESIS 1: The cause of the error is changes to $dim, probably through the feature that highlights neighbor-lines-and-current-node on node name click, e.g. in example2.js:
nameContainer.onclick = function(event) {
fd.graph.eachNode(function(n) {
if(n.id != node.id) delete n.selected;
n.setData('dim', 7, 'end');
n.eachAdjacency(function(adj) {
adj.setDataset('end', {
lineWidth: 0.4,
color: '#23a4ff'
});
});
});
if(!node.selected) {
node.selected = true;
node.setData('dim', 17, 'end');
node.eachAdjacency(function(adj) {
adj.setDataset('end', {
lineWidth: 3,
color: '#36acfb'
});
});
} else {
delete node.selected;
}
//trigger animation to final styles
fd.fx.animate({
modes: [ 'node-property:dim',
'edge-property:lineWidth:color'],
duration: 500
});
ATTEMPTS:
--Tried to comment out entire nameContainer.onclick where $dim is mentioned to see if stopping these changes would stop problem. Commenting out this resulted in canvas not displaying.
@averygoodplanet
Copy link
Author

Additional Setup steps:

  1. in the working directory do npm install
  2. open a tab in terminal and type redis-server to start redis volatile database (for session info, user login/logout)
  3. open a tab in terminal and type startmongo and then mongo which should give a prompt for the mongo database (database that will store saved user and mindmap info.)
  4. then open a terminal tab and do supervisor app.js
  5. start at localhost:3000, register a user, login as that user, then create new map, save the new map, then from table screen click the load button for the map... at this point you'll be at the point where edits to loaded map cause errors described in the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment