Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 39 additions & 17 deletions js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -1588,18 +1588,20 @@ class Activity {
if (this.blockscale < BLOCKSCALES.length - 1) {
this.resizeDebounce = true;
this.blockscale += 1;
this.clearCache();
await this.blocks.setBlockScale(BLOCKSCALES[this.blockscale]);
this.blocks.checkBounds();
this.refreshCanvas();
}

const that = this;
that.resizeDebounce = false;
await this.setSmallerLargerStatus();

setTimeout(() => {
that.resizeDebounce = false;
}, 200);
}
if (typeof(this.activity)!="undefined"){
await this.activity.refreshCanvas();
}
document.getElementById("hideContents").click();

await this.setSmallerLargerStatus();
await this.stage.update();
};

/**
Expand All @@ -1625,19 +1627,21 @@ class Activity {
if (this.blockscale > 0) {
this.resizeDebounce = true;
this.blockscale -= 1;
this.clearCache();
await this.blocks.setBlockScale(BLOCKSCALES[this.blockscale]);
this.blocks.checkBounds();
this.refreshCanvas();
}

const that = this;
that.resizeDebounce = false;
setTimeout(() => {
that.resizeDebounce = false;
}, 200);

}

await this.setSmallerLargerStatus();
if (typeof(this.activity)!="undefined"){
await this.activity.refreshCanvas();
}
document.getElementById("hideContents").click();
await this.stage.update();
};

/*
Expand Down Expand Up @@ -3639,6 +3643,22 @@ class Activity {
// TODO: plugin support
};

/*
* Clears cache for all blocks
*/
this.clearCache = () => {
this.blocks.blockList.forEach(block => {
if (block.container) {
block.container.uncache();
block.container.cache();
}
if (block.bitmap) {
block.bitmap.uncache();
block.bitmap.cache();
}
});
};

/*
* Updates all canvas elements
*/
Expand All @@ -3647,15 +3667,17 @@ class Activity {
return;
}

this.blockRefreshCanvas = true;

this.blockRefreshCanvas = true;
// Force stage clear and update
this.stage.clear();
this.stage.update();
this.update = true;

const that = this;
setTimeout(() => {
that.blockRefreshCanvas = false;
that.stage.update();
}, 5);

this.stage.update(event);
this.update = true;
};

/*
Expand Down
Loading