added root

This commit is contained in:
2013-08-27 09:25:41 +02:00
parent 51ae8e2931
commit 752d0dd413
11 changed files with 157 additions and 29 deletions

View File

@@ -1,7 +1,5 @@
package haxework.gui;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import haxework.gui.core.SizeType;
import haxework.gui.core.HAlign;
import haxework.gui.core.VAlign;
@@ -22,11 +20,14 @@ class View implements IView<Sprite> {
public var x(default, set):Float;
public var y(default, set):Float;
public var w(default, set):Float;
public var h(default, set):Float;
public var widthType(default, null):SizeType;
public var heightType(default, null):SizeType;
public var width(default, set):Float;
public var height(default, set):Float;
public var width(get, set):Float;
public var height(get, set):Float;
public var pWidth(default, set):Float;
public var pHeight(default, set):Float;
@@ -54,8 +55,8 @@ class View implements IView<Sprite> {
width = 100;
height = 100;
margins = 0;
vAlign = VAlign.CENTER;
hAlign = HAlign.MIDDLE;
vAlign = VAlign.NONE;
hAlign = HAlign.NONE;
}
private function invalidate():Void {
@@ -88,24 +89,47 @@ class View implements IView<Sprite> {
return y;
}
private function set_w(value:Float):Float {
if (w != value) {
w = value;
invalidate();
}
return w;
}
private function set_h(value:Float):Float {
if (h != value) {
h = value;
invalidate();
}
return h;
}
private function get_width():Float {
return w;
}
private function get_height():Float {
return h;
}
private function set_width(value:Float):Float {
if (width != value || widthType != SizeType.NORMAL) {
width = value;
if (w != value || widthType != SizeType.NORMAL) {
w = value;
widthType = SizeType.NORMAL;
invalidate();
invalidateParent();
}
return width;
return w;
}
private function set_height(value:Float):Float {
if (height != value || heightType != SizeType.NORMAL) {
height = value;
if (h != value || heightType != SizeType.NORMAL) {
h = value;
heightType = SizeType.NORMAL;
invalidate();
invalidateParent();
}
return height;
return h;
}
private function set_pWidth(value:Float):Float {
@@ -207,8 +231,6 @@ class Updater {
}
private function set_stage(value:Stage):Stage {
value.scaleMode = StageScaleMode.NO_SCALE;
value.align = StageAlign.TOP_LEFT;
value.addEventListener(Event.ENTER_FRAME, update);
return value;
}