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 unary operator #3604

Merged
3 commits merged into from
Dec 8, 2020
Merged

Add unary operator #3604

3 commits merged into from
Dec 8, 2020

Conversation

arcadiogarcia
Copy link
Member

Fixes

Fixes #3523

Introduce UnaryOperator to animation expressions, a new type of operation that only expects one operator, to fix the issue where the ! operator failed because it expected 2 operators like the other (non-unary) operators.

PR Type

What kind of change does this PR introduce?

Bugfix

What is the current behavior?

With the current version of the toolkit, code like

    var visual = Windows.UI.Xaml.Hosting.ElementCompositionPreview.GetElementVisual(this);
    var a = !(visual.GetReference().Offset.X > 10);
    visual.StartAnimation("Offset.Y", ExpressionFunctions.Conditional(a, 1,2));

will throw this exception
Can't have an operator that doesn't have 2 exactly params

What is the new behavior?

After these changes, no exception is thrown and the correct animation expression is generated

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • 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 Dec 4, 2020

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 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Dec 4, 2020
Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

@ghost
Copy link

ghost commented Dec 8, 2020

Hello @Sergio0694!

Because this pull request has the auto merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit e0a5d28 into CommunityToolkit:master Dec 8, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
animations 🏮 auto merge ⚡ bug 🐛 An unexpected issue that highlights incorrect behavior extensions ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The ! operator for ExpressionBuilder BooleanNodes always throws
3 participants