Allow group to be initialized with all nulls

This commit is contained in:
Jordan Eldredge 2019-10-14 09:01:25 -07:00
parent 8ed22cf414
commit 498fddf87a
3 changed files with 9 additions and 4 deletions

View file

@ -74,7 +74,7 @@ export function gotSkinZip(zip: JSZip, store: ModernStore): Thunk {
dispatch(setXmlTree(xmlTree));
const makiTree = await initialize(zip, xmlTree);
const makiTree: MakiObject = await initialize(zip, xmlTree);
// Execute scripts
await Utils.asyncTreeFlatMap(makiTree, async (node: MakiObject) => {
if (!(node instanceof JsScript)) {

View file

@ -33,7 +33,11 @@ class GuiObject extends MakiObject {
_transitionParams: TransitionParams;
_targetAnimationStartTime: number;
_targetAnimationCancelID: number | null;
constructor(node: XmlNode, parent: MakiObject, annotations: Object = {}) {
constructor(
node: XmlNode | null,
parent: MakiObject | null,
annotations: Object = {}
) {
super(node, parent, annotations);
this._setAttributeDefaults();

View file

@ -12,7 +12,7 @@ import Layout from "./Layout";
import GuiObject from "./GuiObject";
class System extends MakiObject {
_scriptGroup: Group;
_scriptGroup: MakiObject;
_root: MakiObject;
_store: ModernStore;
_privateInt: Map<string, Map<string, number>>;
@ -21,7 +21,8 @@ class System extends MakiObject {
super(null, null);
this._store = store;
this._scriptGroup = scriptGroup == null ? new Group() : scriptGroup;
this._scriptGroup =
scriptGroup == null ? new Group(null, null) : scriptGroup;
this._root = this._scriptGroup;
while (this._root.parent) {
this._root = this._root.parent;