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

feat: Helpers for whether a PositionComponent is flipped. #1700

Merged
merged 4 commits into from
Jun 6, 2022

Conversation

spydon
Copy link
Member

@spydon spydon commented Jun 5, 2022

Description

Helpers that just check if the scale is negative so that the user can now whether the component has been flipped.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples.

Breaking Change

  • No, this is not a breaking change.

Related Issues

Closes #1336

component.flipHorizontallyAroundCenter();
expect(component.isFlippedHorizontally, isTrue);
component.flipHorizontallyAroundCenter();
expect(component.isFlippedHorizontally, isFalse);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what happens if "flip" with one version and "unflip" with the other

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that it will move the component from its original position (which I think makes sense), if I remember correctly this is documented somewhere, maybe on the dartdocs.

Copy link
Member

@luanpotter luanpotter left a comment

Choose a reason for hiding this comment

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

Nice!

/// Whether it is currently flipped horizontally.
bool get isFlippedHorizontally => transform.scale.x.isNegative;

/// Whether it is currently flipped horizontally.
Copy link
Contributor

Choose a reason for hiding this comment

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

Vertically

@st-pasha
Copy link
Contributor

st-pasha commented Jun 5, 2022

Related issue #1336

@spydon spydon enabled auto-merge (squash) June 6, 2022 09:09
@spydon spydon merged commit cf67147 into main Jun 6, 2022
@spydon spydon deleted the spydon.flip-getters branch June 6, 2022 09:16
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.

Add helpers to know if component is flipped or not
3 participants