-
-
Notifications
You must be signed in to change notification settings - Fork 891
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: MoveAlongPathEffect should maintain initial angle of the component #2835
Conversation
MoveALongPath oriented should keep initial angle (issue flame-engine#2833)
Fixing a typo in the test
@@ -85,7 +85,8 @@ class MoveAlongPathEffect extends MoveEffect { | |||
'An `oriented` MoveAlongPathEffect cannot be applied to a target that ' | |||
'does not support rotation', | |||
); | |||
(target as AngleProvider).angle = _lastAngle = -start.angle; | |||
_lastAngle = -start.angle; | |||
(target as AngleProvider).angle += -start.angle; |
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 don't think this is correct, since followAngle
is true, it should be following the angle of the effect, and not be affected by what its current angle is?
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.
Well the problem is with the preexisting angle of the component, in the current release this is always initialized to the tangent. It should consider the angle of the component itself. Please have a look to the test code in the issue #2833.
(Example) I want a Rect to be 45 degrees turned (rhombus) and then use the vertex as the head to follow the path, currently the Rect is always following the path using one of the sides. In the example linked I used a Polygon with 3 vertex.
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.
Then you should be using nativeAngle
to set that, not angle
.
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.
Sounds good, we can close this as intended behaviour
Implement the new logic for nativeAngle
Update tests
Add missing import
@spydon Coding style preference
instead of
|
Removing import as now included in the component
New line to stay in the 80 columns line lenght
I think it is even clearer to read it if you separate them and just do: final _target = target;
(_target as AngleProvider).angle = -start.angle;
if(_target is PositionComponent) {
_target.angle += _target.nativeAngle;
} |
trailing coma
coding style
no need of local variable
Fixing indentation
removing _
trailing coma
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, only a variable name change needed I think!
Description
See #2833
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Related Issues
Closes #2833