From 3ad4b2adb3aa1d7f738f678035bf3fcf4264c92e Mon Sep 17 00:00:00 2001 From: Allison Ryan Date: Thu, 28 Apr 2022 10:08:59 -0500 Subject: [PATCH] chore: use internal positioning --- .../lib/src/components/chrome_dino.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/pinball_components/lib/src/components/chrome_dino.dart b/packages/pinball_components/lib/src/components/chrome_dino.dart index cff6a3f3..4cf954e1 100644 --- a/packages/pinball_components/lib/src/components/chrome_dino.dart +++ b/packages/pinball_components/lib/src/components/chrome_dino.dart @@ -26,8 +26,7 @@ class ChromeDino extends BodyComponent with InitialPosition { /// Anchors the [ChromeDino] to the [RevoluteJoint] that controls its arc /// motion. Future<_ChromeDinoJoint> _anchorToJoint() async { - final anchor = _ChromeDinoAnchor() - ..initialPosition = initialPosition + Vector2(9, -4); + final anchor = _ChromeDinoAnchor(); await add(anchor); final jointDef = _ChromeDinoAnchorRevoluteJointDef( @@ -86,7 +85,12 @@ class ChromeDino extends BodyComponent with InitialPosition { } class _ChromeDinoAnchor extends JointAnchor { - _ChromeDinoAnchor(); + _ChromeDinoAnchor() { + initialPosition = Vector2( + ChromeDino.size.x / 2 + 9, + ChromeDino.size.y / 2 - 4, + ); + } // TODO(allisonryan0002): if these aren't moved when fixing the rendering, see // if the joint can be created in onMount to resolve render syncing.