Commit 76676dbd authored by Romain Loth's avatar Romain Loth

include dragNodes plugin by josemazo & sheymann

parent 9588af4b
......@@ -715,6 +715,7 @@
<script src="tinawebJS/sigma_v1.2/plugins/sigma.layout.forceAtlas2/supervisor.js"></script>
<script src="tinawebJS/sigma_v1.2/plugins/sigma.layout.forceAtlas2/worker.js"></script>
<script src="tinawebJS/sigma_v1.2/plugins/sigma.renderers.snapshot/sigma.renderers.snapshot.js"></script>
<script src="tinawebJS/sigma_v1.2/plugins/sigma.plugins.dragNodes/sigma.plugins.dragNodes.js"></script>
<!-- Tested as replacement for parseCustom -->
<!-- <script src="tinawebJS/sigma_v1.2/plugins/sigma.parsers.gexf/gexf-parser.js"></script> -->
......
......@@ -172,6 +172,8 @@ TW.conf = (function(TW){
TWConf.clusterColorsAtt = true; // show "Set colors" menu
TWConf.dragNodesAvailable = true; // allow dragging nodes
TWConf.deselectOnclickStage = true // click on background remove selection ?
// (except when dragging)
......
......@@ -893,6 +893,12 @@ var TinaWebJS = function ( sigmacanvas ) {
$("#zoomSlider").slider("value",1/TW.cam.ratio)
})
// dragNodes plugin
if (TW.conf.dragNodesAvailable) {
var dragListener = sigma.plugins.dragNodes(partialGraph, partialGraph.renderers[0]);
}
// ---------------------------------------------------------------------
// POSS: bind to captors (0=>mouse, 1=>touch)
......
sigma.plugins.dragNodes
=====================
Plugin developed by [José M. Camacho](https://github.com/josemazo), events by [Sébastien Heymann](https://github.com/sheymann) for [Linkurious](https://github.com/Linkurious).
---
This plugin provides a method to drag & drop nodes. At the moment, this plugin is not compatible with the WebGL renderer. Check the sigma.plugins.dragNodes function doc or the [example code](../../examples/drag-nodes.html) to know more.
To use, include all .js files under this folder. Then initialize it as follows:
````javascript
var dragListener = new sigma.plugins.dragNodes(sigInst, renderer);
````
Kill the plugin as follows:
````javascript
sigma.plugins.killDragNodes(sigInst);
````
## Events
This plugin provides the following events fired by the instance of the plugin:
* `startdrag`: fired at the beginning of the drag
* `drag`: fired while the node is dragged
* `drop`: fired at the end of the drag if the node has been dragged
* `dragend`: fired at the end of the drag
Exemple of event binding:
````javascript
dragListener.bind('startdrag', function(event) {
console.log(event);
});
````
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