(event)
| 336 | this.rewind_index = 0 // how many events back into the history we've rewound to. (current state is just after event at index 'length - this.rewind_index - 1') |
| 337 | } |
| 338 | push(event) { |
| 339 | // probably add something here eventually to save state every x events |
| 340 | if (this.rewind_index != 0) { |
| 341 | this.events = this.events.slice(0, 0 - this.rewind_index) |
| 342 | this.rewind_index = 0 |
| 343 | } |
| 344 | var snapshot_frequency = 20 // (every x edits, take a snapshot of the current drawing state, for faster rewinding) |
| 345 | if (this.events.length > 0 && this.events.length % snapshot_frequency == 0) { |
| 346 | event.snapshot = this.editor.layers.drawing.ctx.getImageData(0, 0, this.editor.width, this.editor.height) |
| 347 | } |
| 348 | this.events.push(event) |
| 349 | } |
| 350 | pushAction(action) { |
| 351 | this.push({ |
| 352 | type: "action", |
no outgoing calls
no test coverage detected