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
a8b9992f
Commit
a8b9992f
authored
Mar 29, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reconnect the selector's trackMouse to mousemove (looking for ways to optimize it)
parent
c8e679b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
50 deletions
+78
-50
extras_explorerjs.js
extras_explorerjs.js
+57
-44
Tinaweb.js
tinawebJS/Tinaweb.js
+21
-6
No files found.
extras_explorerjs.js
View file @
a8b9992f
...
@@ -428,69 +428,82 @@ function draw1Circle(ctx , x , y , color) {
...
@@ -428,69 +428,82 @@ function draw1Circle(ctx , x , y , color) {
}
}
// show Selector circle
// --------------------
// new sigma.js: could be replaced by default _moveHandler with bindings ?
// new sigma.js: could be replaced by default _moveHandler with bindings ?
// => atm rewrote entire function with new values
(check if not needed recentering coords)
// => atm rewrote entire function with new values
function
trackMouse
(
e
)
{
function
trackMouse
(
e
)
{
if
(
!
shift_key
)
{
if
(
!
shift_key
)
{
// $.doTimeout(300,function (){
// $.doTimeout(300,function (){
// var ctx = TW.partialGraph._core.domElements.mouse.getContext('2d');
// new sigma.js 2D mouse context
// new sigma.js 2D mouse context
var
ctx
=
TW
.
partialGraph
.
renderers
[
0
].
contexts
.
mouse
;
var
ctx
=
TW
.
partialGraph
.
renderers
[
0
].
contexts
.
mouse
;
ctx
.
globalCompositeOperation
=
"source-over"
;
ctx
.
globalCompositeOperation
=
"source-over"
;
// ctx.clearRect(0, 0, TW.partialGraph._core.domElements.nodes.width, TW.partialGraph._core.domElements.nodes.height);
// clear zone each time to prevent repeated frame artifacts
ctx
.
clearRect
(
0
,
0
,
ctx
.
clearRect
(
0
,
0
,
TW
.
partialGraph
.
renderers
[
0
].
container
.
offsetWidth
,
TW
.
partialGraph
.
renderers
[
0
].
container
.
offsetWidth
,
TW
.
partialGraph
.
renderers
[
0
].
container
.
offsetHeight
);
TW
.
partialGraph
.
renderers
[
0
].
container
.
offsetHeight
);
x
=
sigma
.
utils
.
getX
(
e
);
// testing with overNodes event
y
=
sigma
.
utils
.
getY
(
e
);
// cf. https://github.com/jacomyal/sigma.js/wiki/Events-API
if
(
e
.
type
==
"overNodes"
)
{
x
=
e
.
data
.
captor
.
clientX
y
=
e
.
data
.
captor
.
clientY
}
// classic mousemove event or other similar events
else
{
x
=
sigma
.
utils
.
getX
(
e
);
y
=
sigma
.
utils
.
getY
(
e
);
}
// console.log("trackMouse mod: x", x, "y", y)
ctx
.
strokeStyle
=
'#000'
;
ctx
.
strokeStyle
=
'#000'
;
ctx
.
lineWidth
=
1
;
ctx
.
lineWidth
=
1
;
// ctx.fillStyle = "#71C3FF";
ctx
.
fillStyle
=
"#71C3FF"
;
ctx
.
fillStyle
=
"#F20"
;
ctx
.
globalAlpha
=
0.5
;
ctx
.
globalAlpha
=
0.5
;
ctx
.
beginPath
();
ctx
.
beginPath
();
// labels appear
// labels appear
var
nds
=
TW
.
partialGraph
.
graph
.
nodes
()
var
nds
=
TW
.
partialGraph
.
graph
.
nodes
()
if
(
TW
.
partialGraph
.
camera
.
ratio
>
showLabelsIfZoom
){
for
(
var
i
in
nds
){
// TODO replace by a hover binding (and POSS use quadtree zone)
n
=
nds
[
i
];
//
if
(
n
.
hidden
==
false
){
// if(TW.partialGraph.camera.ratio>showLabelsIfZoom){
distance
=
Math
.
sqrt
(
// for(var i in nds){
Math
.
pow
((
x
-
parseInt
(
n
.
displayX
)),
2
)
+
// n=nds[i];
Math
.
pow
((
y
-
parseInt
(
n
.
displayY
)),
2
)
// if(n.hidden==false){
);
// distance = Math.sqrt(
if
(
parseInt
(
distance
)
<=
cursor_size
)
{
// Math.pow((x-parseInt(n.displayX)),2) +
n
.
forceLabel
=
true
;
// Math.pow((y-parseInt(n.displayY)),2)
}
else
{
// );
if
(
typeof
(
n
.
neighbour
)
!==
"undefined"
)
{
// if(parseInt(distance)<=cursor_size) {
if
(
!
n
.
neighbour
)
n
.
forceLabel
=
false
;
// n.forceLabel=true;
}
else
n
.
forceLabel
=
false
;
// } else {
}
// 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
})
// }
}
// }
}
else
{
// if(TW.partialGraph.forceatlas2 && TW.partialGraph.forceatlas2.count<=1) {
for
(
var
i
in
nds
){
// TW.partialGraph.refresh({skipIndexation:true})
n
=
nds
[
i
];
// }
if
(
!
n
.
hidden
){
// } else {
n
.
forceLabel
=
false
;
// for(var i in nds){
if
(
typeof
(
n
.
neighbour
)
!==
"undefined"
)
{
// n=nds[i];
if
(
!
n
.
neighbour
)
n
.
forceLabel
=
false
;
// if(!n.hidden){
else
n
.
forceLabel
=
true
;
// n.forceLabel=false;
}
else
n
.
forceLabel
=
false
;
// if(typeof(n.neighbour)!=="undefined") {
}
// if(!n.neighbour) n.forceLabel=false;
}
// else n.forceLabel=true;
if
(
TW
.
partialGraph
.
forceatlas2
&&
TW
.
partialGraph
.
forceatlas2
.
count
<=
1
)
{
// } else n.forceLabel=false;
TW
.
partialGraph
.
refresh
({
skipIndexation
:
true
})
// }
}
// }
}
// if(TW.partialGraph.forceatlas2 && TW.partialGraph.forceatlas2.count<=1) {
// TW.partialGraph.refresh({skipIndexation:true})
// }
// }
ctx
.
arc
(
x
,
y
,
cursor_size
,
0
,
Math
.
PI
*
2
,
true
);
ctx
.
arc
(
x
,
y
,
cursor_size
,
0
,
Math
.
PI
*
2
,
true
);
//ctx.arc(TW.partialGraph._core.width/2, TW.partialGraph._core.height/2, 4, 0, 2 * Math.PI, true);/*todel*/
//ctx.arc(TW.partialGraph._core.width/2, TW.partialGraph._core.height/2, 4, 0, 2 * Math.PI, true);/*todel*/
ctx
.
closePath
();
ctx
.
closePath
();
...
...
tinawebJS/Tinaweb.js
View file @
a8b9992f
...
@@ -810,12 +810,27 @@ TinaWebJS = function ( sigmacanvas ) {
...
@@ -810,12 +810,27 @@ TinaWebJS = function ( sigmacanvas ) {
// Simple Click
// Simple Click
// external usage: SelectorEngine()
// external usage: SelectorEngine()
// $("#sigma-example")
$
(
"#sigma-example"
)
// .mousemove(function(event){
// if(!isUndef(partialGraph)) {
.
mousemove
(
function
(
event
){
// if(cursor_size>0) trackMouse(event);
if
(
!
isUndef
(
partialGraph
))
{
// }
if
(
cursor_size
>
0
)
trackMouse
(
event
);
// })
}
})
// TW.partialGraph.bind('overNode', function(e) {
// if(!isUndef(partialGraph)) {
// if(cursor_size>0) trackMouse(event);
// }
// })
// TW.partialGraph.bind('overNodes', function(e) {
// if(!isUndef(partialGraph)) {
// if(cursor_size>0) trackMouse(event);
// }
// })
// .contextmenu(function(){
// .contextmenu(function(){
// return false;
// return false;
// })
// })
...
...
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