* Synchronous variant of Container#sort. Sorts immediately * — no defer — using the current `_comparator`. Intended for * per-frame callers that need the order to be valid for the very * next render (e.g. `Camera3d` refreshing the `"depth"` sort after * the camera has moved, where wa
(recursive)
| 991 | * @param {boolean} [recursive=false] - recursively sort sub-containers |
| 992 | */ |
| 993 | sortNow(recursive) { |
| 994 | if (this._sortOn === "depth") { |
| 995 | captureDepthCamera(); |
| 996 | captureDepthOffset(this); |
| 997 | } |
| 998 | const children = this.getChildren(); |
| 999 | if (children.length > 1) { |
| 1000 | children.sort(this._comparator); |
| 1001 | this.isDirty = true; |
| 1002 | } |
| 1003 | if (recursive === true) { |
| 1004 | for (let i = 0; i < children.length; i++) { |
| 1005 | const c = children[i]; |
| 1006 | if (c instanceof Container) { |
| 1007 | c.sortNow(true); |
| 1008 | } |
| 1009 | } |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | /** |
| 1014 | * @ignore |
no test coverage detected