MCPcopy Create free account
hub / github.com/melonjs/melonJS / constructor

Method constructor

packages/melonjs/src/renderable/container.js:153–256  ·  view source on GitHub ↗

* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property) * @param {number} [y=0] - position of the container (accessible via the inherited pos.y property) * @param {number} [width=Infinity] - width of the container. Defaults to Infinity (no intrinsic size

(x = 0, y = 0, width = Infinity, height = Infinity, root = false)

Source from the content-addressed store, hash-verified

151 * @ignore root
152 */
153 constructor(x = 0, y = 0, width = Infinity, height = Infinity, root = false) {
154 // call the super constructor
155 super(x, y, width, height);
156
157 /**
158 * keep track of pending sort
159 * @ignore
160 */
161 this.pendingSort = null;
162
163 /**
164 * whether the container is the root of the scene
165 * @type {boolean}
166 * @default false
167 */
168 this.root = root;
169
170 /**
171 * The array of children of this container.
172 * @ignore
173 */
174 this.children = undefined;
175
176 /**
177 * The property of the child object that should be used to sort on this container
178 * value : "x", "y", "z"
179 * @type {string}
180 * @default "z"
181 */
182 this._sortOn = "z";
183 this._comparator = this._sortZ;
184
185 /**
186 * Specify if the children list should be automatically sorted when adding a new child
187 * @type {boolean}
188 * @default true
189 */
190 this.autoSort = true;
191
192 /**
193 * Specify if the children z index should automatically be managed by the parent container
194 * @type {boolean}
195 * @default true
196 */
197 this.autoDepth = true;
198
199 /**
200 * Specify if the container draw operation should clip its children to its own bounds
201 * @type {boolean}
202 * @default false
203 */
204 this.clipping = false;
205
206 /**
207 * a callback to be extended, triggered after a child has been added or removed
208 * @param {number} index - added or removed child index
209 */
210 this.onChildChange = function () {

Callers

nothing calls this directly

Calls 4

updateBoundsMethod · 0.95
onFunction · 0.90
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected