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 Evaluate() method to expression nodes #4559

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arcadiogarcia
Copy link
Member

@arcadiogarcia arcadiogarcia commented May 16, 2022

Fixes

This PR contributes the Evaluate() method proposed in #4481 to evaluate the current value of any ExpresionNode at any given time (see discussion for rationale/usecases)

PR Type

What kind of change does this PR introduce?

  • Feature

What is the current behavior?

Currently consumers of the library can't get the current or hypothetical value of a ExpressionNode without running the animation, and even if they run it is hard to guarantee that the desired result is always returned (the user needs to read the value from the composition api at the right time, which is not always easy, and I've observed cases where the values are stale and haven't been updated by the composer yet).

What is the new behavior?

This PR adds a method that evaluates it by traversing the expression tree.
This doesn't alter the current logic/behavior, and the code introduced will only be executed if the consumer calls the Evaluate() method manually.

Also added a small test that verifies that a couple expression nodes evaluate to the right result.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • Tested code with current supported SDKs
  • New component
    • Pull Request has been submitted to the documentation repository instructions. Link:
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
    • If control, added to Visual Studio Design project
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

@ghost
Copy link

ghost commented May 16, 2022

Thanks arcadiogarcia for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker and azchohfi May 16, 2022 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants