You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/10/30 01:51:33 UTC
[4/6] git commit: [flex-asjs] [refs/heads/develop] - fix autosizing
fix autosizing
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/22cf44dc
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/22cf44dc
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/22cf44dc
Branch: refs/heads/develop
Commit: 22cf44dc25905141a11911e80e62db8937d4e9e2
Parents: 776bfce
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 29 16:24:05 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Oct 29 16:24:05 2014 -0700
----------------------------------------------------------------------
.../apache/flex/html/beads/TextFieldViewBase.as | 31 ++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22cf44dc/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
index 8c423df..5ef80a9 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.beads
import org.apache.flex.core.CSSTextField;
import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutChild;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.ITextModel;
import org.apache.flex.core.IUIBase;
@@ -92,11 +93,18 @@ package org.apache.flex.html.beads
_textModel.addEventListener("htmlChange", htmlChangeHandler);
IEventDispatcher(_strand).addEventListener("widthChanged", widthChangeHandler);
IEventDispatcher(_strand).addEventListener("heightChanged", heightChangeHandler);
+ IEventDispatcher(_strand).addEventListener("sizeChanged", sizeChangeHandler);
DisplayObjectContainer(value).addChild(_textField);
if (_textModel.text !== null)
text = _textModel.text;
if (_textModel.html !== null)
html = _textModel.html;
+
+ var ilc:ILayoutChild = host as ILayoutChild;
+
+ autoHeight = ilc.isHeightSizedToContent();
+ autoWidth = ilc.isWidthSizedToContent();
+
}
/**
@@ -188,8 +196,8 @@ package org.apache.flex.html.beads
html = _textModel.html;
}
- private var autoHeight:Boolean = true;
- private var autoWidth:Boolean = true;
+ private var autoHeight:Boolean;
+ private var autoWidth:Boolean;
private var inHeightChange:Boolean = false;
private var inWidthChange:Boolean = false;
@@ -221,6 +229,25 @@ package org.apache.flex.html.beads
}
}
+ private function sizeChangeHandler(event:Event):void
+ {
+ var ilc:ILayoutChild = host as ILayoutChild;
+
+ autoHeight = ilc.isHeightSizedToContent();
+ if (!autoHeight)
+ {
+ textField.autoSize = "none";
+ textField.height = DisplayObject(_strand).height;
+ }
+
+ autoWidth = ilc.isWidthSizedToContent();
+ if (!autoWidth)
+ {
+ textField.autoSize = "none";
+ textField.width = DisplayObject(_strand).width;
+ }
+ }
+
/**
* @copy org.apache.flex.core.IBeadView#viewHeight
*