UNPKG

@robotlegsjs/pixi

Version:
42 lines 1.67 kB
"use strict"; // ------------------------------------------------------------------------------ // Copyright (c) 2017-present, RobotlegsJS. All Rights Reserved. // // NOTICE: You are permitted to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // ------------------------------------------------------------------------------ Object.defineProperty(exports, "__esModule", { value: true }); exports.contains = void 0; /** * Patch Container class to add implementation of contains method. */ var pixi_js_1 = require("pixi.js"); /** * Determines whether the specified child object is a child of the Container instance or the instance itself. * The search includes the entire display list including this Container instance. * Grandchildren, great-grandchildren, and so on each return true. * * @param child The child object to test. * * @return true if the child object is a child of the Container or the Container itself; otherwise false. * * @see {@link https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContainer.html#contains()} */ function contains(container, child) { var found = false; if (container === child || container.children.indexOf(child) >= 0) { found = true; } else { for (var _i = 0, _a = container.children; _i < _a.length; _i++) { var c = _a[_i]; if (c instanceof pixi_js_1.Container && contains(c, child)) { found = true; break; } } } return found; } exports.contains = contains; //# sourceMappingURL=contains.js.map