Skip to content
Snippets Groups Projects
Commit f161b127 authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Prepared editor main component for the new data structure

parent 0db15dca
No related branches found
No related tags found
No related merge requests found
......@@ -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() {
......
......@@ -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.
......@@ -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."
);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment