diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index fee2ecd30..268ae9329 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -92,7 +92,7 @@ class Scratch3LooksBlocks { _onTargetWillExit (target) { const bubbleState = this._getBubbleState(target); 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); bubbleState.drawableId = null; bubbleState.skinId = null; @@ -196,7 +196,7 @@ class Scratch3LooksBlocks { 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]); this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, { diff --git a/src/engine/stage-layering.js b/src/engine/stage-layering.js index 1e7912c04..8ab0c48ae 100644 --- a/src/engine/stage-layering.js +++ b/src/engine/stage-layering.js @@ -50,12 +50,7 @@ class StageLayering { { group: StageLayering.SPRITE_LAYER, explicitOrdering: false - }, - { - group: StageLayering.BUBBLE_LAYER, - explicitOrdering: false } - ]; } } diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index eb3c2234d..b5f9c71f6 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -847,9 +847,11 @@ class RenderedTarget extends Target { */ goBehindOther (other) { if (this.renderer) { - const otherLayer = this.renderer.setDrawableOrder( - other.drawableID, 0, StageLayering.SPRITE_LAYER, true); - this.renderer.setDrawableOrder(this.drawableID, otherLayer, StageLayering.SPRITE_LAYER); + this.renderer.positionDrawableRelativeToOther( + this.drawableID, other.drawableID, -1, 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.variables = JSON.parse(JSON.stringify(this.variables)); 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(); // Place behind the current target. newClone.goBehindOther(this); @@ -1055,7 +1057,9 @@ class RenderedTarget extends Target { this.runtime.stopForTarget(this); this.sprite.removeClone(this); 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) { this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw();