Fix transform constraint trying to transform to shape bounds.

Diffs=
bd9a2e12a Fix transform constraint trying to transform to shape bounds. (#5727)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This commit is contained in:
luigi-rosso
2023-08-01 18:44:45 +00:00
parent 79836aea3d
commit b6fbd4fe9e
6 changed files with 17 additions and 6 deletions

View File

@ -1 +1 @@
1192a06b993dcff0ced88aa8bcd0a0cf58fdafe1
bd9a2e12a6ce10f5122f696b23c7a7db9d21e0a3

View File

@ -1,6 +1,10 @@
## 0.11.10
- Fixes an issue with the origin on the TransformConstraint affecting non-text objects.
## 0.11.9
- Fix [335](https://github.com/rive-app/rive-flutter/issues/335) _debugDisposed issue
- Fix [335](https://github.com/rive-app/rive-flutter/issues/335) \_debugDisposed issue
- Fix issue showing text when the default font is not available at `assets/fonts/Inter-Regular.ttf` ([338](https://github.com/rive-app/rive-flutter/issues/338)). We will set first valid font we encounter in a rive file as default font instead.
## 0.11.8

View File

@ -12,7 +12,7 @@ export 'package:rive/src/generated/constraints/transform_constraint_base.dart';
/// constrained component in world or local space.
class TransformConstraint extends TransformConstraintBase {
Mat2D get targetTransform {
var bounds = target!.localBounds;
var bounds = target!.constraintBounds;
var local = Mat2D.fromTranslation(
Vec2D.fromValues(
bounds.left + bounds.width * originX,

View File

@ -188,6 +188,7 @@ class Text extends TextBase with TextStyleContainer {
_syncRuns();
}
Mat2D get originTransform => Mat2D.multiply(
Mat2D(),
worldTransform,
@ -209,6 +210,9 @@ class Text extends TextBase with TextStyleContainer {
height: _bounds.height,
);
@override
AABB get constraintBounds => localBounds;
void forEachGlyph(
bool Function(LineRunGlyph, double, double, GlyphLine) callback) {
var lines = _lines;

View File

@ -209,4 +209,7 @@ abstract class TransformComponent extends TransformComponentBase {
}
AABB get localBounds => AABB.collapsed(Vec2D());
/// Bounds to use for constraining to object space.
AABB get constraintBounds => AABB.collapsed(Vec2D());
}

View File

@ -1,5 +1,5 @@
name: rive
version: 0.11.9
version: 0.11.10
homepage: https://rive.app
description: Rive 2 Flutter Runtime. This package provides runtime functionality for playing back and interacting with animations built with the Rive editor available at https://rive.app.
repository: https://github.com/rive-app/rive-flutter
@ -10,8 +10,8 @@ topics:
- widgets
- widget
environment:
sdk: ">=2.14.0 <4.0.0"
flutter: ">=2.5.0"
sdk: '>=2.14.0 <4.0.0'
flutter: '>=2.5.0'
dependencies:
collection: ^1.15.0
flutter: