Updating missing file.

This commit is contained in:
Luigi Rosso
2021-05-31 12:16:22 -07:00
parent e8d9f59947
commit 80b5490d87

View File

@ -93,9 +93,8 @@ class RuntimeArtboard extends Artboard implements CoreContext {
} }
@override @override
Core<CoreContext>? makeCoreInstance(int typeKey) { Core<CoreContext>? makeCoreInstance(int typeKey) =>
return null; RiveCoreContext.makeCoreInstance(typeKey);
}
@override @override
void dirty(void Function() dirt) { void dirty(void Function() dirt) {
@ -107,15 +106,17 @@ class RuntimeArtboard extends Artboard implements CoreContext {
_redraw.notify(); _redraw.notify();
} }
Artboard? instance() { @override
Artboard instance() {
var artboard = RuntimeArtboard(); var artboard = RuntimeArtboard();
artboard.context = artboard;
artboard.copy(this); artboard.copy(this);
artboard._objects.add(artboard); artboard._objects.add(artboard);
// First copy the objects ensuring onAddedDirty can later find them in the // First copy the objects ensuring onAddedDirty can later find them in the
// _objects list. // _objects list.
for (final object in _objects.skip(1)) { for (final object in _objects.skip(1)) {
Core? clone = object?.clone(); Core? clone = object?.clone();
artboard._objects.add(clone); artboard.addObject(clone);
} }
// Then run the onAddedDirty loop. // Then run the onAddedDirty loop.
@ -126,12 +127,15 @@ class RuntimeArtboard extends Artboard implements CoreContext {
} }
object?.onAddedDirty(); object?.onAddedDirty();
} }
animations.forEach(artboard.animations.add);
for (final object in artboard.objects.toList(growable: false)) { for (final object in artboard.objects.toList(growable: false)) {
if (object == null) { if (object == null) {
continue; continue;
} }
object.onAdded(); object.onAdded();
InternalCoreHelper.markValid(object);
} }
artboard.clean(); artboard.clean();
return artboard;
} }
} }