From e526619e968d45e7e8b5cbd79002d0f3522dad78 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 15 Nov 2022 09:21:45 +0100 Subject: [PATCH] [flutter] Fix y-offset calculation in layouting. --- spine-flutter/example/lib/main.dart | 2 +- spine-flutter/lib/spine_widget.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-flutter/example/lib/main.dart b/spine-flutter/example/lib/main.dart index 302b4f8e3..2c1b36555 100644 --- a/spine-flutter/example/lib/main.dart +++ b/spine-flutter/example/lib/main.dart @@ -55,7 +55,7 @@ class SimpleAnimation extends StatelessWidget { return Scaffold( appBar: AppBar(title: const Text('Spineboy')), - body: SpineWidget.asset("assets/skeleton.json", "assets/skeleton.atlas", controller, alignment: Alignment.centerLeft, fit: BoxFit.none), + body: SpineWidget.asset("assets/skeleton.json", "assets/skeleton.atlas", controller, alignment: Alignment.topLeft, fit: BoxFit.cover), // body: SpineWidget.asset("assets/spineboy-pro.skel", "assets/spineboy.atlas", controller, alignment: Alignment.bottomLeft) // body: SpineWidget.file("/Users/badlogic/workspaces/spine-runtimes/examples/spineboy/export/spineboy-pro.skel", "/Users/badlogic/workspaces/spine-runtimes/examples/spineboy/export/spineboy.atlas", controller), // body: const SpineWidget.http("https://marioslab.io/dump/spineboy/spineboy-pro.json", "https://marioslab.io/dump/spineboy/spineboy.atlas"), diff --git a/spine-flutter/lib/spine_widget.dart b/spine-flutter/lib/spine_widget.dart index 87e995b49..f453042cd 100644 --- a/spine-flutter/lib/spine_widget.dart +++ b/spine-flutter/lib/spine_widget.dart @@ -345,7 +345,7 @@ class _SpineRenderObject extends RenderBox { void _setCanvasTransform(Canvas canvas, Offset offset) { final double x = -_bounds.x - _bounds.width / 2.0 - (_alignment.x * _bounds.width / 2.0); - final double y = -_bounds.y - _bounds.height / 2.0 + (_alignment.y * _bounds.height / 2.0); + final double y = -_bounds.y - _bounds.height / 2.0 - (_alignment.y * _bounds.height / 2.0); double scaleX = 1.0, scaleY = 1.0; switch (_fit) {