Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
alg
Knowledge Space WP Plugin
Commits
68af56a1
Commit
68af56a1
authored
2 years ago
by
Matthias Konitzny
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug which caused the simulation to not reheat on space change.
parent
ac80b943
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/editor/editor.tsx
+8
-7
8 additions, 7 deletions
src/editor/editor.tsx
src/editor/renderer.tsx
+5
-0
5 additions, 0 deletions
src/editor/renderer.tsx
with
13 additions
and
7 deletions
src/editor/editor.tsx
+
8
−
7
View file @
68af56a1
...
...
@@ -63,7 +63,6 @@ type stateTypes = {
* Knowledge space graph editor. Allows easy editing of the graph structure.
*/
export
class
Editor
extends
React
.
PureComponent
<
any
,
stateTypes
>
{
private
graphContainer
:
React
.
RefObject
<
HTMLDivElement
>
;
private
rendererRef
:
React
.
RefObject
<
GraphRenderer2D
>
;
constructor
(
props
:
any
)
{
...
...
@@ -85,7 +84,7 @@ export class Editor extends React.PureComponent<any, stateTypes> {
this
.
keyReleased
(
e
.
key
);
});
this
.
graphContainer
=
React
.
createRef
();
this
.
rendererRef
=
React
.
createRef
();
listAllSpaces
().
then
((
spaces
)
=>
this
.
setState
({
spaces
:
spaces
}));
...
...
@@ -144,6 +143,11 @@ export class Editor extends React.PureComponent<any, stateTypes> {
console
.
log
(
"
Starting to load new graph ...
"
);
console
.
log
(
data
);
// Allow a single phase of force simulation when loading the graph.
if
(
this
.
rendererRef
.
current
!=
undefined
)
{
this
.
rendererRef
.
current
.
allowForceSimulation
();
}
// Create graph
const
graph
=
new
DynamicGraph
();
graph
.
fromSerializedObject
(
data
);
...
...
@@ -225,14 +229,11 @@ export class Editor extends React.PureComponent<any, stateTypes> {
<
SpaceManager
/>
{
this
.
state
.
graph
&&
(
<
div
id
=
"content"
>
<
div
id
=
"force-graph-renderer"
ref
=
{
this
.
graphContainer
}
>
<
div
id
=
"force-graph-renderer"
>
<
SelectLayer
nodes
=
{
this
.
state
.
graph
.
nodes
}
screen2GraphCoords
=
{
this
.
rendererRef
this
.
rendererRef
.
current
?
this
.
rendererRef
.
current
.
screen2GraphCoords
:
undefined
...
...
This diff is collapsed.
Click to expand it.
src/editor/renderer.tsx
+
5
−
0
View file @
68af56a1
...
...
@@ -49,6 +49,7 @@ export class GraphRenderer2D extends React.PureComponent<
this
.
screen2GraphCoords
=
this
.
screen2GraphCoords
.
bind
(
this
);
this
.
handleNodeCanvasObject
=
this
.
handleNodeCanvasObject
.
bind
(
this
);
this
.
handleLinkCanvasObject
=
this
.
handleLinkCanvasObject
.
bind
(
this
);
this
.
allowForceSimulation
=
this
.
allowForceSimulation
.
bind
(
this
);
document
.
addEventListener
(
"
keydown
"
,
(
e
)
=>
{
this
.
keys
[
e
.
key
]
=
true
;
...
...
@@ -71,6 +72,10 @@ export class GraphRenderer2D extends React.PureComponent<
this
.
forceGraph
=
React
.
createRef
();
}
public
allowForceSimulation
()
{
this
.
warmupTicks
=
this
.
defaultWarmupTicks
;
}
/**
* Deletes all nodes currently selected. Handles store points accordingly of the number of deleted nodes.
*/
...
...
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