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
Deploy
Releases
Container Registry
Model registry
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
pub
frama-c
Commits
db9a57bc
Commit
db9a57bc
authored
6 months ago
by
Remi Lazarini
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] Graph : replace cycle option by a function
parent
b8ed5ab8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ivette/src/dome/renderer/graph/graph.tsx
+21
-11
21 additions, 11 deletions
ivette/src/dome/renderer/graph/graph.tsx
with
21 additions
and
11 deletions
ivette/src/dome/renderer/graph/graph.tsx
+
21
−
11
View file @
db9a57bc
...
...
@@ -120,7 +120,7 @@ export interface ILinksOptions {
/** Number of directional particles */
directionalParticle
?:
number
;
/** Width of directional particles */
particleWidth
?:
number
;
particleWidth
?:
number
|
((
node
:
GLink
)
=>
number
)
;
/** Color of directional particles */
particleColor
?:
string
|
((
node
:
GLink
)
=>
string
)
}
...
...
@@ -138,8 +138,11 @@ export interface IGraphOptions {
displayMode
?:
'
td
'
;
/** Spacing between depths level */
depthSpacing
?:
number
;
/** A string[][] ref to save the cycles */
cycles
?:
React
.
MutableRefObject
<
string
[][]
>
/**
* Callback called when a cycle is detected
* @param val array of cycle node ids
* */
onDagError
?:
(
val
:
string
[])
=>
void
;
/** Nodes options */
nodesOptions
?:
INodesOptions
;
/** Links options */
...
...
@@ -168,12 +171,6 @@ function getOnEngineStop(
};
}
function
getOnDagError
(
cycles
:
React
.
MutableRefObject
<
string
[][]
>
):(
val
:
(
string
|
number
)[])
=>
void
{
return
(
val
:
(
string
|
number
)[])
=>
cycles
.
current
.
push
(
val
as
string
[]);
}
/** Tranform JSX.Element to HtmlObject */
const
jsxToHtmlObject
=
(
jsxElement
:
JSX
.
Element
):
HTMLDivElement
=>
{
const
container
=
document
.
createElement
(
'
div
'
);
...
...
@@ -315,7 +312,8 @@ function getForceGraphOptions(
if
(
options
)
{
const
{
backgroundColor
,
displayMode
,
depthSpacing
,
cycles
,
htmlNode
,
autoCenter
backgroundColor
,
displayMode
,
depthSpacing
,
onDagError
,
htmlNode
,
autoCenter
}
=
options
;
if
(
displayMode
)
ret
.
dagMode
=
displayMode
;
...
...
@@ -323,7 +321,19 @@ function getForceGraphOptions(
if
(
backgroundColor
)
ret
.
backgroundColor
=
backgroundColor
;
ret
.
onEngineStop
=
getOnEngineStop
(
fgRef
,
{
autoCenter
});
if
(
cycles
)
ret
.
onDagError
=
getOnDagError
(
cycles
);
ret
.
onDagError
=
(
val
)
=>
{
if
(
typeof
val
[
0
]
===
'
number
'
)
{
// eslint-disable-next-line no-console
console
.
error
(
'
onDagError : ID must be a string
'
);
}
if
(
onDagError
)
{
const
newCycle
:
string
[]
=
[];
val
.
forEach
((
elt
)
=>
{
newCycle
.
push
(
typeof
elt
===
'
string
'
?
elt
:
elt
.
toString
());
});
onDagError
(
newCycle
);
}
};
if
(
htmlNode
)
{
ret
.
extraRenderers
=
[
new
CSS2DRenderer
()];
...
...
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