Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend V2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor 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
GraphPolaris
Frontend V2
Commits
a750681b
Commit
a750681b
authored
9 months ago
by
Dennis Collaris
Browse files
Options
Downloads
Patches
Plain Diff
perf: do not show edge labels when number of nodes exceeds configurable threshold
parent
e51f24f2
No related branches found
No related tags found
No related merge requests found
Pipeline
#137522
passed
9 months ago
Stage: tag-release
Stage: get-release-tag
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx
+29
-23
29 additions, 23 deletions
.../lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx
with
29 additions
and
23 deletions
libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx
+
29
−
23
View file @
a750681b
...
...
@@ -96,6 +96,8 @@ export const NLPixi = (props: Props) => {
width
:
1000
,
height
:
1000
,
LABEL_MAX_NODES
:
1000
,
LAYOUT_ALGORITHM
:
Layouts
.
FORCEATLAS2WEBWORKER
,
NODE_RADIUS
:
5
,
...
...
@@ -205,22 +207,24 @@ export const NLPixi = (props: Props) => {
onZoom
(
event
:
FederatedPointerEvent
)
{
const
scale
=
viewport
.
current
!
.
transform
.
scale
.
x
;
labelLayer
.
alpha
=
(
scale
>
2
)
?
Math
.
min
(
1
,
(
scale
-
2
)
*
3
)
:
0
;
if
(
labelLayer
.
alpha
>
0
)
{
labelLayer
.
renderable
=
true
;
const
scale
=
1
/
viewport
.
current
!
.
scale
.
x
;
// starts from 0.5 down to 0.
// Only change the fontSize for specific intervals, continuous change has too big of an impact on performance
const
fontSize
=
(
scale
<
0.1
)
?
30
:
(
scale
<
0.2
)
?
40
:
(
scale
<
0.3
)
?
50
:
60
;
const
strokeWidth
=
fontSize
/
2
;
labelMap
.
current
.
forEach
((
text
)
=>
{
text
.
style
.
fontSize
=
fontSize
;
text
.
style
.
strokeThickness
=
strokeWidth
;
});
}
else
{
labelLayer
.
renderable
=
false
;
if
(
graph
.
current
.
nodes
.
length
<
config
.
LABEL_MAX_NODES
)
{
labelLayer
.
alpha
=
(
scale
>
2
)
?
Math
.
min
(
1
,
(
scale
-
2
)
*
3
)
:
0
;
if
(
labelLayer
.
alpha
>
0
)
{
labelLayer
.
renderable
=
true
;
const
scale
=
1
/
viewport
.
current
!
.
scale
.
x
;
// starts from 0.5 down to 0.
// Only change the fontSize for specific intervals, continuous change has too big of an impact on performance
const
fontSize
=
(
scale
<
0.1
)
?
30
:
(
scale
<
0.2
)
?
40
:
(
scale
<
0.3
)
?
50
:
60
;
const
strokeWidth
=
fontSize
/
2
;
labelMap
.
current
.
forEach
((
text
)
=>
{
text
.
style
.
fontSize
=
fontSize
;
text
.
style
.
strokeThickness
=
strokeWidth
;
});
}
else
{
labelLayer
.
renderable
=
false
;
}
}
}
}));
...
...
@@ -662,13 +666,15 @@ export const NLPixi = (props: Props) => {
}
});
graph
.
current
.
links
.
forEach
((
link
)
=>
{
if
(
!
forceClear
&&
labelMap
.
current
.
has
(
link
.
_id
))
{
updateLinkLabel
(
link
);
}
else
{
createLinkLabel
(
link
);
}
});
if
(
graph
.
current
.
nodes
.
length
<
config
.
LABEL_MAX_NODES
)
{
graph
.
current
.
links
.
forEach
((
link
)
=>
{
if
(
!
forceClear
&&
labelMap
.
current
.
has
(
link
.
_id
))
{
updateLinkLabel
(
link
);
}
else
{
createLinkLabel
(
link
);
}
});
}
// // update text colour (written after nodes so that text appears on top of nodes)
// nodes.forEach((node: NodeType) => {
...
...
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