110 lines
4.6 KiB
JavaScript
110 lines
4.6 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$layers$RenderLayer = function(global, require, module, exports) {
|
|
var warn = require("module$node_modules$pixi_DOT_js$lib$utils$logging$warn");
|
|
global = require("module$node_modules$pixi_DOT_js$lib$scene$container$Container");
|
|
"use strict";
|
|
const node_modules$pixi_DOT_js$lib$scene$layers$RenderLayer$classdecl$var45 = class extends global.Container {
|
|
constructor(options = {}) {
|
|
options = {...node_modules$pixi_DOT_js$lib$scene$layers$RenderLayer$classdecl$var45.defaultOptions, ...options};
|
|
super();
|
|
this.renderLayerChildren = [];
|
|
this.sortableChildren = options.sortableChildren;
|
|
this.sortFunction = options.sortFunction;
|
|
}
|
|
attach(...children) {
|
|
for (let i = 0; i < children.length; i++) {
|
|
var child = children[i];
|
|
if (child.parentRenderLayer) {
|
|
if (child.parentRenderLayer === this) {
|
|
continue;
|
|
}
|
|
child.parentRenderLayer.detach(child);
|
|
}
|
|
this.renderLayerChildren.push(child);
|
|
child.parentRenderLayer = this;
|
|
if (child = this.renderGroup || this.parentRenderGroup) {
|
|
child.structureDidChange = !0;
|
|
}
|
|
}
|
|
return children[0];
|
|
}
|
|
detach(...children) {
|
|
for (let i = 0; i < children.length; i++) {
|
|
var child = children[i];
|
|
const index = this.renderLayerChildren.indexOf(child);
|
|
-1 !== index && this.renderLayerChildren.splice(index, 1);
|
|
child.parentRenderLayer = null;
|
|
if (child = this.renderGroup || this.parentRenderGroup) {
|
|
child.structureDidChange = !0;
|
|
}
|
|
}
|
|
return children[0];
|
|
}
|
|
detachAll() {
|
|
const layerChildren = this.renderLayerChildren;
|
|
for (let i = 0; i < layerChildren.length; i++) {
|
|
layerChildren[i].parentRenderLayer = null;
|
|
}
|
|
this.renderLayerChildren.length = 0;
|
|
}
|
|
collectRenderables(instructionSet, renderer, _currentLayer) {
|
|
_currentLayer = this.renderLayerChildren;
|
|
const length = _currentLayer.length;
|
|
this.sortableChildren && this.sortRenderLayerChildren();
|
|
for (let i = 0; i < length; i++) {
|
|
_currentLayer[i].parent || warn.warn("Container must be added to both layer and scene graph. Layers only handle render order - the scene graph is required for transforms (addChild)", _currentLayer[i]), _currentLayer[i].collectRenderables(instructionSet, renderer, this);
|
|
}
|
|
}
|
|
sortRenderLayerChildren() {
|
|
this.renderLayerChildren.sort(this.sortFunction);
|
|
}
|
|
_getGlobalBoundsRecursive(factorRenderLayers, bounds, _currentLayer) {
|
|
if (factorRenderLayers) {
|
|
for (factorRenderLayers = this.renderLayerChildren, _currentLayer = 0; _currentLayer < factorRenderLayers.length; _currentLayer++) {
|
|
factorRenderLayers[_currentLayer]._getGlobalBoundsRecursive(!0, bounds, this);
|
|
}
|
|
}
|
|
}
|
|
getFastGlobalBounds(factorRenderLayers, bounds) {
|
|
return super.getFastGlobalBounds(factorRenderLayers, bounds);
|
|
}
|
|
addChild(..._children) {
|
|
throw Error("RenderLayer.addChild() is not available. Please use RenderLayer.attach()");
|
|
}
|
|
removeChild(..._children) {
|
|
throw Error("RenderLayer.removeChild() is not available. Please use RenderLayer.detach()");
|
|
}
|
|
removeChildren(_beginIndex, _endIndex) {
|
|
throw Error("RenderLayer.removeChildren() is not available. Please use RenderLayer.detach()");
|
|
}
|
|
removeChildAt(_index) {
|
|
throw Error("RenderLayer.removeChildAt() is not available");
|
|
}
|
|
getChildAt(_index) {
|
|
throw Error("RenderLayer.getChildAt() is not available");
|
|
}
|
|
setChildIndex(_child, _index) {
|
|
throw Error("RenderLayer.setChildIndex() is not available");
|
|
}
|
|
getChildIndex(_child) {
|
|
throw Error("RenderLayer.getChildIndex() is not available");
|
|
}
|
|
addChildAt(_child, _index) {
|
|
throw Error("RenderLayer.addChildAt() is not available");
|
|
}
|
|
swapChildren(_child, _child2) {
|
|
throw Error("RenderLayer.swapChildren() is not available");
|
|
}
|
|
reparentChild(..._child) {
|
|
throw Error("RenderLayer.reparentChild() is not available with the render layer");
|
|
}
|
|
reparentChildAt(_child, _index) {
|
|
throw Error("RenderLayer.reparentChildAt() is not available with the render layer");
|
|
}
|
|
};
|
|
global = node_modules$pixi_DOT_js$lib$scene$layers$RenderLayer$classdecl$var45;
|
|
global.defaultOptions = {sortableChildren:!1, sortFunction:(a, b) => a.zIndex - b.zIndex};
|
|
exports.RenderLayer = global;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$layers$RenderLayer.js.map
|