File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -198,20 +198,20 @@ class Canvas extends React.Component {
198
198
}
199
199
200
200
modifyCanvas ( nameOfFunction , finishedCb ) {
201
- // before we modify the canvas, let's save the current state
202
201
let { steps, changeHistory } = this . state ;
203
202
changeHistory = changeHistory . slice ( )
204
203
changeHistory . push ( { steps : Array . from ( steps ) } ) ;
205
204
// okay, now we call the requested function from Toolbox
206
205
this . setState ( { finishCB : finishedCb } , ( ) => {
207
206
this . state . functions [ nameOfFunction ] ( ) . then ( state => {
207
+ // before we modify the canvas, let's save the current state
208
208
if ( this . state . finishCB ) {
209
209
this . state . finishCB ( ) ;
210
210
}
211
211
if ( state ) {
212
212
// now we can apply the new changeHistory
213
213
this . setState ( {
214
- changeHistory : changeHistory ,
214
+ changeHistory,
215
215
redoHistory : [ ] ,
216
216
...state } , ( ) => {
217
217
this . checkLevelIntegrity ( ) ;
@@ -546,6 +546,7 @@ class Canvas extends React.Component {
546
546
setStep = { s => this . setState ( { currentStep : s , interaction : s === this . state . steps . length - 1 } ) }
547
547
state = { this . state }
548
548
setState = { ( changeHistory , newSteps , redoHistory ) => {
549
+ this . cancelSelection ( ) ;
549
550
this . setState ( {
550
551
changeHistory : changeHistory ,
551
552
steps : newSteps ,
You can’t perform that action at this time.
0 commit comments