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
fix(animations): implement getPosition in browser animation builder #28264
fix(animations): implement getPosition in browser animation builder #28264
Conversation
153ae06
to
3c3600e
Compare
3c3600e
to
73dcd72
Compare
5748528
to
93b7b76
Compare
@@ -89,7 +89,7 @@ export class RendererAnimationPlayer implements AnimationPlayer { | |||
|
|||
setPosition(p: number): void { this._command('setPosition', p); } | |||
|
|||
getPosition(): number { return 0; } | |||
getPosition(): number { return this._renderer.engine.players[+this.id].getPosition(); } |
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'm not sure how reliable it is to use the id as the player index. Let me know if there's a better way.
93b7b76
to
5bcee93
Compare
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.
this is a quality a PR
Could we have a tests and have it rebased on latest head? |
026ea42
to
8afd132
Compare
It looks like you have already rebased and there is not an existing test suite for this class. Would you like me to make a new one in a new |
Yes, please, we need a test. |
presubmit Looks good. |
ef4ff3b
to
7ab987d
Compare
d6e5813
to
2c00466
Compare
@literalpie ICYMI I left an additional comment in the already resolved conversation: #28264 (comment) |
e42348b
to
e6a4f31
Compare
e6a4f31
to
790d8bf
Compare
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.
Thanks for making the changes. I don't see any issues with this in its current state so happy to approve.
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.
reviewed-for: global-approvers
790d8bf
to
7954c8d
Compare
PR accidently closed. :-( and now unable to re-open. Moved content to #39983 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Type
What kind of change does this PR introduce?
What is the current behavior?
calling
player.getPosition
always returns 0Issue Number: #23785 #18891
What is the new behavior?
calling
player.getPosition
will return the position of the animation that is complete, as a percent (decimal) value (this is to match thesetPosition
functionality although it does not match the docs).If
player.getPosition
is called on a player with a group of animations, the returned value will be the position of the longest animation (including delays)Does this PR introduce a breaking change?
Other information
As mentioned above, the functionality does not match the documentation (which says get/set position is measured in milliseconds). I opted to have the functionality match
setPosition
for consistency.I considered changing the documentation, but unfortunately, it is a interface implemented by
CssKeyframesPlayer
, which does match the documentation. Let me know if I should either include the documentation change or the functionality.I did not include tests because
AnimationGroupPlayer
does not have any tests.