fixes
This commit is contained in:
@@ -1,8 +1,15 @@
|
|||||||
package haxework.core;
|
package haxework.core;
|
||||||
|
|
||||||
class Const {
|
class Const {
|
||||||
|
#if flash
|
||||||
public static var UINT_MAX_VALUE:UInt = untyped __global__["uint"].MAX_VALUE;
|
public static var UINT_MAX_VALUE:UInt = untyped __global__["uint"].MAX_VALUE;
|
||||||
public static var UINT_MIN_VALUE:UInt = untyped __global__["uint"].MIN_VALUE;
|
public static var UINT_MIN_VALUE:UInt = untyped __global__["uint"].MIN_VALUE;
|
||||||
public static var INT_MAX_VALUE:Int = untyped __global__["int"].MAX_VALUE;
|
public static var INT_MAX_VALUE:Int = untyped __global__["int"].MAX_VALUE;
|
||||||
public static var INT_MIN_VALUE:Int = untyped __global__["int"].MIN_VALUE;
|
public static var INT_MIN_VALUE:Int = untyped __global__["int"].MIN_VALUE;
|
||||||
|
#else
|
||||||
|
public static var UINT_MAX_VALUE:UInt = 0xffffffff;
|
||||||
|
public static var UINT_MIN_VALUE:UInt = 0;
|
||||||
|
public static var INT_MAX_VALUE:Int = 0xffffffff;
|
||||||
|
public static var INT_MIN_VALUE:Int = -0xffffffff;
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,15 @@ import haxework.gui.skin.ISkin;
|
|||||||
import haxework.gui.core.SizeType;
|
import haxework.gui.core.SizeType;
|
||||||
|
|
||||||
typedef Content = {
|
typedef Content = {
|
||||||
var x:Float;
|
#if flash
|
||||||
var y:Float;
|
var x(default,default):Float;
|
||||||
var visible:Bool;
|
var y(default,default):Float;
|
||||||
|
var visible(default,default):Bool;
|
||||||
|
#else
|
||||||
|
var x(get,set):Float;
|
||||||
|
var y(get,set):Float;
|
||||||
|
var visible(get,set):Bool;
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IView<C:Content> {
|
interface IView<C:Content> {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package haxework.gui;
|
package haxework.gui;
|
||||||
|
|
||||||
|
import haxework.dispath.Dispatcher;
|
||||||
|
import haxework.dispath.IDispatcher;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
import flash.text.TextFormat;
|
import flash.text.TextFormat;
|
||||||
import flash.text.TextFieldAutoSize;
|
import flash.text.TextFieldAutoSize;
|
||||||
@@ -13,11 +15,13 @@ import flash.text.TextFieldType;
|
|||||||
class InputView extends TextView implements IDisposable {
|
class InputView extends TextView implements IDisposable {
|
||||||
|
|
||||||
public var hint(default, set):String;
|
public var hint(default, set):String;
|
||||||
|
public var dispatcher(default, null):IDispatcher<InputViewListener>;
|
||||||
|
|
||||||
private var hintTextField:TextField;
|
private var hintTextField:TextField;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
|
dispatcher = new Dispatcher<InputViewListener>();
|
||||||
textField.type = TextFieldType.INPUT;
|
textField.type = TextFieldType.INPUT;
|
||||||
textField.addEventListener(Event.CHANGE, onTextChange);
|
textField.addEventListener(Event.CHANGE, onTextChange);
|
||||||
textField.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
|
textField.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
|
||||||
@@ -51,6 +55,7 @@ class InputView extends TextView implements IDisposable {
|
|||||||
|
|
||||||
private function onKeyUp(event:KeyboardEvent):Void {
|
private function onKeyUp(event:KeyboardEvent):Void {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
dispatcher.dispatch(function(listener) listener.onKeyUp(textField.text));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onKeyDown(event:KeyboardEvent):Void {
|
private function onKeyDown(event:KeyboardEvent):Void {
|
||||||
@@ -73,3 +78,7 @@ class InputView extends TextView implements IDisposable {
|
|||||||
textField.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
|
textField.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef InputViewListener = {
|
||||||
|
public function onKeyUp(text:String):Void;
|
||||||
|
}
|
||||||
@@ -87,7 +87,12 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
|
|||||||
|
|
||||||
private function set_align(value:TextFormatAlign):TextFormatAlign {
|
private function set_align(value:TextFormatAlign):TextFormatAlign {
|
||||||
if (align != value) {
|
if (align != value) {
|
||||||
textFormat.align = align = value;
|
align = value;
|
||||||
|
#if (flash || html5)
|
||||||
|
textFormat.align = value;
|
||||||
|
#else
|
||||||
|
textFormat.align = Std.string(value);
|
||||||
|
#end
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
return align;
|
return align;
|
||||||
|
|||||||
@@ -45,9 +45,13 @@ class BaseURLLoader<T> extends BaseLoader<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override private function internalFromBytes(data:ByteArray):Void {
|
override private function internalFromBytes(data:ByteArray):Void {
|
||||||
var data:T = extrudeResultFromBytes(data);
|
|
||||||
var c:ICallback<T> = callback;
|
var c:ICallback<T> = callback;
|
||||||
c.callSuccessAsync(data);
|
if (data == null) {
|
||||||
|
c.callFailAsync("Content not found");
|
||||||
|
} else {
|
||||||
|
var data:T = extrudeResultFromBytes(data);
|
||||||
|
c.callSuccessAsync(data);
|
||||||
|
}
|
||||||
Timer.delay(dispose, 1);
|
Timer.delay(dispose, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user