diff --git a/.rive_head b/.rive_head index 5fe4eb6..9c8e55f 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -7acff50d4632d9e88b1474d6f23b3b1c8d7f7334 +a4fb3dc7decb50f6965e21ebced098cbdc35883d diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f17e2..036de61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Joysticks! - Bumping to latest rive_common with some changes to AABB math api. +- Bumping Dart SDK requirements. ## 0.10.4 diff --git a/analysis_options.yaml b/analysis_options.yaml index b2419a1..d0ada4b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -78,7 +78,6 @@ linter: - prefer_const_literals_to_create_immutables - prefer_constructors_over_static_methods - prefer_contains - - prefer_equal_for_default_values - prefer_final_fields - prefer_final_in_for_each - prefer_foreach diff --git a/lib/src/generated/joystick_base.dart b/lib/src/generated/joystick_base.dart index f25dfb2..c0dd77c 100644 --- a/lib/src/generated/joystick_base.dart +++ b/lib/src/generated/joystick_base.dart @@ -79,6 +79,30 @@ abstract class JoystickBase extends Component { void xIdChanged(int from, int to); + /// -------------------------------------------------------------------------- + /// XInvert field with key 310. + static const bool xInvertInitialValue = false; + bool _xInvert = xInvertInitialValue; + static const int xInvertPropertyKey = 310; + + /// Whether to invert the application of the x axis. + bool get xInvert => _xInvert; + + /// Change the [_xInvert] field value. + /// [xInvertChanged] will be invoked only if the field's value has changed. + set xInvert(bool value) { + if (_xInvert == value) { + return; + } + bool from = _xInvert; + _xInvert = value; + if (hasValidated) { + xInvertChanged(from, value); + } + } + + void xInvertChanged(bool from, bool to); + /// -------------------------------------------------------------------------- /// YId field with key 302. static const int yIdInitialValue = -1; @@ -104,12 +128,38 @@ abstract class JoystickBase extends Component { void yIdChanged(int from, int to); + /// -------------------------------------------------------------------------- + /// YInvert field with key 311. + static const bool yInvertInitialValue = false; + bool _yInvert = yInvertInitialValue; + static const int yInvertPropertyKey = 311; + + /// Whether to invert the application of the y axis. + bool get yInvert => _yInvert; + + /// Change the [_yInvert] field value. + /// [yInvertChanged] will be invoked only if the field's value has changed. + set yInvert(bool value) { + if (_yInvert == value) { + return; + } + bool from = _yInvert; + _yInvert = value; + if (hasValidated) { + yInvertChanged(from, value); + } + } + + void yInvertChanged(bool from, bool to); + @override void copy(covariant JoystickBase source) { super.copy(source); _x = source._x; _y = source._y; _xId = source._xId; + _xInvert = source._xInvert; _yId = source._yId; + _yInvert = source._yInvert; } } diff --git a/lib/src/generated/rive_core_context.dart b/lib/src/generated/rive_core_context.dart index ddb675c..9b2cffe 100644 --- a/lib/src/generated/rive_core_context.dart +++ b/lib/src/generated/rive_core_context.dart @@ -1139,11 +1139,21 @@ class RiveCoreContext { object.xId = value; } break; + case JoystickBase.xInvertPropertyKey: + if (object is JoystickBase && value is bool) { + object.xInvert = value; + } + break; case JoystickBase.yIdPropertyKey: if (object is JoystickBase && value is int) { object.yId = value; } break; + case JoystickBase.yInvertPropertyKey: + if (object is JoystickBase && value is bool) { + object.yInvert = value; + } + break; case BoneBase.lengthPropertyKey: if (object is BoneBase && value is double) { object.length = value; @@ -1514,6 +1524,8 @@ class RiveCoreContext { case ClippingShapeBase.isVisiblePropertyKey: case CustomPropertyBooleanBase.propertyValuePropertyKey: case ArtboardBase.clipPropertyKey: + case JoystickBase.xInvertPropertyKey: + case JoystickBase.yInvertPropertyKey: return boolType; case KeyFrameColorBase.valuePropertyKey: case SolidColorBase.colorValuePropertyKey: @@ -1929,6 +1941,10 @@ class RiveCoreContext { return (object as CustomPropertyBooleanBase).propertyValue; case ArtboardBase.clipPropertyKey: return (object as ArtboardBase).clip; + case JoystickBase.xInvertPropertyKey: + return (object as JoystickBase).xInvert; + case JoystickBase.yInvertPropertyKey: + return (object as JoystickBase).yInvert; } return false; } @@ -2927,6 +2943,16 @@ class RiveCoreContext { object.clip = value; } break; + case JoystickBase.xInvertPropertyKey: + if (object is JoystickBase) { + object.xInvert = value; + } + break; + case JoystickBase.yInvertPropertyKey: + if (object is JoystickBase) { + object.yInvert = value; + } + break; } } diff --git a/lib/src/rive_core/animation/keyed_object.dart b/lib/src/rive_core/animation/keyed_object.dart index 4892565..9780944 100644 --- a/lib/src/rive_core/animation/keyed_object.dart +++ b/lib/src/rive_core/animation/keyed_object.dart @@ -85,7 +85,4 @@ class KeyedObject extends KeyedObjectBase { return super.import(stack); } - - @override - List> get referees => keyedProperties.toList(); } diff --git a/lib/src/rive_core/animation/keyed_property.dart b/lib/src/rive_core/animation/keyed_property.dart index 1b1479b..d6b5005 100644 --- a/lib/src/rive_core/animation/keyed_property.dart +++ b/lib/src/rive_core/animation/keyed_property.dart @@ -194,7 +194,4 @@ class KeyedProperty extends KeyedPropertyBase return super.import(stack); } - - @override - List> get referees => keyframes.toList(); } diff --git a/lib/src/rive_core/animation/keyframe.dart b/lib/src/rive_core/animation/keyframe.dart index 84225fb..fe42036 100644 --- a/lib/src/rive_core/animation/keyframe.dart +++ b/lib/src/rive_core/animation/keyframe.dart @@ -102,7 +102,4 @@ abstract class KeyFrame extends KeyFrameBase @override String toString() => '${super.toString()} id: ($id)'; - - @override - List> get referees => []; } diff --git a/lib/src/rive_core/component.dart b/lib/src/rive_core/component.dart index 0d047d1..344b860 100644 --- a/lib/src/rive_core/component.dart +++ b/lib/src/rive_core/component.dart @@ -181,6 +181,7 @@ abstract class Component extends ComponentBase // no context, or already dirty. return; } + for (final dependent in _dependents) { dependent.markRebuildDependencies(); } diff --git a/lib/src/rive_core/joystick.dart b/lib/src/rive_core/joystick.dart index 8f3fea6..67afb52 100644 --- a/lib/src/rive_core/joystick.dart +++ b/lib/src/rive_core/joystick.dart @@ -13,16 +13,19 @@ class Joystick extends JoystickBase { void apply(CoreContext context) { var animation = _xAnimation; + if (animation != null) { + var value = xInvert ? -x : x; animation.apply( - (x + 1) / 2 * animation.durationSeconds, + (value + 1) / 2 * animation.durationSeconds, coreContext: context, ); } animation = _yAnimation; if (animation != null) { + var value = yInvert ? -y : y; animation.apply( - (y + 1) / 2 * animation.durationSeconds, + (value + 1) / 2 * animation.durationSeconds, coreContext: context, ); } @@ -86,4 +89,14 @@ class Joystick extends JoystickBase { } } } + + @override + void xInvertChanged(bool from, bool to) { + context.markNeedsAdvance(); + } + + @override + void yInvertChanged(bool from, bool to) { + context.markNeedsAdvance(); + } } diff --git a/lib/src/rive_core/transform_component.dart b/lib/src/rive_core/transform_component.dart index 04a1456..3d2a48d 100644 --- a/lib/src/rive_core/transform_component.dart +++ b/lib/src/rive_core/transform_component.dart @@ -51,13 +51,9 @@ abstract class TransformComponent extends TransformComponentBase { Vec2D get worldTranslation => Vec2D.fromValues(worldTransform[4], worldTransform[5]); - @override double get x; - @override double get y; - @override set x(double value); - @override set y(double value); @override diff --git a/pubspec.yaml b/pubspec.yaml index c4e9105..e6d2cff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ 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 environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.14.0 <4.0.0" flutter: ">=2.5.0" dependencies: collection: ^1.15.0