added index to view
This commit is contained in:
@@ -36,7 +36,12 @@ class GroupView extends SpriteView implements IGroupView<Sprite> {
|
|||||||
|
|
||||||
override public function update():Void {
|
override public function update():Void {
|
||||||
layout.place(this, views);
|
layout.place(this, views);
|
||||||
for (view in views) view.update();
|
for (view in views) {
|
||||||
|
view.update();
|
||||||
|
if (view.index > -1) {
|
||||||
|
content.setChildIndex(view.content, view.index);
|
||||||
|
}
|
||||||
|
}
|
||||||
super.update();
|
super.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ interface IView<C:Content> {
|
|||||||
public var inLayout(default, set):Bool;
|
public var inLayout(default, set):Bool;
|
||||||
|
|
||||||
public var visible(default, set):Bool;
|
public var visible(default, set):Bool;
|
||||||
|
public var index(default, set):Int;
|
||||||
|
|
||||||
public function update():Void;
|
public function update():Void;
|
||||||
public function invalidate():Void;
|
public function invalidate():Void;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class View<C:Content> implements IView<C> {
|
|||||||
public var inLayout(default, set):Bool;
|
public var inLayout(default, set):Bool;
|
||||||
|
|
||||||
public var visible(default, set):Bool;
|
public var visible(default, set):Bool;
|
||||||
|
public var index(default, set):Int;
|
||||||
|
|
||||||
public function new(content:C) {
|
public function new(content:C) {
|
||||||
id = Type.getClassName(Type.getClass(this)) + counter++;
|
id = Type.getClassName(Type.getClass(this)) + counter++;
|
||||||
@@ -65,6 +66,7 @@ class View<C:Content> implements IView<C> {
|
|||||||
hAlign = HAlign.NONE;
|
hAlign = HAlign.NONE;
|
||||||
inLayout = true;
|
inLayout = true;
|
||||||
visible = true;
|
visible = true;
|
||||||
|
index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function currentSkin():ISkin<C, IView<C>> {
|
private function currentSkin():ISkin<C, IView<C>> {
|
||||||
@@ -261,6 +263,14 @@ class View<C:Content> implements IView<C> {
|
|||||||
}
|
}
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function set_index(value:Int):Int {
|
||||||
|
if (index != value) {
|
||||||
|
index = value;
|
||||||
|
invalidateParent();
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user