Skip to content

Commit 0b8d857

Browse files
committed
onundo, onredo
1 parent f6f7f15 commit 0b8d857

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

croquis.js

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ function Croquis(imageDataList, properties) {
2222
'onup': [],
2323
'ontick': [],
2424
'onchange': [],
25+
'onundo': [],
26+
'onredo': [],
2527
'ontool': [],
2628
'oncanvassize': [],
2729
'onlayeradd': [],
@@ -128,6 +130,7 @@ function Croquis(imageDataList, properties) {
128130
while (undoTransaction.length)
129131
redoTransaction.push(undoTransaction.pop()());
130132
redoStack.push(redoTransaction);
133+
dispatchEvent('onundo');
131134
};
132135
self.redo = function () {
133136
if (pushToTransaction)
@@ -143,6 +146,7 @@ function Croquis(imageDataList, properties) {
143146
while (redoTransaction.length)
144147
undoTransaction.push(redoTransaction.pop()());
145148
undoStack.push(undoTransaction);
149+
dispatchEvent('onredo');
146150
};
147151
function pushLayerMetadataUndo(index) {
148152
index = index || layerIndex;

0 commit comments

Comments
 (0)