Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charles Southerland
frama-c
Commits
e38d6fca
Commit
e38d6fca
authored
4 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] Dive: prevents cytoscape to automatically select (and unselect) nodes.
parent
ddac9da6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ivette/src/frama-c/dive/Dive.tsx
+22
-4
22 additions, 4 deletions
ivette/src/frama-c/dive/Dive.tsx
with
22 additions
and
4 deletions
ivette/src/frama-c/dive/Dive.tsx
+
22
−
4
View file @
e38d6fca
...
@@ -54,6 +54,21 @@ function callstackToString(callstack: callstack): string {
...
@@ -54,6 +54,21 @@ function callstackToString(callstack: callstack): string {
return
callstack
.
map
((
cs
)
=>
`
${
cs
.
fun
}
:
${
cs
.
instr
}
`
).
join
(
'
/
'
);
return
callstack
.
map
((
cs
)
=>
`
${
cs
.
fun
}
:
${
cs
.
instr
}
`
).
join
(
'
/
'
);
}
}
/* The Dive class handles the selection of nodes according to user actions.
To prevent cytoscape to automatically select (and unselect) nodes wrongly,
we make some nodes unselectable. We then use the functions below to make
the nodes selectable before (un)selecting them. */
function
select
(
node
:
Cytoscape
.
NodeSingular
):
void
{
node
.
selectify
();
node
.
select
();
}
function
unselect
(
node
:
Cytoscape
.
NodeSingular
):
void
{
node
.
selectify
();
node
.
unselect
();
}
export
type
mode
=
'
explore
'
|
'
overview
'
;
export
type
mode
=
'
explore
'
|
'
overview
'
;
class
Dive
{
class
Dive
{
...
@@ -425,12 +440,15 @@ class Dive {
...
@@ -425,12 +440,15 @@ class Dive {
const
writes
=
node
.
data
()?.
writes
;
const
writes
=
node
.
data
()?.
writes
;
if
(
writes
)
if
(
writes
)
this
.
onSelect
?.(
writes
);
this
.
onSelect
?.(
writes
);
this
.
selectNode
(
node
);
this
.
selectNode
(
node
);
/* Cytoscape automatically selects the node clicked, and unselects all other
nodes and edges. As we want some incoming edges to remain selected, we
make the node unselectable, preventing cytoscape to select it. */
node
.
unselectify
();
}
}
selectLocation
(
location
:
States
.
Location
)
{
selectLocation
(
location
:
States
.
Location
)
{
const
selectNode
=
this
.
cy
.
$
(
'
:selected
'
);
const
selectNode
=
this
.
cy
.
$
(
'
node
:selected
'
);
const
writes
=
selectNode
?.
data
()?.
writes
;
const
writes
=
selectNode
?.
data
()?.
writes
;
if
(
location
.
marker
&&
!
_
.
some
(
writes
,
location
))
{
if
(
location
.
marker
&&
!
_
.
some
(
writes
,
location
))
{
this
.
add
(
location
.
marker
);
this
.
add
(
location
.
marker
);
...
@@ -444,8 +462,8 @@ class Dive {
...
@@ -444,8 +462,8 @@ class Dive {
const
hasOrigin
=
(
ele
:
Cytoscape
.
NodeSingular
)
=>
(
const
hasOrigin
=
(
ele
:
Cytoscape
.
NodeSingular
)
=>
(
_
.
some
(
ele
.
data
().
origins
,
this
.
selectedLocation
)
_
.
some
(
ele
.
data
().
origins
,
this
.
selectedLocation
)
);
);
this
.
cy
.
$
(
'
:selected
'
).
unselect
(
);
this
.
cy
.
$
(
'
:selected
'
).
forEach
(
unselect
);
node
.
select
();
select
(
node
);
const
edges
=
node
.
incomers
(
'
edge
'
);
const
edges
=
node
.
incomers
(
'
edge
'
);
edges
.
unselect
();
edges
.
unselect
();
edges
.
filter
(
hasOrigin
).
select
();
edges
.
filter
(
hasOrigin
).
select
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment