[view] fix view size
This commit is contained in:
@@ -28,7 +28,7 @@ import haxework.view.theme.ITheme;
|
||||
public var width(default, null):Float;
|
||||
public var height(default, null):Float;
|
||||
|
||||
public var size(default, null):Size;
|
||||
public var size(default, null):SizeSet;
|
||||
|
||||
public var content(default, null):C;
|
||||
|
||||
@@ -40,12 +40,9 @@ import haxework.view.theme.ITheme;
|
||||
|
||||
public var rect(get, null):Rectangle;
|
||||
|
||||
private var sizeSet:SizeSet;
|
||||
|
||||
public function new(content:C) {
|
||||
id = Type.getClassName(Type.getClass(this)) + counter++;
|
||||
sizeSet = new SizeSet();
|
||||
size = 0;
|
||||
size = new SizeSet();
|
||||
this.content = content;
|
||||
x = 0;
|
||||
y = 0;
|
||||
@@ -90,13 +87,10 @@ import haxework.view.theme.ITheme;
|
||||
}
|
||||
|
||||
public function setSize(width:Float, height:Float, type:String = "default"):Void {
|
||||
if (sizeSet.update([width, height], type)) {
|
||||
var s = sizeSet.toSize();
|
||||
if (size.update([width, height], type)) {
|
||||
var s = size.toSize();
|
||||
this.width = s.width + geometry.padding.horizontal;
|
||||
this.height = s.height + geometry.padding.vertical;
|
||||
size = sizeSet.toSize(false);
|
||||
size.width += geometry.padding.horizontal;
|
||||
size.height += geometry.padding.vertical;
|
||||
toUpdateParent();
|
||||
toRedraw();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user