Commit 4caad75d authored by Thibaut Frain's avatar Thibaut Frain Committed by Jérome Perrin

Click on connection between two nodes offers to remove this connection

parent 135f6f88
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ==========================================================================*/ * ==========================================================================*/
/*global RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin, /*global RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin,
loopEventListener, DOMParser*/ loopEventListener, DOMParser, confirm*/
/*jslint unparam: true */ /*jslint unparam: true */
(function (RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin, (function (RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin,
loopEventListener, DOMParser) { loopEventListener, DOMParser) {
...@@ -144,6 +144,14 @@ ...@@ -144,6 +144,14 @@
}); });
} }
function waitForConnectionClick(gadget) {
loopJsplumbBind(gadget, 'click', function (connection) {
if (confirm("Delete connection ?")) {
gadget.props.jsplumb_instance.detach(connection);
}
});
}
function convertToAbsolutePosition(gadget, x, y) { function convertToAbsolutePosition(gadget, x, y) {
var zoom_level = (gadget.props.preference_container.zoom_level || 1.0) * var zoom_level = (gadget.props.preference_container.zoom_level || 1.0) *
1.1111, 1.1111,
...@@ -261,13 +269,6 @@ ...@@ -261,13 +269,6 @@
// listen for clicks on connections, // listen for clicks on connections,
// and offer to change values on click. // and offer to change values on click.
// jsplumb_instance.bind("click", function (conn) {
// jsplumb_instance.detach(conn);
// });
// jsplumb_instance.bind("beforeDetach", function (conn) {
// return confirm("Delete connection?");
// });
// jsplumb_instance // jsplumb_instance
// .bind("connectionDrag", function (connection) { // .bind("connectionDrag", function (connection) {
...@@ -642,7 +643,8 @@ ...@@ -642,7 +643,8 @@
waitForDragover(g), waitForDragover(g),
waitForDrop(g, config), waitForDrop(g, config),
waitForConnection(g), waitForConnection(g),
waitForConnectionDetached(g) waitForConnectionDetached(g),
waitForConnectionClick(g)
]); ]);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment