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

Method moveDown

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

* Move the child in the group one step backward (z depth). * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved

(child)

Source from the content-addressed store, hash-verified

900 * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
901 */
902 moveDown(child) {
903 const childIndex = this.getChildIndex(child);
904 if (childIndex >= 0 && childIndex + 1 < this.getChildren().length) {
905 // note : we use an inverted loop
906 this.swapChildren(child, this.getChildAt(childIndex + 1));
907 // mark the container as dirty
908 this.isDirty = true;
909 }
910 }
911
912 /**
913 * Move the specified child to the top(z depth).

Callers 1

container.spec.jsFile · 0.80

Calls 4

getChildIndexMethod · 0.95
getChildrenMethod · 0.95
swapChildrenMethod · 0.95
getChildAtMethod · 0.95

Tested by

no test coverage detected