fixes
This commit is contained in:
@@ -63,7 +63,7 @@ class ButtonView extends LabelView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function pressCaller(listener:ButtonViewListener<Dynamic>):Void {
|
private function pressCaller(listener:ButtonViewListener<Dynamic>):Void {
|
||||||
listener.onPress(this);
|
try {listener.onPress(this);} catch (error:Dynamic) L.e("onPress", "", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_disabled(value:Bool):Bool {
|
private function set_disabled(value:Bool):Bool {
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ typedef Content = {
|
|||||||
var x(default,default):Float;
|
var x(default,default):Float;
|
||||||
var y(default,default):Float;
|
var y(default,default):Float;
|
||||||
var visible(default,default):Bool;
|
var visible(default,default):Bool;
|
||||||
|
var mouseEnabled(default,default):Bool;
|
||||||
#else
|
#else
|
||||||
var x(get,set):Float;
|
var x(get,set):Float;
|
||||||
var y(get,set):Float;
|
var y(get,set):Float;
|
||||||
var visible(get,set):Bool;
|
var visible(get,set):Bool;
|
||||||
|
var mouseEnabled(get,set):Bool;
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +56,7 @@ interface IView<C:Content> {
|
|||||||
|
|
||||||
public var visible(default, set):Bool;
|
public var visible(default, set):Bool;
|
||||||
public var index(default, set):Int;
|
public var index(default, set):Int;
|
||||||
|
public var mouseEnabled(default, set):Bool;
|
||||||
|
|
||||||
public function update():Void;
|
public function update():Void;
|
||||||
public function invalidate():Void;
|
public function invalidate():Void;
|
||||||
|
|||||||
@@ -184,4 +184,8 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override private function set_mouseEnabled(value:Bool):Bool {
|
||||||
|
textField.mouseEnabled = value;
|
||||||
|
return super.set_mouseEnabled(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class View<C:Content> implements IView<C> {
|
|||||||
|
|
||||||
public var visible(default, set):Bool;
|
public var visible(default, set):Bool;
|
||||||
public var index(default, set):Int;
|
public var index(default, set):Int;
|
||||||
|
public var mouseEnabled(default, set):Bool = true;
|
||||||
|
|
||||||
public function new(content:C) {
|
public function new(content:C) {
|
||||||
id = Type.getClassName(Type.getClass(this)) + counter++;
|
id = Type.getClassName(Type.getClass(this)) + counter++;
|
||||||
@@ -271,6 +272,14 @@ class View<C:Content> implements IView<C> {
|
|||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function set_mouseEnabled(value:Bool):Bool {
|
||||||
|
if (mouseEnabled != value) {
|
||||||
|
mouseEnabled = value;
|
||||||
|
if (content != null) content.mouseEnabled = mouseEnabled;
|
||||||
|
}
|
||||||
|
return mouseEnabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,12 +36,16 @@ class DefaultLayout implements ILayout {
|
|||||||
private function setViewWidth(group:IGroupView<Dynamic>, view:IView<Dynamic>):Void {
|
private function setViewWidth(group:IGroupView<Dynamic>, view:IView<Dynamic>):Void {
|
||||||
if (view.widthType == SizeType.PERCENT) {
|
if (view.widthType == SizeType.PERCENT) {
|
||||||
view.w = view.pWidth / 100 * (group.width - view.leftMargin - view.rightMargin - group.leftPadding - group.rightPadding);
|
view.w = view.pWidth / 100 * (group.width - view.leftMargin - view.rightMargin - group.leftPadding - group.rightPadding);
|
||||||
|
} else if (group.contentSize && group.width < view.width) {
|
||||||
|
group.width = view.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setViewHeight(group:IGroupView<Dynamic>, view:IView<Dynamic>):Void {
|
private function setViewHeight(group:IGroupView<Dynamic>, view:IView<Dynamic>):Void {
|
||||||
if (view.heightType == SizeType.PERCENT) {
|
if (view.heightType == SizeType.PERCENT) {
|
||||||
view.h = view.pHeight / 100 * (group.height - view.topMargin - view.bottomMargin - group.topPadding - group.bottomPadding);
|
view.h = view.pHeight / 100 * (group.height - view.topMargin - view.bottomMargin - group.topPadding - group.bottomPadding);
|
||||||
|
} else if (group.contentSize && group.height < view.height) {
|
||||||
|
group.height = view.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class HorizontalLayout extends DefaultLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (group.contentSize) {
|
if (group.contentSize) {
|
||||||
group.width = fixedSize + group.leftPadding + group.rightPadding;
|
group.width = Math.max(group.width, fixedSize + group.leftPadding + group.rightPadding);
|
||||||
group.height = maxHeight + group.topPadding + group.bottomPadding;
|
group.height = maxHeight + group.topPadding + group.bottomPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class VerticalLayout extends DefaultLayout {
|
|||||||
|
|
||||||
if (group.contentSize) {
|
if (group.contentSize) {
|
||||||
group.width = maxWidth + group.leftPadding + group.rightPadding;
|
group.width = maxWidth + group.leftPadding + group.rightPadding;
|
||||||
group.height = fixedSize + group.topPadding + group.bottomPadding;
|
group.height = Math.max(group.height, fixedSize + group.topPadding + group.bottomPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
leftSize -= fixedSize;
|
leftSize -= fixedSize;
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ import flash.display.Sprite;
|
|||||||
class ButtonColorSkin implements ISkin<Sprite, ButtonView> {
|
class ButtonColorSkin implements ISkin<Sprite, ButtonView> {
|
||||||
|
|
||||||
public var color(default, set_color):Int;
|
public var color(default, set_color):Int;
|
||||||
|
public var alpha(default, default):Float;
|
||||||
private var colors:Map<ButtonState, Int>;
|
private var colors:Map<ButtonState, Int>;
|
||||||
private var disable:Int;
|
private var disable:Int;
|
||||||
|
|
||||||
public function new(?color:Int = 0xffffff) {
|
public function new(?color:Int = 0xffffff, ?alpha:Float = 1.0) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
this.alpha = alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_color(value:Int):Int {
|
private function set_color(value:Int):Int {
|
||||||
@@ -28,7 +30,7 @@ class ButtonColorSkin implements ISkin<Sprite, ButtonView> {
|
|||||||
var color:Int = view.disabled ? disable : colors.get(view.state);
|
var color:Int = view.disabled ? disable : colors.get(view.state);
|
||||||
var graphics:Graphics = view.content.graphics;
|
var graphics:Graphics = view.content.graphics;
|
||||||
graphics.clear();
|
graphics.clear();
|
||||||
graphics.beginFill(color);
|
graphics.beginFill(color, alpha);
|
||||||
graphics.drawRect(0, 0, view.width, view.height);
|
graphics.drawRect(0, 0, view.width, view.height);
|
||||||
graphics.endFill();
|
graphics.endFill();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class OrderSupplier implements IOrderSupplier {
|
|||||||
var c:Class<Dynamic> = clazz;
|
var c:Class<Dynamic> = clazz;
|
||||||
return if (c == BitmapData) {
|
return if (c == BitmapData) {
|
||||||
var loader:ILoader<T> = untyped new ImageLoader();
|
var loader:ILoader<T> = untyped new ImageLoader();
|
||||||
loader.timeout = 5000; //ToDo: hardcode timeout for loading images
|
loader.timeout = 7000; //ToDo: hardcode timeout for loading images
|
||||||
loader;
|
loader;
|
||||||
} else {
|
} else {
|
||||||
throw "Unsupported order: " + c;
|
throw "Unsupported order: " + c;
|
||||||
|
|||||||
Reference in New Issue
Block a user