mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-23 23:46:42 +08:00
Fixes for nested state machines.
This commit is contained in:
@ -67,11 +67,19 @@ class HitTester implements PathInterface {
|
||||
int winding = 1;
|
||||
if (y0 > y1) {
|
||||
winding = -1;
|
||||
|
||||
// Swap our two points (is there a swap utility?)
|
||||
double tmp = y0;
|
||||
// ignore: parameter_assignments
|
||||
y0 = y1;
|
||||
// ignore: parameter_assignments
|
||||
y1 = tmp;
|
||||
|
||||
tmp = x0;
|
||||
// ignore: parameter_assignments
|
||||
x0 = x1;
|
||||
// ignore: parameter_assignments
|
||||
x1 = tmp;
|
||||
}
|
||||
// now we're monotonic in Y: y0 <= y1
|
||||
if (y1 <= 0 || y0 >= _height) {
|
||||
@ -184,7 +192,7 @@ class HitTester implements PathInterface {
|
||||
// ... At^3 + Bt^2 + Ct + D
|
||||
//
|
||||
final aX = (x3 - _prevX) + 3 * (x1 - x2);
|
||||
// final bX = 3 * ((x2 - x1) + (_prevX - x1));
|
||||
final bX = 3 * ((x2 - x1) + (_prevX - x1));
|
||||
final cX = 3 * (x1 - _prevX);
|
||||
final dX = _prevX;
|
||||
|
||||
@ -198,7 +206,7 @@ class HitTester implements PathInterface {
|
||||
double py = _prevY;
|
||||
for (int i = 1; i < count - 1; ++i) {
|
||||
// Horner's method for evaluating the simple polynomial
|
||||
final nx = ((aX * t + aX) * t + cX) * t + dX;
|
||||
final nx = ((aX * t + bX) * t + cX) * t + dX;
|
||||
final ny = ((aY * t + bY) * t + cY) * t + dY;
|
||||
_clipLine(px, py, nx, ny);
|
||||
px = nx;
|
||||
|
@ -14,6 +14,11 @@ abstract class NestedAnimation<T extends Animation>
|
||||
|
||||
|
||||
bool get isEnabled;
|
||||
|
||||
/// Returns true when the NestedAnimation needs to keep advancing. Returning
|
||||
/// false doesn't guarantee another advance won't be called, it just means
|
||||
/// that it's no longer necessary to call advance again as the reesults will
|
||||
/// be the same.
|
||||
bool advance(double elapsedSeconds, MountedArtboard mountedArtboard);
|
||||
|
||||
@override
|
||||
|
@ -19,7 +19,6 @@ export 'package:rive/src/generated/nested_artboard_base.dart';
|
||||
/// the [NestedArtboard] component.
|
||||
abstract class MountedArtboard {
|
||||
void draw(Canvas canvas);
|
||||
Mat2D get originTransform;
|
||||
Mat2D get worldTransform;
|
||||
set worldTransform(Mat2D value);
|
||||
AABB get bounds;
|
||||
|
Reference in New Issue
Block a user