Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
0d325422
Commit
0d325422
authored
Apr 05, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functional area select (TODO fix some deselect glitches)
parent
7af0b354
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
36 deletions
+59
-36
extras_explorerjs.js
extras_explorerjs.js
+47
-33
Tinaweb.js
tinawebJS/Tinaweb.js
+12
-3
No files found.
extras_explorerjs.js
View file @
0d325422
...
...
@@ -438,23 +438,29 @@ function circleTrackMouse(e) {
ctx
.
globalAlpha
=
0.5
;
ctx
.
beginPath
();
// // labels appear on circle hover : OFF
// convert (TODO CHECK IN THIS CONTEXT)
var
camCoords
=
TW
.
cam
.
cameraPosition
(
x
,
y
)
var
exactNodeset
=
circleGetAreaNodes
(
camCoords
.
x
,
camCoords
.
y
)
// TODO REFA UNCOMMENT pseudo hover
// labels appear
// var camCoords = TW.cam.cameraPosition(x,y)
//
// if(TW.partialGraph.camera.ratio > showLabelsIfZoom){
// for n of exactNodeset
// n.forceLabel=true;
// var exactNodeset = circleGetAreaNodes(
// camCoords.x,
// camCoords.y
// )
// // using settings_explorerjs.showLabelsIfZoom as cam.ratio threshold
// if(TW.partialGraph.camera.ratio < showLabelsIfZoom){
// for (var k of exactNodeset) {
// // if (! exactNodeset[k].hidden) {
// exactNodeset[k].forceLabel=true;
// // }
// }
// }
// else {
// for(var i in exactNodeset){
// for(var k in exactNodeset){
// n = exactNodeset[k]
// n.forceLabel=false;
//
// // ?deprecated?
// if(typeof(n.neighbour)!=="undefined") {
// if(!n.neighbour) n.forceLabel=false;
// else n.forceLabel=true;
...
...
@@ -478,34 +484,42 @@ function circleTrackMouse(e) {
// exact subset of nodes under circle
function
circleGetAreaNodes
(
camX0
,
camY0
)
{
// leverage quadtree to get a neighborhood
var
cursor_ray
=
cursor_size
*
TW
.
cam
.
ratio
// cursor_size to cam units
// prepare an approximate neighborhood
var
slightlyLargerNodeset
=
circleLocalSubset
(
camX0
,
camY0
,
cursor_size
*
TW
.
cam
.
ratio
// cursor_size to cam units
camX0
,
camY0
,
cursor_ray
)
console
.
log
(
'slightlyLargerNodeset'
,
slightlyLargerNodeset
)
var
exactNodeset
=
[]
for
(
var
i
in
slightlyLargerNodeset
){
n
=
slightlyLargerNodeset
[
i
];
if
(
n
.
hidden
==
false
){
distance
=
Math
.
sqrt
(
Math
.
pow
((
x
-
parseInt
(
n
.
displayX
)),
2
)
+
Math
.
pow
((
y
-
parseInt
(
n
.
displayY
)),
2
)
);
if
(
parseInt
(
distance
)
<=
cursor_size
)
{
exactNodeset
.
push
.
}
else
{
if
(
typeof
(
n
.
neighbour
)
!==
"undefined"
)
{
if
(
!
n
.
neighbour
)
n
.
forceLabel
=
false
;
}
else
n
.
forceLabel
=
false
;
}
}
for
(
var
i
in
slightlyLargerNodeset
){
n
=
slightlyLargerNodeset
[
i
];
if
(
!
n
.
hidden
){
distance
=
Math
.
sqrt
(
Math
.
pow
((
camX0
-
parseInt
(
n
[
'read_cam0:x'
])),
2
)
+
Math
.
pow
((
camY0
-
parseInt
(
n
[
'read_cam0:y'
])),
2
)
);
// console.log('D[P0,'+n.label+'] =', distance)
if
(
distance
<=
cursor_ray
)
{
exactNodeset
.
push
(
n
.
id
)
}
if
(
TW
.
partialGraph
.
forceatlas2
&&
TW
.
partialGraph
.
forceatlas2
.
count
<=
1
)
{
TW
.
partialGraph
.
refresh
({
skipIndexation
:
true
})
else
{
// ?deprecated?
if
(
typeof
(
n
.
neighbour
)
!==
"undefined"
)
{
if
(
!
n
.
neighbour
)
n
.
forceLabel
=
false
;
}
else
n
.
forceLabel
=
false
;
}
}
}
if
(
TW
.
partialGraph
.
forceatlas2
&&
TW
.
partialGraph
.
forceatlas2
.
count
<=
1
)
{
TW
.
partialGraph
.
refresh
({
skipIndexation
:
true
})
}
return
exactNodeset
}
...
...
tinawebJS/Tinaweb.js
View file @
0d325422
...
...
@@ -260,7 +260,7 @@ SelectionEngine = function() {
/**
* Main function for any selecting action
*
* @nodes: eg targeted array
* @nodes: eg targeted array
(only ids)
*/
// external usage : partialGraph , updateLeftPanel_fix();
this
.
MultipleSelection2
=
(
function
(
nodes
,
nodesDict
,
edgesDict
)
{
...
...
@@ -681,7 +681,12 @@ TinaWebJS = function ( sigmacanvas ) {
partialGraph
.
camera
.
goTo
({
x
:
0
,
y
:
0
,
ratio
:
1
})
});
// new sigma.js: attempt to use sigma events bindings
// ---------------------
// new sigma.js: sigma events bindings
// ---------------------
// cf. https://github.com/jacomyal/sigma.js/wiki/Events-API
// cases:
...
...
@@ -718,7 +723,11 @@ TinaWebJS = function ( sigmacanvas ) {
// circleNodes += prevsels
// 2) show selection + do all related effects
SelInst
.
MultipleSelection2
({
nodes
:
circleNodes
})
cancelSelection
()
if
(
circleNodes
.
length
)
{
SelInst
.
MultipleSelection2
({
nodes
:
circleNodes
})
}
}
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment