Bumping runtime version and murdering fractional.

This commit is contained in:
Luigi Rosso
2020-09-28 16:56:53 -07:00
parent 317f9ca68d
commit 5bd55da4fc
9 changed files with 55 additions and 287 deletions

View File

@ -1,3 +1,9 @@
## [0.6.0] - 2020-09-28 16:22:43
- Adding a ToC to files indicating included core properties and their backing field types so that they may be skipped by runtimes that do not understand those properties. This will allow newer minor version files to be read by older minor version runtimes.
- New clipping system allowing for recursive shapes to be included as sources by selecting a node for clipping.
- New draw order system using draw targets.
## [0.5.2] - 2020-08-28 18:24:45 ## [0.5.2] - 2020-08-28 18:24:45
- Adding trim paths. - Adding trim paths.

Binary file not shown.

View File

@ -44,7 +44,7 @@ class _MyHomePageState extends State<MyHomePage> {
// Load the animation file from the bundle, note that you could also // Load the animation file from the bundle, note that you could also
// download this. The RiveFile just expects a list of bytes. // download this. The RiveFile just expects a list of bytes.
rootBundle.load('assets/teeny_tiny.riv').then( rootBundle.load('assets/off_road_car.riv').then(
(data) async { (data) async {
var file = RiveFile(); var file = RiveFile();
// Load the RiveFile from the binary data. // Load the RiveFile from the binary data.

View File

@ -7,49 +7,49 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety" version: "2.5.0-nullsafety.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety" version: "2.1.0-nullsafety.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.2" version: "1.1.0-nullsafety.3"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety" version: "1.2.0-nullsafety.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety" version: "1.1.0-nullsafety.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0-nullsafety.2" version: "1.15.0-nullsafety.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety" version: "1.2.0-nullsafety.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -73,21 +73,21 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety" version: "0.12.10-nullsafety.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.2" version: "1.3.0-nullsafety.3"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety" version: "1.8.0-nullsafety.1"
rive: rive:
dependency: "direct main" dependency: "direct main"
description: description:
@ -106,55 +106,55 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety" version: "1.8.0-nullsafety.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety" version: "1.10.0-nullsafety.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety" version: "2.1.0-nullsafety.1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety" version: "1.1.0-nullsafety.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety" version: "1.2.0-nullsafety.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety" version: "0.2.19-nullsafety.2"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.2" version: "1.3.0-nullsafety.3"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.2" version: "2.1.0-nullsafety.3"
sdks: sdks:
dart: ">=2.10.0-0.0.dev <2.10.0" dart: ">=2.10.0-110 <2.11.0"

View File

@ -1,14 +1,11 @@
export 'package:rive/src/fractional/fractional.dart';
export 'package:rive/src/animation_list.dart'; export 'package:rive/src/animation_list.dart';
export 'package:rive/src/container_children.dart'; export 'package:rive/src/container_children.dart';
export 'package:rive/src/runtime_artboard.dart'; export 'package:rive/src/runtime_artboard.dart';
export 'package:rive/src/generated/rive_core_context.dart'; export 'package:rive/src/generated/rive_core_context.dart';
typedef PropertyChangeCallback = void Function(dynamic from, dynamic to); typedef PropertyChangeCallback = void Function(dynamic from, dynamic to);
typedef BatchAddCallback = void Function(); typedef BatchAddCallback = void Function();
abstract class Core<T extends CoreContext> { abstract class Core<T extends CoreContext> {
covariant T context; covariant T context;
int get coreType; int get coreType;
@ -20,7 +17,7 @@ abstract class Core<T extends CoreContext> {
void onRemoved(); void onRemoved();
} }
abstract class CoreContext{ abstract class CoreContext {
Core makeCoreInstance(int typeKey); Core makeCoreInstance(int typeKey);
T resolve<T>(int id); T resolve<T>(int id);
void markDependencyOrderDirty(); void markDependencyOrderDirty();

View File

@ -1,239 +0,0 @@
import 'dart:collection';
const _minIndex = FractionalIndex.min();
const _maxIndex = FractionalIndex.max();
abstract class FractionallyIndexedList<T> extends ListBase<T> {
final List<T> _values;
FractionalIndex orderOf(T value);
List<T> get values => _values;
@override
int get length => _values.length;
@override
set length(int value) => _values.length = value;
@override
T operator [](int index) => _values[index];
@override
void operator []=(int index, T value) => _values[index] = value;
FractionallyIndexedList({
List<T> values,
bool initOrder = true,
}) : _values = values ?? <T>[] {
if (_values.isEmpty || !initOrder) {
return;
}
// Otherwise spread them evenly across our range using 1/2 as the midpoint.
int mid = _values.length ~/ 2;
var midIndex = const FractionalIndex(1, 2);
setOrderOf(_values[mid], midIndex);
var lastIndex = midIndex;
for (int i = mid + 1; i < _values.length; i++) {
var index = FractionalIndex.between(lastIndex, _maxIndex);
setOrderOf(_values[i], index);
lastIndex = index;
}
lastIndex = midIndex;
for (int i = mid - 1; i >= 0; i--) {
var index = FractionalIndex.between(_minIndex, lastIndex);
setOrderOf(_values[i], index);
lastIndex = index;
}
}
FractionallyIndexedList.raw(List<T> values) : _values = values ?? <T>[];
void setOrderOf(T value, FractionalIndex order);
/// Set the fractional indices to match the current order of the items. This
/// is a pretty heavy operation as it could change the fractional index of
/// every item in the list. Should be used sparingly for cases that really
/// require it.
void setFractionalIndices() {
var previousIndex = _minIndex;
for (final item in _values) {
var index = FractionalIndex.between(previousIndex, _maxIndex);
setOrderOf(item, index);
previousIndex = index;
}
}
int _compareIndex(T a, T b) {
return orderOf(a).compareTo(orderOf(b));
}
void sortFractional() => _values.sort(_compareIndex);
bool validateFractional([FractionalIndex minimum]) {
var previousIndex = minimum ?? _minIndex;
bool wasValid = true;
for (final item in _values) {
var order = orderOf(item);
if (order == null) {
wasValid = false;
continue;
}
if (order.compareTo(previousIndex) > 0) {
previousIndex = order;
}
}
if (wasValid) {
return true;
}
for (final item in _values) {
if (orderOf(item) == null) {
var index = FractionalIndex.between(previousIndex, _maxIndex);
setOrderOf(item, index);
previousIndex = index;
}
}
return false;
}
@override
void add(T item) {
assert(!contains(item));
_values.add(item);
}
@override
bool remove(Object element) => _values.remove(element);
void append(T item) {
assert(!contains(item));
var previousIndex = _values.isEmpty ? _minIndex : orderOf(_values.last);
setOrderOf(item, FractionalIndex.between(previousIndex, _maxIndex));
_values.add(item);
}
/// Gets the next fractional index safely, most of the other methods here
/// assume the index list is valid, this one does not. It'll find the best
/// next index. It's meant to be used to help implementations patch up their
/// lists as necessary.
FractionalIndex get nextFractionalIndex {
var previousIndex = _minIndex;
for (final item in _values) {
var order = orderOf(item);
if (order == null) {
continue;
}
if (order.compareTo(previousIndex) > 0) {
previousIndex = order;
}
}
return FractionalIndex.between(previousIndex, _maxIndex);
}
void prepend(T item) {
assert(!contains(item));
var firstIndex = _values.isEmpty ? _maxIndex : orderOf(_values.first);
setOrderOf(item, FractionalIndex.between(_minIndex, firstIndex));
_values.add(item);
}
void moveToEnd(T item) {
var previousIndex = _values.isEmpty ? _minIndex : orderOf(_values.last);
setOrderOf(item, FractionalIndex.between(previousIndex, _maxIndex));
}
void moveToStart(T item) {
var firstIndex = _values.isEmpty ? _maxIndex : orderOf(_values.first);
setOrderOf(item, FractionalIndex.between(_minIndex, firstIndex));
}
void move(T item, {T before, T after}) {
setOrderOf(
item,
FractionalIndex.between(before != null ? orderOf(before) : _minIndex,
after != null ? orderOf(after) : _maxIndex));
}
void reverse() {
var indices = <FractionalIndex>[];
for (final item in _values) {
indices.add(orderOf(item));
}
var length = _values.length;
for (int i = 0; i < length; i++) {
setOrderOf(_values[i], indices[length - 1 - i]);
}
sortFractional();
}
}
class FractionalIndex {
final int numerator;
final int denominator;
const FractionalIndex(this.numerator, this.denominator)
: assert(numerator < denominator);
const FractionalIndex.min()
: numerator = 0,
denominator = 1;
const FractionalIndex.max()
: numerator = 1,
denominator = 1;
int compareTo(FractionalIndex other) {
return numerator * other.denominator - denominator * other.numerator;
}
FractionalIndex combine(FractionalIndex other) {
return FractionalIndex(
numerator + other.numerator, denominator + other.denominator);
}
factory FractionalIndex.between(FractionalIndex a, FractionalIndex b) {
return FractionalIndex(
a.numerator + b.numerator, a.denominator + b.denominator)
.reduce();
}
FractionalIndex reduce() {
int x = numerator, y = denominator;
while (y != 0) {
int t = y;
y = x % y;
x = t;
}
return FractionalIndex(numerator ~/ x, denominator ~/ x);
}
bool operator <(FractionalIndex other) {
return compareTo(other) < 0;
}
bool operator >(FractionalIndex other) {
return compareTo(other) > 0;
}
@override
bool operator ==(Object other) =>
other is FractionalIndex &&
other.numerator == numerator &&
other.denominator == denominator;
@override
int get hashCode => szudzik(numerator, denominator);
@override
String toString() => '$numerator/$denominator';
}
/// Szudzik's function for hashing two ints together
int szudzik(int a, int b) {
// a and b must be >= 0
int x = a.abs();
int y = b.abs();
return x >= y ? x * x + x + y : x + y * y;
}

View File

@ -15,7 +15,7 @@ class DependencySorter<T extends DependencyGraphNode<T>> {
HashSet<T> _perm; HashSet<T> _perm;
HashSet<T> _temp; HashSet<T> _temp;
List<T> _order; List<T> _order;
List<T> get order => _order; List<T> get order => _order.reversed.toList();
DependencySorter() { DependencySorter() {
_perm = HashSet<T>(); _perm = HashSet<T>();
@ -27,7 +27,7 @@ class DependencySorter<T extends DependencyGraphNode<T>> {
if (!visit(root)) { if (!visit(root)) {
return null; return null;
} }
return _order; return _order.reversed.toList();
} }
void reset() { void reset() {
@ -54,7 +54,11 @@ class DependencySorter<T extends DependencyGraphNode<T>> {
} }
} }
_perm.add(n); _perm.add(n);
_order.insert(0, n);
// Note that we're adding in reverse order intentionally so we don't have to
// keep inserting at the start and re-alloc-ing the whole list...It does
// mean we need to reverse the list afterwards.
_order.add(n);
return true; return true;
} }
@ -89,7 +93,7 @@ class TarjansDependencySorter<T extends DependencyGraphNode<T>>
visit(root); visit(root);
} }
return _order; return _order.reversed.toList();
} }
HashSet<T> findCycles(T n) { HashSet<T> findCycles(T n) {

View File

@ -7,49 +7,49 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety" version: "2.5.0-nullsafety.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety" version: "2.1.0-nullsafety.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.2" version: "1.1.0-nullsafety.3"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety" version: "1.2.0-nullsafety.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety" version: "1.1.0-nullsafety.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0-nullsafety.2" version: "1.15.0-nullsafety.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety" version: "1.2.0-nullsafety.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -73,21 +73,21 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety" version: "0.12.10-nullsafety.1"
meta: meta:
dependency: "direct main" dependency: "direct main"
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.2" version: "1.3.0-nullsafety.3"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety" version: "1.8.0-nullsafety.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -99,55 +99,55 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety" version: "1.8.0-nullsafety.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety" version: "1.10.0-nullsafety.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety" version: "2.1.0-nullsafety.1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety" version: "1.1.0-nullsafety.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety" version: "1.2.0-nullsafety.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety" version: "0.2.19-nullsafety.2"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.2" version: "1.3.0-nullsafety.3"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.2" version: "2.1.0-nullsafety.3"
sdks: sdks:
dart: ">=2.10.0-0.0.dev <2.10.0" dart: ">=2.10.0-110 <2.11.0"

View File

@ -1,6 +1,6 @@
name: rive name: rive
description: Rive 2 Flutter Runtime description: Rive 2 Flutter Runtime
version: 0.5.2 version: 0.6.0
repository: https://github.com/rive-app/rive-flutter repository: https://github.com/rive-app/rive-flutter
homepage: https://rive.app homepage: https://rive.app