Skip to content

Commit eee60c4

Browse files
committed
Fixes zoom for multiple blocks
1 parent 21a4552 commit eee60c4

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

js/activity.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,20 +1588,18 @@ class Activity {
15881588
if (this.blockscale < BLOCKSCALES.length - 1) {
15891589
this.resizeDebounce = true;
15901590
this.blockscale += 1;
1591+
this.clearCache();
15911592
await this.blocks.setBlockScale(BLOCKSCALES[this.blockscale]);
1592-
this.refreshCanvas();
15931593
this.blocks.checkBounds();
1594+
this.refreshCanvas();
15941595
}
15951596

15961597
const that = this;
15971598
that.resizeDebounce = false;
1598-
await this.setSmallerLargerStatus();
1599-
16001599
}
1601-
if (typeof(this.activity)!="undefined"){
1602-
await this.activity.refreshCanvas();
1603-
}
1604-
document.getElementById("hideContents").click();
1600+
1601+
await this.setSmallerLargerStatus();
1602+
await this.stage.update();
16051603
};
16061604

16071605
/**
@@ -1627,9 +1625,10 @@ class Activity {
16271625
if (this.blockscale > 0) {
16281626
this.resizeDebounce = true;
16291627
this.blockscale -= 1;
1628+
this.clearCache();
16301629
await this.blocks.setBlockScale(BLOCKSCALES[this.blockscale]);
1631-
this.refreshCanvas();
16321630
this.blocks.checkBounds();
1631+
this.refreshCanvas();
16331632
}
16341633

16351634
const that = this;
@@ -1638,10 +1637,7 @@ class Activity {
16381637
}
16391638

16401639
await this.setSmallerLargerStatus();
1641-
if (typeof(this.activity)!="undefined"){
1642-
await this.activity.refreshCanvas();
1643-
}
1644-
document.getElementById("hideContents").click();
1640+
await this.stage.update();
16451641
};
16461642

16471643
/*
@@ -3643,6 +3639,17 @@ class Activity {
36433639
// TODO: plugin support
36443640
};
36453641

3642+
/*
3643+
* Clears cache for all blocks
3644+
*/
3645+
this.clearCache = () => {
3646+
this.blocks.blockList.forEach(block => {
3647+
if (block.container) {
3648+
block.container.uncache();
3649+
}
3650+
});
3651+
};
3652+
36463653
/*
36473654
* Updates all canvas elements
36483655
*/

0 commit comments

Comments
 (0)