Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add methods for batch updating sibling indices for issue #17644 . #18135

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

coldcloude
Copy link

@coldcloude coldcloude commented Jan 7, 2025

Re: #17644

Changelog

  • Add methods for batch updating sibling indices.

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Copy link

github-actions bot commented Jan 7, 2025

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -24539,8 +24539,24 @@
          * @zh 新的兄弟节点索引值。如果该值等于 -1 或者大于等于兄弟节点数量,那么该节点将会被插到兄弟节点数组的尾部。
          */
         setSiblingIndex(index: number): void;
         /**
+         * @en Set the children's sibling index in a batch.
+         * @zh 批量设置当前节点子节点的sibling index。
+         * @param indices @en New sibling indeces for all children.
+         * @zh 所有子节点的新索引值。
+         * @return True if indices set, false if parameter not valid.
+         */
+        setChildrenIndices(indices: number[]): boolean;
+        /**
+         * @en Sort the children according to the comparator.
+         * @zh 根据比较器对当前节点的子节点全排序
+         * @param comp @en A comparator that return negtive value / 0 value / positive value
+         * when the first node is less than / equals to / greater than the second node.
+         * @zh 一个比较器,当第一个节点小于/等于/大于第二个节点时,返回负值/0值/正值。
+         */
+        sortChildren(comp: (n1: Node, n2: Node) => number): void;
+        /**
          * @en Walk though the sub children tree of the current node.
          * Each node, including the current node, in the sub tree will be visited two times,
          * before all children and after all children.
          * This function call is not recursive, it's based on stack.

add parameter check for setChildrenIndices

fix code format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant