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
f161b127
Commit
f161b127
authored
2 years ago
by
Matthias Konitzny
Browse files
Options
Downloads
Patches
Plain Diff
Prepared editor main component for the new data structure
parent
0db15dca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/common/graph/node.ts
+7
-15
7 additions, 15 deletions
src/common/graph/node.ts
src/common/history.ts
+3
-2
3 additions, 2 deletions
src/common/history.ts
src/editor/editor.tsx
+148
-214
148 additions, 214 deletions
src/editor/editor.tsx
src/editor/graph.ts
+5
-1
5 additions, 1 deletion
src/editor/graph.ts
with
163 additions
and
232 deletions
src/common/graph/node.ts
+
7
−
15
View file @
f161b127
...
...
@@ -52,10 +52,13 @@ export interface GraphNode extends NodeProperties {
index
?:
number
;
x
?:
number
;
y
?:
number
;
z
?:
number
;
vx
?:
number
;
vy
?:
number
;
vz
?:
number
;
fx
?:
number
;
fy
?:
number
;
fz
?:
number
;
}
export
class
Node
...
...
@@ -77,10 +80,13 @@ export class Node
public
index
?:
number
;
public
x
?:
number
;
public
y
?:
number
;
public
z
?:
number
;
public
vx
?:
number
;
public
vy
?:
number
;
public
vz
?:
number
;
public
fx
?:
number
;
public
fy
?:
number
;
public
fz
?:
number
;
constructor
(
graph
?:
Graph
)
{
super
(
0
,
graph
);
...
...
@@ -89,12 +95,7 @@ export class Node
}
public
setType
(
typeId
:
number
)
{
// Is it even different?
if
(
this
.
type
.
id
===
typeId
)
{
return
;
}
const
newType
=
this
.
graph
.
getType
(
typeId
);
const
newType
=
this
.
graph
.
nameToObjectGroup
.
get
(
typeId
);
// TODO
// Exists?
if
(
newType
===
undefined
)
{
...
...
@@ -102,15 +103,6 @@ export class Node
}
this
.
type
=
newType
;
// Store change
this
.
graph
.
storeCurrentData
(
"
Set type [
"
+
newType
.
toString
()
+
"
] for [
"
+
this
.
toString
()
+
"
]
"
);
}
public
delete
()
{
...
...
This diff is collapsed.
Click to expand it.
src/common/history.ts
+
3
−
2
View file @
f161b127
...
...
@@ -14,13 +14,14 @@ export class History<HistoryDataType> {
constructor
(
data
:
SerializableItem
<
unknown
,
HistoryDataType
>
,
maxCheckpoints
=
20
maxCheckpoints
=
20
,
initialMessage
=
"
New History
"
)
{
this
.
data
=
data
;
this
.
maxCheckpoints
=
maxCheckpoints
;
this
.
checkpoints
=
[];
this
.
currentCheckpoint
=
-
1
;
this
.
checkpoint
(
"
New History
"
);
this
.
checkpoint
(
initialMessage
);
}
checkpoint
(
description
:
string
)
{
...
...
This diff is collapsed.
Click to expand it.
src/editor/editor.tsx
+
148
−
214
View file @
f161b127
This diff is collapsed.
Click to expand it.
src/editor/graph.ts
+
5
−
1
View file @
f161b127
...
...
@@ -14,7 +14,11 @@ export class DynamicGraph extends Common.Graph {
constructor
(
data
?:
GraphContent
)
{
super
(
data
);
this
.
onChangeCallbacks
=
[];
this
.
history
=
new
History
<
SimGraphData
>
(
this
);
this
.
history
=
new
History
<
SimGraphData
>
(
this
,
20
,
"
Created new graph.
"
);
}
/**
...
...
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