mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-22 23:07:49 +08:00
Joystick updates
- Adds invert x/y to joystick (Thanks @alxgibsn) - Adds the invert to Flutter and C++ runtimes. - Updates Cpp core generator to latest Flutter+NNBD. - Fixes warnings and errors from latest Flutter (Dart SDK really). Diffs= a4fb3dc7d Joystick updates (#5261) 8f8e06b9e Attempt fixing the builds with new Docker images (#5253) 7768798a7 Update to Flutter 3.10.0 (#5247)
This commit is contained in:
@ -1 +1 @@
|
|||||||
7acff50d4632d9e88b1474d6f23b3b1c8d7f7334
|
a4fb3dc7decb50f6965e21ebced098cbdc35883d
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Joysticks!
|
- Joysticks!
|
||||||
- Bumping to latest rive_common with some changes to AABB math api.
|
- Bumping to latest rive_common with some changes to AABB math api.
|
||||||
|
- Bumping Dart SDK requirements.
|
||||||
|
|
||||||
## 0.10.4
|
## 0.10.4
|
||||||
|
|
||||||
|
@ -78,7 +78,6 @@ linter:
|
|||||||
- prefer_const_literals_to_create_immutables
|
- prefer_const_literals_to_create_immutables
|
||||||
- prefer_constructors_over_static_methods
|
- prefer_constructors_over_static_methods
|
||||||
- prefer_contains
|
- prefer_contains
|
||||||
- prefer_equal_for_default_values
|
|
||||||
- prefer_final_fields
|
- prefer_final_fields
|
||||||
- prefer_final_in_for_each
|
- prefer_final_in_for_each
|
||||||
- prefer_foreach
|
- prefer_foreach
|
||||||
|
@ -79,6 +79,30 @@ abstract class JoystickBase extends Component {
|
|||||||
|
|
||||||
void xIdChanged(int from, int to);
|
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.
|
/// YId field with key 302.
|
||||||
static const int yIdInitialValue = -1;
|
static const int yIdInitialValue = -1;
|
||||||
@ -104,12 +128,38 @@ abstract class JoystickBase extends Component {
|
|||||||
|
|
||||||
void yIdChanged(int from, int to);
|
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
|
@override
|
||||||
void copy(covariant JoystickBase source) {
|
void copy(covariant JoystickBase source) {
|
||||||
super.copy(source);
|
super.copy(source);
|
||||||
_x = source._x;
|
_x = source._x;
|
||||||
_y = source._y;
|
_y = source._y;
|
||||||
_xId = source._xId;
|
_xId = source._xId;
|
||||||
|
_xInvert = source._xInvert;
|
||||||
_yId = source._yId;
|
_yId = source._yId;
|
||||||
|
_yInvert = source._yInvert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1139,11 +1139,21 @@ class RiveCoreContext {
|
|||||||
object.xId = value;
|
object.xId = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case JoystickBase.xInvertPropertyKey:
|
||||||
|
if (object is JoystickBase && value is bool) {
|
||||||
|
object.xInvert = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case JoystickBase.yIdPropertyKey:
|
case JoystickBase.yIdPropertyKey:
|
||||||
if (object is JoystickBase && value is int) {
|
if (object is JoystickBase && value is int) {
|
||||||
object.yId = value;
|
object.yId = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case JoystickBase.yInvertPropertyKey:
|
||||||
|
if (object is JoystickBase && value is bool) {
|
||||||
|
object.yInvert = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BoneBase.lengthPropertyKey:
|
case BoneBase.lengthPropertyKey:
|
||||||
if (object is BoneBase && value is double) {
|
if (object is BoneBase && value is double) {
|
||||||
object.length = value;
|
object.length = value;
|
||||||
@ -1514,6 +1524,8 @@ class RiveCoreContext {
|
|||||||
case ClippingShapeBase.isVisiblePropertyKey:
|
case ClippingShapeBase.isVisiblePropertyKey:
|
||||||
case CustomPropertyBooleanBase.propertyValuePropertyKey:
|
case CustomPropertyBooleanBase.propertyValuePropertyKey:
|
||||||
case ArtboardBase.clipPropertyKey:
|
case ArtboardBase.clipPropertyKey:
|
||||||
|
case JoystickBase.xInvertPropertyKey:
|
||||||
|
case JoystickBase.yInvertPropertyKey:
|
||||||
return boolType;
|
return boolType;
|
||||||
case KeyFrameColorBase.valuePropertyKey:
|
case KeyFrameColorBase.valuePropertyKey:
|
||||||
case SolidColorBase.colorValuePropertyKey:
|
case SolidColorBase.colorValuePropertyKey:
|
||||||
@ -1929,6 +1941,10 @@ class RiveCoreContext {
|
|||||||
return (object as CustomPropertyBooleanBase).propertyValue;
|
return (object as CustomPropertyBooleanBase).propertyValue;
|
||||||
case ArtboardBase.clipPropertyKey:
|
case ArtboardBase.clipPropertyKey:
|
||||||
return (object as ArtboardBase).clip;
|
return (object as ArtboardBase).clip;
|
||||||
|
case JoystickBase.xInvertPropertyKey:
|
||||||
|
return (object as JoystickBase).xInvert;
|
||||||
|
case JoystickBase.yInvertPropertyKey:
|
||||||
|
return (object as JoystickBase).yInvert;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2927,6 +2943,16 @@ class RiveCoreContext {
|
|||||||
object.clip = value;
|
object.clip = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case JoystickBase.xInvertPropertyKey:
|
||||||
|
if (object is JoystickBase) {
|
||||||
|
object.xInvert = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case JoystickBase.yInvertPropertyKey:
|
||||||
|
if (object is JoystickBase) {
|
||||||
|
object.yInvert = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,4 @@ class KeyedObject extends KeyedObjectBase<RuntimeArtboard> {
|
|||||||
|
|
||||||
return super.import(stack);
|
return super.import(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
List<Core<CoreContext>> get referees => keyedProperties.toList();
|
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,4 @@ class KeyedProperty extends KeyedPropertyBase<RuntimeArtboard>
|
|||||||
|
|
||||||
return super.import(stack);
|
return super.import(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
List<Core<CoreContext>> get referees => keyframes.toList();
|
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,4 @@ abstract class KeyFrame extends KeyFrameBase<RuntimeArtboard>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '${super.toString()} id: ($id)';
|
String toString() => '${super.toString()} id: ($id)';
|
||||||
|
|
||||||
@override
|
|
||||||
List<Core<CoreContext>> get referees => [];
|
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,7 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
|
|||||||
// no context, or already dirty.
|
// no context, or already dirty.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final dependent in _dependents) {
|
for (final dependent in _dependents) {
|
||||||
dependent.markRebuildDependencies();
|
dependent.markRebuildDependencies();
|
||||||
}
|
}
|
||||||
|
@ -13,16 +13,19 @@ class Joystick extends JoystickBase {
|
|||||||
|
|
||||||
void apply(CoreContext context) {
|
void apply(CoreContext context) {
|
||||||
var animation = _xAnimation;
|
var animation = _xAnimation;
|
||||||
|
|
||||||
if (animation != null) {
|
if (animation != null) {
|
||||||
|
var value = xInvert ? -x : x;
|
||||||
animation.apply(
|
animation.apply(
|
||||||
(x + 1) / 2 * animation.durationSeconds,
|
(value + 1) / 2 * animation.durationSeconds,
|
||||||
coreContext: context,
|
coreContext: context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
animation = _yAnimation;
|
animation = _yAnimation;
|
||||||
if (animation != null) {
|
if (animation != null) {
|
||||||
|
var value = yInvert ? -y : y;
|
||||||
animation.apply(
|
animation.apply(
|
||||||
(y + 1) / 2 * animation.durationSeconds,
|
(value + 1) / 2 * animation.durationSeconds,
|
||||||
coreContext: context,
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,9 @@ abstract class TransformComponent extends TransformComponentBase {
|
|||||||
Vec2D get worldTranslation =>
|
Vec2D get worldTranslation =>
|
||||||
Vec2D.fromValues(worldTransform[4], worldTransform[5]);
|
Vec2D.fromValues(worldTransform[4], worldTransform[5]);
|
||||||
|
|
||||||
@override
|
|
||||||
double get x;
|
double get x;
|
||||||
@override
|
|
||||||
double get y;
|
double get y;
|
||||||
@override
|
|
||||||
set x(double value);
|
set x(double value);
|
||||||
@override
|
|
||||||
set y(double value);
|
set y(double value);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -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.
|
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
|
repository: https://github.com/rive-app/rive-flutter
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.14.0 <4.0.0"
|
||||||
flutter: ">=2.5.0"
|
flutter: ">=2.5.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
|
Reference in New Issue
Block a user