[view] add SelectView
This commit is contained in:
@@ -2,9 +2,10 @@ package haxework.view;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.InteractiveObject;
|
||||
import flash.geom.Rectangle;
|
||||
import haxework.resources.IResources;
|
||||
import haxework.view.core.Geometry;
|
||||
import haxework.view.skin.ISkin;
|
||||
import haxework.resources.IResources;
|
||||
|
||||
class View<C:DisplayObject> implements IView<C> {
|
||||
@:provide private var r:IResources;
|
||||
@@ -32,6 +33,8 @@ class View<C:DisplayObject> implements IView<C> {
|
||||
public var index(default, set):Int;
|
||||
public var mouseEnabled(default, set):Bool = true;
|
||||
|
||||
public var rect(get, null):Rectangle;
|
||||
|
||||
public function new(content:C) {
|
||||
id = Type.getClassName(Type.getClass(this)) + counter++;
|
||||
this.content = content;
|
||||
@@ -160,4 +163,16 @@ class View<C:DisplayObject> implements IView<C> {
|
||||
}
|
||||
return mouseEnabled;
|
||||
}
|
||||
|
||||
private function get_rect():Rectangle {
|
||||
var x = this.x;
|
||||
var y = this.y;
|
||||
var parent = this.parent;
|
||||
while (parent != null) {
|
||||
x += parent.x;
|
||||
y += parent.y;
|
||||
parent = parent.parent;
|
||||
}
|
||||
return new Rectangle(x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user