-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
anim-controller: fix transitions sorting / minimize code duplication #4057
Conversation
* @returns {number} A number indicating the relative position. | ||
* @ignore | ||
*/ | ||
export const cmpPriority = (a, b) => a.priority - b.priority; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does cmpPriority
need to be exported? Should it be internal to this module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just like to keep things public for potential reuse, but technically it can be private (since its not being used elsewhere)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make this not exported, and we can merge it in for the next release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this and hide cmpPriority in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. However, @mvaligursky and @ellthompson should approve before merging since this affects both animation and graphics subsystems. |
I looks great, but I would not mind some simple test of this in the test/core folder |
A sort function doesn't act on true/false, so this never sorted anything (copy/paste test for F12/DevTools):
Result:
[10, 50, 1, 2, 100, 3]
(its fixable by replacing<
with-
)And then priority sorting is used in multiple places, so this PR reduces the code size/repetition of the same sorting function by just reusing functions (imo saving time and hopefully less bugs)
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.