Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Node position doesn't doesn't survive browser reload ... #146

Open
pecastro opened this issue Oct 3, 2017 · 4 comments
Open

Node position doesn't doesn't survive browser reload ... #146

pecastro opened this issue Oct 3, 2017 · 4 comments

Comments

@pecastro
Copy link
Contributor

pecastro commented Oct 3, 2017

... conversely changing the node position at the DB level doesn't reflect a position change in the browser.

@clemsos
Copy link
Member

clemsos commented Oct 4, 2017

@pecastro I added a 'preset' mode that will load positions from the db in 3e96aa9

My plan is to separate completely visual state from the data. This means removing positions, layouts, zoom, etc from the network (nodes/edges) data, and have a separate model called 'Views' (better name needed?) to store / retrieve a state of the graph. That means you can have many different visualizations of a same data, save them, share them, etc.

Does this sounds like an interesting feature for you?

pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
@pecastro
Copy link
Contributor Author

pecastro commented Oct 6, 2017

Yes that could potentially be an interesting feature.

pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
pecastro added a commit to pecastro/topogram that referenced this issue Oct 6, 2017
@pecastro
Copy link
Contributor Author

pecastro commented Oct 6, 2017

@clemsos I've realized why I couldn't see the node changes months ago and why now I couldn't seem to update the position of the nodes.
In my graph whenever I was changing a node position the UI was updating and puting the node back to it's original position.

It turns out that in most of the nodesMethods.js functions there's a messing required search param, the topogramId.

Notice the output I get in my DB which has many topograms...

> db.nodes.find({ "data.id": 9})
{ "_id" : "pAAadFvRMk6AvADTz", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-02T17:07:27.778Z"), "group" : "nodes", "position" : { "x" : 391.4894063025713, "y" : 143.8882949296385 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "RrwCqPM4RhgAq4iQ8" }
{ "_id" : "GFwjrx7MWdPcRZtAr", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-02T17:42:22.215Z"), "group" : "nodes", "position" : { "x" : 746.648527123034, "y" : 415.2184917591512 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "RTJWHsHoscLYYyuRo" }
{ "_id" : "mDmRfaLp9qtgDG8QZ", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-02T17:47:52.754Z"), "group" : "nodes", "position" : { "x" : -743.631660496517, "y" : 198.00357862204277 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "txEfFejKHCyT7TjKh" }
{ "_id" : "BRQPp9Zu7KfTWMiLw", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-02T22:22:52.443Z"), "group" : "nodes", "position" : { "x" : 227.2517878562212, "y" : 413.28443912789226 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "TBFSxy2MwaF786xsD" }
{ "_id" : "RMtNHmLw2bRYuaNSd", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-02T22:56:54.640Z"), "group" : "nodes", "position" : { "x" : 428.8910761475563, "y" : 69.10594375804067 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "YKdHjusM83iStP6Eu" }
{ "_id" : "t8jgbQ7G8ZgwhdPrG", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-02T23:09:51.250Z"), "group" : "nodes", "position" : { "x" : 450.71329455822706, "y" : 31.69723581522703 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "6LrY3RgioBdk8Ss8K" }
{ "_id" : "Cr82jHyCCTMoXAYtf", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-07T11:32:52.850Z"), "group" : "nodes", "position" : { "x" : 517.7674941718578, "y" : 94.88617493771017 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "4SE7eQx53zbGZa4bS" }
{ "_id" : "9BpW8Es4L84yHdZaa", "data" : { "lat" : 0, "lng" : 0, "weight" : 0, "start" : 0, "end" : 0, "starred" : false, "name" : "Node 9", "color" : 0, "group" : 0, "additionalInfo" : "", "rawData" : {  }, "id" : 9 }, "createdAt" : ISODate("2017-04-07T11:33:20.636Z"), "group" : "nodes", "position" : { "x" : 282.87410624325275, "y" : 318.16137121059 }, "owner" : "xRSFFRLMj7wEBn24D", "topogramId" : "pJA6bqGtzNo9LHsdJ" }

Most of the node operations will only work when you only have a single topogram.

Given that the mongo id of the node doesn't seem to be handled by Cytoscape.

Have a look at the last 2 commits and tell me what you think.

clemsos added a commit to pecastro/topogram that referenced this issue Oct 7, 2017
@clemsos
Copy link
Member

clemsos commented Oct 7, 2017

Wow, you are right. That will make anything with the same name/id to be fetched from different topograms. I will update the tests to pass with a topogramId argument and merge your PR.

One thing is that there is currently no update of node/edges data from Topogram's interface (except moving a node). So I guess moving node is the only function affected by the bug so far. I want to focus on having good a working visualization engine before introducing data editing feature.

That is why I am trying to separate the data model from 'view' as far as possible (see #152 ). I have started to implement this on #153

clemsos added a commit that referenced this issue Oct 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants