@leapfrog/interactive-canvas 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,6 @@ import { AbstractInteractiveCanvas } from "./abstract-interactive-canvas";
|
|
|
2
2
|
export declare class InteractiveCanvas extends AbstractInteractiveCanvas {
|
|
3
3
|
protected devicePixelRatio: number;
|
|
4
4
|
private readonly undoStack;
|
|
5
|
-
private undoSub;
|
|
6
5
|
constructor(elementId: string, devicePixelRatio: number);
|
|
7
6
|
/**
|
|
8
7
|
* @override
|
|
@@ -3649,11 +3649,8 @@ var UndoStack = /** @class */ (function () {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
UndoStack.prototype.push = function (state) {
|
|
3651
3651
|
var prev = this.stack[this.stack.length - 1];
|
|
3652
|
-
if (isEqual(prev, state))
|
|
3653
|
-
console.error("Ignoring identical undo state"); //todo
|
|
3652
|
+
if (isEqual(prev, state))
|
|
3654
3653
|
return;
|
|
3655
|
-
}
|
|
3656
|
-
console.error("Undo Registered"); //todo
|
|
3657
3654
|
this.stack.push(state);
|
|
3658
3655
|
if (this.stack.length > this.size)
|
|
3659
3656
|
this.stack.splice(0, 1);
|
|
@@ -3699,6 +3696,12 @@ var InteractiveCanvas = /** @class */ (function (_super) {
|
|
|
3699
3696
|
state = this.undoStack.pop();
|
|
3700
3697
|
if (!state)
|
|
3701
3698
|
return [2 /*return*/];
|
|
3699
|
+
//If the undo state matches the current state, pop again as the undo will have no effect
|
|
3700
|
+
if (isEqual(state, this.save())) {
|
|
3701
|
+
state = this.undoStack.pop();
|
|
3702
|
+
if (!state)
|
|
3703
|
+
return [2 /*return*/];
|
|
3704
|
+
}
|
|
3702
3705
|
return [4 /*yield*/, this.load(state)];
|
|
3703
3706
|
case 1:
|
|
3704
3707
|
_a.sent();
|
|
@@ -3649,11 +3649,8 @@ var UndoStack = /** @class */ (function () {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
UndoStack.prototype.push = function (state) {
|
|
3651
3651
|
var prev = this.stack[this.stack.length - 1];
|
|
3652
|
-
if (_.isEqual(prev, state))
|
|
3653
|
-
console.error("Ignoring identical undo state"); //todo
|
|
3652
|
+
if (_.isEqual(prev, state))
|
|
3654
3653
|
return;
|
|
3655
|
-
}
|
|
3656
|
-
console.error("Undo Registered"); //todo
|
|
3657
3654
|
this.stack.push(state);
|
|
3658
3655
|
if (this.stack.length > this.size)
|
|
3659
3656
|
this.stack.splice(0, 1);
|
|
@@ -3699,6 +3696,12 @@ var InteractiveCanvas = /** @class */ (function (_super) {
|
|
|
3699
3696
|
state = this.undoStack.pop();
|
|
3700
3697
|
if (!state)
|
|
3701
3698
|
return [2 /*return*/];
|
|
3699
|
+
//If the undo state matches the current state, pop again as the undo will have no effect
|
|
3700
|
+
if (_.isEqual(state, this.save())) {
|
|
3701
|
+
state = this.undoStack.pop();
|
|
3702
|
+
if (!state)
|
|
3703
|
+
return [2 /*return*/];
|
|
3704
|
+
}
|
|
3702
3705
|
return [4 /*yield*/, this.load(state)];
|
|
3703
3706
|
case 1:
|
|
3704
3707
|
_a.sent();
|