Skip to content

Commit e7d661e

Browse files
author
Mario Schuettel
committed
Merge branch 'dev' of https://github.com/lxxxvi/three.js into dev
2 parents 08c17a9 + d71c0e2 commit e7d661e

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

editor/js/Cmd.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ Cmd.prototype.fromJSON = function ( json ) {
3636
this.type = json.type;
3737
this.id = json.id;
3838
this.name = json.name;
39-
this.json = json;
4039

4140
};

editor/js/History.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ History.prototype = {
7070
cmd.id = ++this.idCounter;
7171

7272
}
73-
cmd.name = optionalName !== undefined ? optionalName : cmd.name;
73+
cmd.name = ( optionalName !== undefined ) ? optionalName : cmd.name;
7474
cmd.execute();
7575
cmd.inMemory = true;
76-
cmd.json = cmd.toJSON(); // serialize cmd immediately after execution
76+
cmd.json = cmd.toJSON(); // serialize the cmd immediately after execution and append the json to the cmd
7777

7878
this.lastCmdTime = new Date();
7979

@@ -164,8 +164,7 @@ History.prototype = {
164164

165165
for ( var i = 0 ; i < this.undos.length; i++ ) {
166166

167-
var cmd = this.undos[ i ];
168-
undos.push( cmd.json );
167+
undos.push( this.undos[ i ].json );
169168

170169
}
171170

@@ -177,8 +176,7 @@ History.prototype = {
177176

178177
for ( var i = 0 ; i < this.redos.length; i++ ) {
179178

180-
var cmd = this.redos[ i ];
181-
redos.push( cmd.json );
179+
redos.push( this.redos[ i ].json );
182180

183181
}
184182

@@ -198,7 +196,7 @@ History.prototype = {
198196
var cmd = new window[ cmdJSON.type ](); // creates a new object of type "json.type"
199197
cmd.json = cmdJSON;
200198
this.undos.push( cmd );
201-
this.idCounter = cmdJSON.id > this.idCounter ? cmdJSON.id : this.idCounter; // set last used idCounter
199+
this.idCounter = ( cmdJSON.id > this.idCounter ) ? cmdJSON.id : this.idCounter; // set last used idCounter
202200

203201
}
204202

@@ -208,11 +206,12 @@ History.prototype = {
208206
var cmd = new window[ cmdJSON.type ](); // creates a new object of type "json.type"
209207
cmd.json = cmdJSON;
210208
this.redos.push( cmd );
211-
this.idCounter = cmdJSON.id > this.idCounter ? cmdJSON.id : this.idCounter; // set last used idCounter
209+
this.idCounter = ( cmdJSON.id > this.idCounter ) ? cmdJSON.id : this.idCounter; // set last used idCounter
212210

213211
}
214212

215-
this.editor.signals.historyChanged.dispatch();
213+
// Select the last executed undo-command
214+
this.editor.signals.historyChanged.dispatch( this.undos[ this.undos.length - 1 ] );
216215

217216
},
218217

test/unit/editor/TestSerialization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module( "Serialization" );
22

3-
test( "Test Serialization (simple)", function() {
3+
test( "Test Serialization", function() {
44

55
// setup
66
var editor = new Editor();

0 commit comments

Comments
 (0)