Skip to content

Commit 1d909c5

Browse files
author
HarshKhandeparkar
committed
v0.5.3
1 parent 9208c8c commit 1d909c5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

dist/gpujs-real-renderer-browser.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,8 @@
10111011
brushSize: 1,
10121012
eraserSize: 2,
10131013
brushColor: [1, 1, 1],
1014-
maxUndos: 15,
1014+
allowUndo: false,
1015+
maxUndos: 10,
10151016
mode: 'paint'
10161017
};
10171018
});
@@ -1154,7 +1155,7 @@
11541155
Object.defineProperty(exports, "__esModule", { value: true });
11551156
exports._doStroke = exports._endStroke = exports._startStroke = void 0;
11561157
function _startStroke(coords, identifier) {
1157-
if (this._currentSnapshotIndex < this._snapshots.length - 1)
1158+
if (this._currentSnapshotIndex < this._snapshots.length - 1 && this._maxSnapshots > 0)
11581159
this._snapshots.splice(this._currentSnapshotIndex + 1); // Delete all redo snapshots
11591160
this._plot.apply(// Delete all redo snapshots
11601161
this, coords);
@@ -1164,7 +1165,8 @@
11641165
function _endStroke(endCoords, identifier) {
11651166
this._plot.apply(this, endCoords);
11661167
this._lastCoords.delete(identifier);
1167-
this._snapshots[++this._currentSnapshotIndex] = this.getData();
1168+
if (this._maxSnapshots > 0)
1169+
this._snapshots[++this._currentSnapshotIndex] = this.getData();
11681170
if (this._snapshots.length > this._maxSnapshots) {
11691171
this._snapshots.shift();
11701172
this._currentSnapshotIndex--;
@@ -1339,7 +1341,7 @@
13391341
_this.brushSize = options.brushSize;
13401342
_this.brushColor = options.brushColor;
13411343
_this.eraserSize = options.eraserSize;
1342-
_this._maxSnapshots = Math.max(options.maxUndos, 1);
1344+
_this._maxSnapshots = options.allowUndo ? Math.max(options.maxUndos + 1, 0) : 0;
13431345
_this.mode = options.mode;
13441346
// *****DEFAULTS*****
13451347
_this._initializeKernels();

0 commit comments

Comments
 (0)