Commit 1c2a0b0b authored by Romain Loth's avatar Romain Loth

double click on node creates meso view around this node

parent 0e78bab9
...@@ -931,10 +931,6 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -931,10 +931,6 @@ var TinaWebJS = function ( sigmacanvas ) {
// used for area (with global: TW.gui.circleSize) // used for area (with global: TW.gui.circleSize)
// 'clickNode'- simple click, second event if one node // 'clickNode'- simple click, second event if one node
// POSS easy in new sigma.js:
// add doubleClick to select node + neighboors
// when circle area select // when circle area select
// ======================== // ========================
// 1st event, even before we know if there are nodes // 1st event, even before we know if there are nodes
...@@ -998,6 +994,15 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -998,6 +994,15 @@ var TinaWebJS = function ( sigmacanvas ) {
// just before, at click event // just before, at click event
}) })
// doubleClick creates new meso view around clicked node
partialGraph.bind('doubleClickNode', function(e) {
var theNodeId = e.data.node.id
selInst.MultipleSelection2( {nodes:[theNodeId]} )
let newZoomState = Object.assign(TW.SystemState(), {level:false})
changeLevel(newZoomState)
})
// when click in the empty background // when click in the empty background
// ================================== // ==================================
if (TW.conf.deselectOnclickStage) { if (TW.conf.deselectOnclickStage) {
......
...@@ -557,7 +557,7 @@ function getNeighbors(sourceNids, relKey) { ...@@ -557,7 +557,7 @@ function getNeighbors(sourceNids, relKey) {
// //
// POSS: rewrite using .hidden instead of add/remove // POSS: rewrite using .hidden instead of add/remove
// //
function changeLevel() { function changeLevel(optionalTgtState) {
// show waiting cursor // show waiting cursor
TW.gui.elHtml.classList.add('waiting'); TW.gui.elHtml.classList.add('waiting');
...@@ -565,7 +565,8 @@ function changeLevel() { ...@@ -565,7 +565,8 @@ function changeLevel() {
setTimeout(function() { setTimeout(function() {
var present = TW.SystemState(); // Last var present = TW.SystemState(); // Last
var sels = present.selectionNids ;//[144, 384, 543]//TW.states[last].selectionNids; // array of nids [144, 384, 543]
let sels = optionalTgtState ? optionalTgtState.selectionNids : present.selectionNids
let selsChecker = {} let selsChecker = {}
for (let i in sels) { for (let i in sels) {
...@@ -613,9 +614,9 @@ function changeLevel() { ...@@ -613,9 +614,9 @@ function changeLevel() {
} }
} }
var futurelevel = null var futurelevel = optionalTgtState ? optionalTgtState.level : !present.level
if(present.level) { // [Change to Local] when level=Global(1) if(!futurelevel) { // [Change to Local] when level=Global(1)
for(var nid in nodesToAdd) for(var nid in nodesToAdd)
add1Elem(nid) add1Elem(nid)
for(var eid in edgesToAdd) for(var eid in edgesToAdd)
...@@ -632,9 +633,6 @@ function changeLevel() { ...@@ -632,9 +633,6 @@ function changeLevel() {
} }
} }
} }
futurelevel = false;
} else { // [Change to Global] when level=Local(0) } else { // [Change to Global] when level=Local(0)
// var t0 = performance.now() // var t0 = performance.now()
...@@ -650,17 +648,15 @@ function changeLevel() { ...@@ -650,17 +648,15 @@ function changeLevel() {
add1Elem(eid) add1Elem(eid)
} }
} }
// var t1 = performance.now() // var t1 = performance.now()
futurelevel = true;
// console.log("returning to global took:", t1-t0) // console.log("returning to global took:", t1-t0)
} }
// sels and activereltypes unchanged, no need to call MultipleSelection2 // sels and activereltypes unchanged, no need to call MultipleSelection2
TW.pushGUIState({ TW.pushGUIState({
level: futurelevel level: futurelevel,
sels: sels
}) })
TW.partialGraph.camera.goTo({x:0, y:0, ratio:1.2, angle: 0}) TW.partialGraph.camera.goTo({x:0, y:0, ratio:1.2, angle: 0})
......
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