update
This commit is contained in:
@@ -95,6 +95,7 @@ class Field {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:deprecated("Use haxework.gui.ViewBuilder")
|
||||||
class Builder {
|
class Builder {
|
||||||
|
|
||||||
private var factory:Class<Dynamic>;
|
private var factory:Class<Dynamic>;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import haxework.gui.skin.ButtonBitmapSkin;
|
|||||||
import haxework.gui.skin.ProgressSkin;
|
import haxework.gui.skin.ProgressSkin;
|
||||||
import haxework.gui.frame.FrameSwitcher;
|
import haxework.gui.frame.FrameSwitcher;
|
||||||
|
|
||||||
|
@:deprecated("Use haxework.gui.ViewBuilder")
|
||||||
class GuiBuilder {
|
class GuiBuilder {
|
||||||
|
|
||||||
private static var cache:Map<String, Dynamic> = new Map<String, Dynamic>();
|
private static var cache:Map<String, Dynamic> = new Map<String, Dynamic>();
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ class Root {
|
|||||||
public static var instance(default, null):Root;
|
public static var instance(default, null):Root;
|
||||||
|
|
||||||
public var view(default, null):IView<Sprite>;
|
public var view(default, null):IView<Sprite>;
|
||||||
|
public var autoSize(default, default):Bool;
|
||||||
|
|
||||||
public function new(view:IView<Sprite>) {
|
public function new(view:IView<Sprite>, autoSize:Bool = true) {
|
||||||
if (instance != null) throw new Error("Only one instance");
|
if (instance != null) throw new Error("Only one instance");
|
||||||
instance = this;
|
instance = this;
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
this.autoSize = autoSize;
|
||||||
Lib.current.addChild(view.content);
|
Lib.current.addChild(view.content);
|
||||||
var content:DisplayObject = view.content;
|
var content:DisplayObject = view.content;
|
||||||
if (content.stage == null) {
|
if (content.stage == null) {
|
||||||
@@ -41,8 +43,13 @@ class Root {
|
|||||||
|
|
||||||
private function onResize(?_):Void {
|
private function onResize(?_):Void {
|
||||||
var content:DisplayObject = view.content;
|
var content:DisplayObject = view.content;
|
||||||
view.width = content.stage.stageWidth;
|
if (autoSize) {
|
||||||
view.height = content.stage.stageHeight;
|
view.width = content.stage.stageWidth;
|
||||||
|
view.height = content.stage.stageHeight;
|
||||||
|
} else {
|
||||||
|
view.x = (content.stage.stageWidth - view.width) / 2;
|
||||||
|
view.y = (content.stage.stageHeight - view.height) / 2;
|
||||||
|
}
|
||||||
L.d("Screen", content.stage.stageWidth + "x" + content.stage.stageHeight);
|
L.d("Screen", content.stage.stageWidth + "x" + content.stage.stageHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class ViewBuilderImpl {
|
|||||||
var template = Json.parse(loadFileAsString(a[1]));
|
var template = Json.parse(loadFileAsString(a[1]));
|
||||||
return getValue(data, name, style, key, template);
|
return getValue(data, name, style, key, template);
|
||||||
case "link":
|
case "link":
|
||||||
"(links == null) ? untyped this : links[\"" + a[1] + "\"]";
|
"(links == null) ? untyped this : Reflect.field(links, \"" + a[1] + "\")";
|
||||||
case _:
|
case _:
|
||||||
throw "Unsupported prefix \"" + a[0] + "\"";
|
throw "Unsupported prefix \"" + a[0] + "\"";
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ class ViewBuilderImpl {
|
|||||||
if (["type", "style"].indexOf(key) > -1) continue;
|
if (["type", "style"].indexOf(key) > -1) continue;
|
||||||
var value = getValue(data, name, style, key, Reflect.field(template, key));
|
var value = getValue(data, name, style, key, Reflect.field(template, key));
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
data.push(Context.parse(name + "." + key + " = untyped " + value, Context.currentPos()));
|
data.push(Context.parse(name + "." + key + " = cast " + value, Context.currentPos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package haxework.gui.core;
|
package haxework.gui.core;
|
||||||
|
|
||||||
@:enum abstract HAlign(String) {
|
@:enum abstract HAlign(String) from String to String {
|
||||||
var NONE = "NONE";
|
var NONE = "NONE";
|
||||||
var LEFT = "LEFT";
|
var LEFT = "LEFT";
|
||||||
var CENTER = "CENTER";
|
var CENTER = "CENTER";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package haxework.gui.core;
|
package haxework.gui.core;
|
||||||
|
|
||||||
@:enum abstract VAlign(String) {
|
@:enum abstract VAlign(String) from String to String {
|
||||||
var NONE = "NONE";
|
var NONE = "NONE";
|
||||||
var TOP = "TOP";
|
var TOP = "TOP";
|
||||||
var MIDDLE = "MIDDLE";
|
var MIDDLE = "MIDDLE";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import flash.geom.Rectangle;
|
|||||||
import flash.display.BitmapData;
|
import flash.display.BitmapData;
|
||||||
import flash.display.Graphics;
|
import flash.display.Graphics;
|
||||||
|
|
||||||
@:enum abstract FillType(String) {
|
@:enum abstract FillType(String) from String to String {
|
||||||
var NONE = "NONE";
|
var NONE = "NONE";
|
||||||
var DEFAULT = "DEFAULT";
|
var DEFAULT = "DEFAULT";
|
||||||
var COVER = "COVER";
|
var COVER = "COVER";
|
||||||
|
|||||||
Reference in New Issue
Block a user