diff --git a/src/engine/stage-layering.js b/src/engine/stage-layering.js index 8ab0c48ae..5dd68c661 100644 --- a/src/engine/stage-layering.js +++ b/src/engine/stage-layering.js @@ -3,54 +3,25 @@ class StageLayering { return 'background'; } - static get EXTENSION_LAYER () { - return 'extensions'; + static get VIDEO_LAYER () { + return 'video'; + } + + static get PEN_LAYER () { + return 'pen'; } static get SPRITE_LAYER () { return 'sprite'; } - static get BUBBLE_LAYER () { - return 'bubble'; - } - - static get BACKGROUND_ORDER () { - return 0; - } - - // Video should be in the back of the extension group - static get VIDEO_ORDER () { - return 0; - } - - static get PEN_ORDER () { - return 1; - } - // Order of layer groups relative to each other, - // and ordering style of each - // Currently extensions are the only layer group - // that have an explicit ordering (e.g. video must be behind pen). - // All other groups here are ordered based on when they get added static get LAYER_GROUPS () { return [ - { - group: StageLayering.BACKGROUND_LAYER, - // This is a weird use case for a layer group ordering style, - // because in the main Scratch use case, this group has only one item, - // so ordering of the items doesn't really matter. - explicitOrdering: false - - }, - { - group: StageLayering.EXTENSION_LAYER, - explicitOrdering: true - }, - { - group: StageLayering.SPRITE_LAYER, - explicitOrdering: false - } + StageLayering.BACKGROUND_LAYER, + StageLayering.VIDEO_LAYER, + StageLayering.PEN_LAYER, + StageLayering.SPRITE_LAYER ]; } } diff --git a/src/extensions/scratch3_pen/index.js b/src/extensions/scratch3_pen/index.js index 4e5399770..d9e736063 100644 --- a/src/extensions/scratch3_pen/index.js +++ b/src/extensions/scratch3_pen/index.js @@ -128,8 +128,7 @@ class Scratch3PenBlocks { _getPenLayerID () { if (this._penSkinId < 0 && this.runtime.renderer) { this._penSkinId = this.runtime.renderer.createPenSkin(); - this._penDrawableId = this.runtime.renderer.createDrawable( - StageLayering.EXTENSION_LAYER, StageLayering.PEN_ORDER); + this._penDrawableId = this.runtime.renderer.createDrawable(StageLayering.PEN_LAYER); this.runtime.renderer.updateDrawableProperties(this._penDrawableId, {skinId: this._penSkinId}); } return this._penSkinId; diff --git a/src/io/video.js b/src/io/video.js index 26ec30630..b2920e9aa 100644 --- a/src/io/video.js +++ b/src/io/video.js @@ -146,7 +146,7 @@ class Video { if (this._skinId === -1 && this._skin === null && this._drawable === -1) { this._skinId = renderer.createPenSkin(); this._skin = renderer._allSkins[this._skinId]; - this._drawable = renderer.createDrawable(StageLayering.EXTENSION_LAYER, StageLayering.VIDEO_ORDER); + this._drawable = renderer.createDrawable(StageLayering.VIDEO_LAYER); renderer.updateDrawableProperties(this._drawable, { skinId: this._skinId }); diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index b5f9c71f6..34e803cfc 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -847,11 +847,9 @@ class RenderedTarget extends Target { */ goBehindOther (other) { if (this.renderer) { - 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); + const otherLayer = this.renderer.setDrawableOrder( + other.drawableID, 0, StageLayering.SPRITE_LAYER, true); + this.renderer.setDrawableOrder(this.drawableID, otherLayer, StageLayering.SPRITE_LAYER); } }