You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/11/28 02:45:21 UTC
[royale-asjs] 02/05: Spark Label can be multiline,
but should measure as single-line, at least for now
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 5dbcd09722d1117f32c46f1ebd1d0bfc2413b547
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Nov 27 18:42:54 2018 -0800
Spark Label can be multiline, but should measure as single-line, at least for now
---
.../src/main/royale/spark/components/Label.as | 22 ++++++++++++++++++++++
.../spark/components/supportClasses/TextBase.as | 2 +-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Label.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Label.as
index 8b8c5b3..4cfcaac 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Label.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Label.as
@@ -1689,6 +1689,28 @@ public class Label extends TextBase
if (firstLine)
staticTextBlock.releaseLines(firstLine, lastLine);
} */
+
+ COMPILE::JS
+ override public function get measuredWidth():Number
+ {
+ //when measuring, turn off wrapping
+ var oldValue:String = element.style.whiteSpace;
+ element.style.whiteSpace = "nowrap";
+ var mw:Number = super.measuredWidth;
+ element.style.whiteSpace = oldValue;
+ return mw;
+ }
+
+ COMPILE::JS
+ override public function get measuredHeight():Number
+ {
+ //when measuring, turn off wrapping
+ var oldValue:String = element.style.whiteSpace;
+ element.style.whiteSpace = "nowrap";
+ var mh:Number = super.measuredHeight;
+ element.style.whiteSpace = oldValue;
+ return mh;
+ }
}
}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/TextBase.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/TextBase.as
index 23f1b52..9274153 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/TextBase.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/TextBase.as
@@ -588,7 +588,7 @@ public class TextBase extends UIComponent
textNode = document.createTextNode(_text) as window.Text;
element.appendChild(textNode);
- element.style.whiteSpace = "nowrap";
+ //element.style.whiteSpace = "nowrap"; spark Label is multiline?
element.style.display = "inline-block";
return element;