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
The following commit(s) were added to refs/heads/develop by this push:
new c15c82e better measuredWidth for RB to prevent line wrapping. Should
fix #790
c15c82e is described below
commit c15c82ef322e1e08e1d46a98e3239fb4969f7a1c
Author: Alex Harui <[email protected]>
AuthorDate: Sun Mar 29 23:51:24 2020 -0700
better measuredWidth for RB to prevent line wrapping. Should fix #790
---
.../MXRoyale/src/main/royale/mx/controls/RadioButton.as | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as
index d9ab984..5ce610b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as
@@ -223,7 +223,7 @@ public class RadioButton extends Button
COMPILE::JS
private var labelFor:HTMLLabelElement;
COMPILE::JS
- private var textNode:window.Text;
+ private var textNode:HTMLSpanElement;
COMPILE::JS
private var rbicon:RadioButtonIcon;
@@ -242,7 +242,7 @@ public class RadioButton extends Button
rbicon = new RadioButtonIcon()
rbicon.id = '_radio_' + RadioButton.radioCounter++;
- textNode = document.createTextNode('') as window.Text;
+ textNode = document.createElement('span') as HTMLSpanElement;
labelFor = addElementToWrapper(this,'label') as HTMLLabelElement;
labelFor.appendChild(rbicon.element);
@@ -299,13 +299,13 @@ public class RadioButton extends Button
COMPILE::JS
override public function get label():String
{
- return textNode.nodeValue as String;
+ return textNode.innerText as String;
}
COMPILE::JS
override public function set label(value:String):void
{
- textNode.nodeValue = value;
+ textNode.innerText = value;
}
/**
@@ -521,6 +521,12 @@ public class RadioButton extends Button
override public function get measuredWidth():Number
{
+ COMPILE::JS
+ {
+ // Safari seems to like 6
+ var ww:Number = rbicon.element.offsetWidth +
textNode.offsetWidth + 6;
+ return ww;
+ }
// on Safari, we seem to come up one pixel short sometimes
// causing the label to appear on another line if the
// width is set the the measuredWidth. Probably a fractional error.