diff --git a/editor/docs/Implementing additional commands for undo-redo.md b/editor/docs/Implementing additional commands for undo-redo.md index 4f7fae4f5186a511dabedd982e545095dceb4636..316e8df1f0d6db88032cdee4b04ec84e9d7af742 100644 --- a/editor/docs/Implementing additional commands for undo-redo.md +++ b/editor/docs/Implementing additional commands for undo-redo.md @@ -28,7 +28,7 @@ Every command needs a constructor. In the constructor CmdXXX = function () { - Cmd.call( this ); // Required: Call default constructor + Command.call( this ); // Required: Call default constructor this.type = 'CmdXXX'; // Required: has to match the object-name! this.name = 'Set/Do/Update XXX'; // Required: description of the command, used in Sidebar.History @@ -62,7 +62,7 @@ CmdXXX.prototype = { toJSON: function () { - var output = Cmd.prototype.toJSON.call( this ); // Required: Call 'toJSON'-method of prototype 'Cmd' + var output = Command.prototype.toJSON.call( this ); // Required: Call 'toJSON'-method of prototype 'Command' // TODO: serialize all the necessary information as part of 'output' (JSON-format) // so that it can be restored in 'fromJSON' @@ -73,7 +73,7 @@ CmdXXX.prototype = { fromJSON: function ( json ) { - Cmd.prototype.fromJSON.call( this, json ); // Required: Call 'fromJSON'-method of prototype 'Cmd' + Command.prototype.fromJSON.call( this, json ); // Required: Call 'fromJSON'-method of prototype 'Command' // TODO: restore command from json @@ -99,7 +99,7 @@ editor.execute( new CmdXXX() ); Some commands are also **updatable**. By default a command is not updatable. Making a command updatable means that you have to implement a fifth function 'update' as part of the prototype. In it only the 'new' state gets updated while the old one stays the same. -Here as an example is the update-function of **CmdSetColor**: +Here as an example is the update-function of **SetColorCommand**: ```javascript update: function ( cmd ) { @@ -112,15 +112,15 @@ update: function ( cmd ) { #### List of updatable commands -- CmdSetColor -- CmdSetGeometry -- CmdSetMaterialColor -- CmdSetMaterialValue -- CmdSetPosition -- CmdSetRotation -- CmdSetScale -- CmdSetValue -- CmdSetScriptValue +- SetColorCommand +- SetGeometryCommand +- SetMaterialColorCommand +- SetMaterialValueCommand +- SetPositionCommand +- SetRotationCommand +- SetScaleCommand +- SetValueCommand +- SetScriptValueCommand The idea behind 'updatable commands' is that two commands of the same type which occur within a short period of time should be merged into one. diff --git a/editor/docs/Writing unit tests for undo-redo commands.md b/editor/docs/Writing unit tests for undo-redo commands.md index 5fcae29bd58b19eaaaf4f99567aaf91e41477f18..ad3937d7b3e9e231a345cf419e826a479beadf66 100644 --- a/editor/docs/Writing unit tests for undo-redo commands.md +++ b/editor/docs/Writing unit tests for undo-redo commands.md @@ -26,8 +26,8 @@ Within the file, go to the `` and include the new ```javascript // //... - - + + // add this line //... ``` @@ -39,7 +39,7 @@ Next, in the same file, go to `` and include the test fi ```javascript // //... - + // add this line //... @@ -68,7 +68,7 @@ test("Test CmdXXX (Undo and Redo)", function() { // var perspectiveCamera = aPerspectiveCamera( 'Name your perspectiveCamera' ); // in most cases you'll need to add the object to work with - editor.execute( new CmdAddObject( box ) ); + editor.execute( new AddObjectCommand( box ) ); // your test begins here... diff --git a/editor/index.html b/editor/index.html index 53f7907779cd82eb44f5dd4b77a1523a3e862901..37f8bfa5de202c4ad36d8a6486361067bf8bbe48 100644 --- a/editor/index.html +++ b/editor/index.html @@ -124,27 +124,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + +