Rhizi / rhizi

Connective intelligence
GNU Affero General Public License v3.0
13 stars 3 forks source link

Zenmode+switch layouts unpins node position in custom layout #642

Closed Garbash closed 8 years ago

Garbash commented 8 years ago

Node position in custom layout breaks when following this sequence of actions:

alon commented 8 years ago

Implementation note:

The way to fix this bug is to enable easier fixing of the rest of the bugs by translating what this bug says to a test, which will require slight event dispatching / future use for graph settling, and then the ability to write code on the graph_view (just because the force layout is right now governed by it, and so is the zen mode - actually that should remain like that for now) of the form:

graph = graph.Graph({temporary:false, base:null})
graph.load_dot("a -> b");
graph_view = graph_view.GraphView(graph);
graph_view.pin_nodes([("a", [100, 200]), ("b", [100, 300]));
graph_view.wait_for_settle(); //alternatively explicitly: graph_view.pin_nodes(..).done(function () { rest_of_test})
function assertPositionUnchanged() {
 assert(graph.a.x == 100); assert(graph.a.y == 200);
 assert(graph.b.x == 100); assert(graph.b.y == 300);
}
assertPositionUnchanged();
graph_view.select(["a"]);
graph_view.set_zen_mode(true); // possibly a helper to select and zen together
graph_view.wait_for_settle();
graph_view.set_zen_mode(false)
graph_view.wait_for_settle();
assertPositionUnchanged();
Garbash commented 8 years ago

Workaround is fine as a solution. Closing.