mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Bubbles should be in the same layer as sprites. Other cleanup.
This commit is contained in:
parent
64c8484066
commit
38875bc65c
3 changed files with 11 additions and 12 deletions
|
@ -92,7 +92,7 @@ class Scratch3LooksBlocks {
|
||||||
_onTargetWillExit (target) {
|
_onTargetWillExit (target) {
|
||||||
const bubbleState = this._getBubbleState(target);
|
const bubbleState = this._getBubbleState(target);
|
||||||
if (bubbleState.drawableId && bubbleState.skinId) {
|
if (bubbleState.drawableId && bubbleState.skinId) {
|
||||||
this.runtime.renderer.destroyDrawable(bubbleState.drawableId, StageLayering.BUBBLE_LAYER);
|
this.runtime.renderer.destroyDrawable(bubbleState.drawableId, StageLayering.SPRITE_LAYER);
|
||||||
this.runtime.renderer.destroySkin(bubbleState.skinId);
|
this.runtime.renderer.destroySkin(bubbleState.skinId);
|
||||||
bubbleState.drawableId = null;
|
bubbleState.drawableId = null;
|
||||||
bubbleState.skinId = null;
|
bubbleState.skinId = null;
|
||||||
|
@ -196,7 +196,7 @@ class Scratch3LooksBlocks {
|
||||||
bubbleState.onSpriteRight = false;
|
bubbleState.onSpriteRight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.BUBBLE_LAYER);
|
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.SPRITE_LAYER);
|
||||||
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
|
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
|
||||||
|
|
||||||
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
||||||
|
|
|
@ -50,12 +50,7 @@ class StageLayering {
|
||||||
{
|
{
|
||||||
group: StageLayering.SPRITE_LAYER,
|
group: StageLayering.SPRITE_LAYER,
|
||||||
explicitOrdering: false
|
explicitOrdering: false
|
||||||
},
|
|
||||||
{
|
|
||||||
group: StageLayering.BUBBLE_LAYER,
|
|
||||||
explicitOrdering: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -847,9 +847,11 @@ class RenderedTarget extends Target {
|
||||||
*/
|
*/
|
||||||
goBehindOther (other) {
|
goBehindOther (other) {
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
const otherLayer = this.renderer.setDrawableOrder(
|
this.renderer.positionDrawableRelativeToOther(
|
||||||
other.drawableID, 0, StageLayering.SPRITE_LAYER, true);
|
this.drawableID, other.drawableID, -1, StageLayering.SPRITE_LAYER);
|
||||||
this.renderer.setDrawableOrder(this.drawableID, otherLayer, StageLayering.SPRITE_LAYER);
|
// const otherLayer = this.renderer.setDrawableOrder(
|
||||||
|
// other.drawableID, 0, StageLayering.SPRITE_LAYER, true);
|
||||||
|
// this.renderer.setDrawableOrder(this.drawableID, otherLayer, StageLayering.SPRITE_LAYER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,7 +920,7 @@ class RenderedTarget extends Target {
|
||||||
newClone.effects = JSON.parse(JSON.stringify(this.effects));
|
newClone.effects = JSON.parse(JSON.stringify(this.effects));
|
||||||
newClone.variables = JSON.parse(JSON.stringify(this.variables));
|
newClone.variables = JSON.parse(JSON.stringify(this.variables));
|
||||||
newClone.lists = JSON.parse(JSON.stringify(this.lists));
|
newClone.lists = JSON.parse(JSON.stringify(this.lists));
|
||||||
newClone.initDrawable(StageLayering.SPRITE_LAYER); // TODO should sprite clones be in their own layer group?
|
newClone.initDrawable(StageLayering.SPRITE_LAYER);
|
||||||
newClone.updateAllDrawableProperties();
|
newClone.updateAllDrawableProperties();
|
||||||
// Place behind the current target.
|
// Place behind the current target.
|
||||||
newClone.goBehindOther(this);
|
newClone.goBehindOther(this);
|
||||||
|
@ -1055,7 +1057,9 @@ class RenderedTarget extends Target {
|
||||||
this.runtime.stopForTarget(this);
|
this.runtime.stopForTarget(this);
|
||||||
this.sprite.removeClone(this);
|
this.sprite.removeClone(this);
|
||||||
if (this.renderer && this.drawableID !== null) {
|
if (this.renderer && this.drawableID !== null) {
|
||||||
this.renderer.destroyDrawable(this.drawableID, StageLayering.SPRITE_LAYER);
|
this.renderer.destroyDrawable(this.drawableID, this.isStage ?
|
||||||
|
StageLayering.BACKGROUND_LAYER :
|
||||||
|
StageLayering.SPRITE_LAYER);
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this);
|
this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this);
|
||||||
this.runtime.requestRedraw();
|
this.runtime.requestRedraw();
|
||||||
|
|
Loading…
Reference in a new issue