This commit is contained in:
2015-09-11 10:31:33 +03:00
parent 56d8509f8a
commit d4acd11c86
8 changed files with 27 additions and 20 deletions

View File

@@ -14,11 +14,11 @@ class InputTextField extends TextField {
public function new() {
super();
#if flash
//#if flash
type = TextFieldType.INPUT;
#elseif js
addEventListener(MouseEvent.CLICK, onMouseClick);
#end
//#elseif js
//addEventListener(MouseEvent.CLICK, onMouseClick);
//#end
}
#if js

View File

@@ -1,5 +1,6 @@
package haxework.gui;
import flash.text.TextFormatAlign;
import haxework.dispath.Dispatcher;
import haxework.dispath.IDispatcher;
import flash.events.Event;
@@ -29,6 +30,7 @@ class InputView extends TextView implements IDisposable {
hintTextField = buildHintTextField();
contentAsSprite.addChild(hintTextField);
textFormat.align = TextFormatAlign.LEFT;
}
override private function buildTextField():TextField {

View File

@@ -18,7 +18,7 @@ class SpriteView extends View {
#if dev_layout
override public function update():Void {
super.update();
var g:Graphics = content.graphics;
var g:Graphics = contentAsSprite.graphics;
g.lineStyle(1, 0x00ff00);
g.drawRect(0, 0, width, height);
g.lineStyle();

View File

@@ -191,12 +191,12 @@ class TextView extends SpriteView implements ITextView {
placeTextField(textField);
}
//ToDo:
var t:Point = content.localToGlobal(new Point(textField.x, textField.y));
t.x = Math.round(t.x);
t.y = Math.round(t.y);
t = content.globalToLocal(t);
textField.x = t.x;
textField.y = t.y;
//var t:Point = content.localToGlobal(new Point(textField.x, textField.y));
//t.x = Math.round(t.x);
//t.y = Math.round(t.y);
//t = content.globalToLocal(t);
//textField.x = t.x;
//textField.y = t.y;
super.update();
}

View File

@@ -70,7 +70,7 @@ class Builder {
case "link":
"(links == null) ? untyped this : Reflect.field(links, \"" + a[1] + "\")";
case _:
throw "Unsupported prefix \"" + a[0] + "\"";
Context.error("Unsupported prefix \"" + a[0] + "\"", getPosition(position));
}
}
@@ -93,7 +93,12 @@ class Builder {
if (Reflect.hasField(value, "@type")) {
var n = "a" + i++;
var type = Reflect.field(value, "@type");
exprs.push(Context.parse("var " + n + " = new " + type + "()", getPosition(position)));
if (type == "Dynamic") {
//ToDo:
exprs.push(Context.parse("var " + n + " = cast {}", getPosition(position)));
} else {
exprs.push(Context.parse("var " + n + " = new " + type + "()", getPosition(position)));
}
createElement(value, n);
n;
} else {

View File

@@ -1,15 +1,16 @@
package haxework.provider;
import haxework.net.manage.LoaderManager;
import haxework.net.manage.ILoaderManager;
import haxe.ds.ObjectMap;
class Provider {
//private static var factories:ObjectMap<Dynamic, Class<Dynamic>> = new ObjectMap<Dynamic, Class<Dynamic>>();
private static var factories:ObjectMap<Dynamic, Class<Dynamic>> = cast [
ILoaderManager => LoaderManager
#if (!neko)
haxework.net.manage.LoaderManager => haxework.net.manage.ILoaderManager
#end
];
private static var args:ObjectMap<Dynamic, Array<Dynamic>> = new ObjectMap<Dynamic, Array<Dynamic>>();
private static var instances:ObjectMap<Dynamic, Dynamic> = new ObjectMap<Dynamic, Dynamic>();
@@ -31,7 +32,7 @@ class Provider {
instances.set(key, instance);
return instance;
} else {
throw "Factory for\"" + i + "\" not found";
throw "Factory for\" " + i + "\" not found";
}
}

View File

@@ -19,7 +19,7 @@ class TextUtil {
var _textWidth = textField.width;
#else
var _textWidth = textField.textWidth;
var _textHeight = textField.textHeight;// * K_HEIGHT;
var _textHeight = textField.textHeight * K_HEIGHT;
#end
return new Point(_textWidth, _textHeight);
}