Continue improving Maki types

This commit is contained in:
Jordan Eldredge 2019-09-20 06:29:24 -07:00
parent d562d41dea
commit 3c0d37d3c5
4 changed files with 23 additions and 11 deletions

View file

@ -1,12 +1,14 @@
import Layer from "./Layer";
import { unimplementedWarning } from "../utils";
import { XmlNode } from "../types";
import MakiObject from "./MakiObject";
class AnimatedLayer extends Layer {
_playing: boolean;
_frameNum: number;
_animationStartTime: number;
constructor(node, parent, annotations) {
constructor(node: XmlNode, parent: MakiObject, annotations: Object = {}) {
super(node, parent, annotations);
this._setAttributeDefaults();

View file

@ -1,10 +1,12 @@
import MakiObject from "./MakiObject";
import { findDescendantByTypeAndId, unimplementedWarning } from "../utils";
import { XmlNode } from "../types";
import Layout from "./Layout";
class Container extends MakiObject {
visible: boolean;
constructor(node, parent) {
super(node, parent);
constructor(node: XmlNode, parent: MakiObject, annotations: Object = {}) {
super(node, parent, annotations);
this.visible = true;
}
@ -35,22 +37,23 @@ class Container extends MakiObject {
}
getlayout(id: string) {
return findDescendantByTypeAndId(this, "layout", id);
const self: MakiObject = this;
return findDescendantByTypeAndId(self, "layout", id);
}
onswitchtolayout(newlayout): void {
onswitchtolayout(newlayout: Layout): void {
this.js_trigger("onSwitchToLayout", newlayout);
}
onbeforeswitchtolayout(oldlayout, newlayout): void {
onbeforeswitchtolayout(oldlayout: Layout, newlayout: Layout): void {
this.js_trigger("onBeforeSwitchToLayout", oldlayout, newlayout);
}
onhidelayout(_layout): void {
onhidelayout(_layout: Layout): void {
this.js_trigger("onHideLayout", _layout);
}
onshowlayout(_layout): void {
onshowlayout(_layout: Layout): void {
this.js_trigger("onShowLayout", _layout);
}

View file

@ -1,5 +1,7 @@
import GuiObject from "./GuiObject";
import { unimplementedWarning } from "../utils";
import Region from "./Region";
import MakiMap from "./Map";
class Layer extends GuiObject {
/**
@ -12,11 +14,11 @@ class Layer extends GuiObject {
return "Layer";
}
setregion(reg) {
setregion(reg: Region) {
unimplementedWarning("setregion");
}
setregionfrommap(regionmap, threshold: number, reverse: boolean) {
setregionfrommap(regionmap: MakiMap, threshold: number, reverse: boolean) {
unimplementedWarning("setregion");
}

View file

@ -40,7 +40,12 @@
"modern/src/runtime/GroupList.ts",
"modern/src/runtime/GuiList.ts",
"modern/src/runtime/List.ts",
"modern/src/runtime/MouseRedir.ts"
"modern/src/runtime/MouseRedir.ts",
"modern/src/runtime/Layer.ts",
"modern/src/runtime/Container.ts"
// "modern/src/runtime/PopMenu.ts",
// "modern/src/runtime/AnimationLayer.ts",
// "modern/src/runtime/System.ts"
],
"exclude": ["node_modules", "**/*.spec.ts", "demo/built"]
}