|
1011 | 1011 | brushSize: 1, |
1012 | 1012 | eraserSize: 2, |
1013 | 1013 | brushColor: [1, 1, 1], |
1014 | | - maxUndos: 15, |
| 1014 | + allowUndo: false, |
| 1015 | + maxUndos: 10, |
1015 | 1016 | mode: 'paint' |
1016 | 1017 | }; |
1017 | 1018 | }); |
|
1154 | 1155 | Object.defineProperty(exports, "__esModule", { value: true }); |
1155 | 1156 | exports._doStroke = exports._endStroke = exports._startStroke = void 0; |
1156 | 1157 | function _startStroke(coords, identifier) { |
1157 | | - if (this._currentSnapshotIndex < this._snapshots.length - 1) |
| 1158 | + if (this._currentSnapshotIndex < this._snapshots.length - 1 && this._maxSnapshots > 0) |
1158 | 1159 | this._snapshots.splice(this._currentSnapshotIndex + 1); // Delete all redo snapshots |
1159 | 1160 | this._plot.apply(// Delete all redo snapshots |
1160 | 1161 | this, coords); |
|
1164 | 1165 | function _endStroke(endCoords, identifier) { |
1165 | 1166 | this._plot.apply(this, endCoords); |
1166 | 1167 | this._lastCoords.delete(identifier); |
1167 | | - this._snapshots[++this._currentSnapshotIndex] = this.getData(); |
| 1168 | + if (this._maxSnapshots > 0) |
| 1169 | + this._snapshots[++this._currentSnapshotIndex] = this.getData(); |
1168 | 1170 | if (this._snapshots.length > this._maxSnapshots) { |
1169 | 1171 | this._snapshots.shift(); |
1170 | 1172 | this._currentSnapshotIndex--; |
|
1339 | 1341 | _this.brushSize = options.brushSize; |
1340 | 1342 | _this.brushColor = options.brushColor; |
1341 | 1343 | _this.eraserSize = options.eraserSize; |
1342 | | - _this._maxSnapshots = Math.max(options.maxUndos, 1); |
| 1344 | + _this._maxSnapshots = options.allowUndo ? Math.max(options.maxUndos + 1, 0) : 0; |
1343 | 1345 | _this.mode = options.mode; |
1344 | 1346 | // *****DEFAULTS***** |
1345 | 1347 | _this._initializeKernels(); |
|
0 commit comments