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 2 commits 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,32 @@
          * @zh 新的兄弟节点索引值。如果该值等于 -1 或者大于等于兄弟节点数量,那么该节点将会被插到兄弟节点数组的尾部。
          */
         setSiblingIndex(index: number): void;
         /**
+         * @en Batch update the children's sibling index to the index of in children, and
+         * returns the sibling indices of the updated children.
+         * @zh 批量更新当前节点子节点的sibling index为其在children数组中的下标,返回更新的节点下标。
+         * @return @en The sibling indices of the updated children.
+         * @zh 已更新的子节点的sibling index。
+         */
+        protected fixSiblingChanges(): number[];
+        /**
+         * @en Emit children's sibling indices change events.
+         * @zh 批量并触发节点sibling index更新事件。
+         * @param changed @en The sibling indices of the updated children.
+         * @zh 已更新的子节点的sibling index。
+         */
+        protected emitSiblingIndicesChanges(changed: number[]): void;
+        /**
+         * @en Sort children and batch update sibling indices and emit update events.
+         * @zh 对当前节点的子节点排序,并批量更新sibling index及触发变更事件
+         * @param sort @en A sort function to sort the nodes.
+         * @zh 用于将节点排序的方法。
+         * @return @en The sibling indices of the updated children.
+         * @zh 已更新的子节点的sibling index。
+         */
+        sortChildren(sort: (ns: Node[]) => void): number[];
+        /**
          * @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