123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- /**
- * Created by Daniel on 21.07.15.
- */
- CmdToggleBoolean = function ( object, attributeName ) {
- Cmd.call( this );
- this.type = 'CmdToggleBoolean';
- this.object = object;
- this.attributeName = attributeName;
- this.objectUuid = object !== undefined ? object.uuid : undefined;
- };
- CmdToggleBoolean.prototype = {
- execute: function () {
- this.object[ this.attributeName ] = !this.object[ this.attributeName ];
- this.editor.signals.objectChanged.dispatch( this.object );
- },
- undo: function () {
- this.object[ this.attributeName ] = !this.object[ this.attributeName ];
- this.editor.signals.objectChanged.dispatch( this.object );
- },
- toJSON: function () {
- var output = Cmd.prototype.toJSON.call( this );
- output.objectUuid = this.objectUuid;
- output.attributeName = this.attributeName;
- return output;
- },
- fromJSON: function ( json ) {
- Cmd.prototype.fromJSON.call( this, json );
- this.object = this.editor.objectByUuid( json.objectUuid );
- this.objectUuid = json.objectUuid;
- this.attributeName = json.attributeName;
- }
- };
|