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

Method moveUp

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

* Move the child in the group one step forward (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

886 * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
887 */
888 moveUp(child) {
889 const childIndex = this.getChildIndex(child);
890 if (childIndex - 1 >= 0) {
891 // note : we use an inverted loop
892 this.swapChildren(child, this.getChildAt(childIndex - 1));
893 // mark the container as dirty
894 this.isDirty = true;
895 }
896 }
897
898 /**
899 * Move the child in the group one step backward (z depth).

Callers 1

container.spec.jsFile · 0.80

Calls 3

getChildIndexMethod · 0.95
swapChildrenMethod · 0.95
getChildAtMethod · 0.95

Tested by

no test coverage detected