This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 1348433038153354feafd8a55d9179ce38fdeb86
Author: greg-dove <[email protected]>
AuthorDate: Tue Mar 31 20:25:50 2026 +1300

    Fix/optimize Checkbox bindings and more layout tweaks for CheckBox.
---
 .../main/royale/org/apache/royale/style/CheckBox.as  | 20 ++++++++++++--------
 .../org/apache/royale/style/skins/CheckBoxSkin.as    | 11 ++++++-----
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/CheckBox.as 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/CheckBox.as
index c96672c244..b88f73c29f 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/CheckBox.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/CheckBox.as
@@ -24,6 +24,7 @@ package org.apache.royale.style
                import org.apache.royale.core.WrappedHTMLElement;
        }
        import org.apache.royale.events.Event;
+       import org.apache.royale.events.ValueChangeEvent;
        import org.apache.royale.core.IHasLabel;
        import org.apache.royale.style.elements.Div;
        import org.apache.royale.style.elements.Span;
@@ -50,7 +51,7 @@ package org.apache.royale.style
                        //useWrapperStyle = true;
                }
                private var _labelPlacement:String = "right";
-               [Bindable]
+               
[Bindable(event='valueChange',type='org.apache.royale.events.ValueChangeEvent')]
                public function get labelPlacement():String
                {
                        return _labelPlacement;
@@ -59,6 +60,7 @@ package org.apache.royale.style
                public function set labelPlacement(value:String):void
                {
                        if(_labelPlacement != value){
+                               var oldVal:String = _labelPlacement;
                                _labelPlacement = value;
                                if(_stylesLoaded)
                                {
@@ -66,6 +68,7 @@ package org.apache.royale.style
                                                (skin as 
ICheckBoxSkin).updateStyles();
                                        applySkin();
                                }
+                               
dispatchEvent(ValueChangeEvent.createUpdateEvent(this,'labelPlacement',oldVal,value))
                        }
                }
                COMPILE::JS
@@ -73,11 +76,7 @@ package org.apache.royale.style
                
                COMPILE::JS
                private function elementClicked():void{
-                       // _indeterminate = input.indeterminate = false;// 
input.indeterminate should be resolved automatically.
-                       _indeterminate = false;
-                       _checked = input.checked;
-                       if(_stylesLoaded && !checkIcon)
-                               applyCheckSkin();
+                       processCheckedChange(input.checked, false)
                }
                
                override protected function getTag():String
@@ -275,7 +274,7 @@ package org.apache.royale.style
                }
                private var checkIcon:IStyleUIBase;
                private var _checked:Boolean;
-               [Bindable]
+               
[Bindable(event='valueChange',type='org.apache.royale.events.ValueChangeEvent')]
                public function get checked():Boolean
                {
                        return _checked;
@@ -283,6 +282,10 @@ package org.apache.royale.style
 
                public function set checked(value:Boolean):void
                {
+                       processCheckedChange(value,true);
+               }
+               
+               private function 
processCheckedChange(value:Boolean,programmatic:Boolean):void{
                        COMPILE::JS
                        {
                                if(value != !!_checked){
@@ -290,7 +293,8 @@ package org.apache.royale.style
                                        _indeterminate = input.indeterminate = 
false;
                                        if(_stylesLoaded && !checkIcon)
                                                applyCheckSkin();
-                                       input.checked = value;
+                                       if (programmatic) input.checked = value;
+                                       
dispatchEvent(ValueChangeEvent.createUpdateEvent(this,'checked',!value,value));
                                }
                        }
                }
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/CheckBoxSkin.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/CheckBoxSkin.as
index b40863631a..21b3b275b0 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/CheckBoxSkin.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/CheckBoxSkin.as
@@ -125,7 +125,7 @@ package org.apache.royale.style.skins
                                layoutStyles.push(new 
GridTemplateRows(rowTemplate));
                                layoutStyles.push(new 
GridTemplateColumns("auto"));
                                layoutStyles.push(new JustifyItems("center"));
-                               layoutStyles.push(new AlignItems("flex-start"));
+                               layoutStyles.push(new AlignItems("center"));
                                layoutStyles.push(new RowGap(gap));
                                padding.right = gap;
                        }
@@ -136,7 +136,7 @@ package org.apache.royale.style.skins
                                var colTemplate:String = (placement == "left") 
? "auto " + box : box + " auto";
                                layoutStyles.push(new 
GridTemplateColumns(colTemplate));
                                layoutStyles.push(new GridTemplateRows("auto"));
-                               layoutStyles.push(new AlignItems("flex-start"));
+                               layoutStyles.push(new AlignItems("center"));
                                layoutStyles.push(new ColumnGap(gap));
                                padding.right = gap;
                        }
@@ -405,6 +405,7 @@ package org.apache.royale.style.skins
                                
                                _indeterminateIcon = new Div();
                                var size:Number = 16 * getMultiplier();
+                               var unit:String = host.unit;
 
                                var boxColumn:String = "1";
                                var boxRow:String = "1";
@@ -422,12 +423,12 @@ package org.apache.royale.style.skins
                                        boxColumn = "1";
                                        boxRow = "1";
                                }
-
+                               
                                var styles:Array = [
                                        new GridColumnStart(boxColumn),
                                        new GridRowStart(boxRow),
-                                       new HeightStyle("14%"),
-                                       new WidthStyle(computeSize(size * 
0.625, host.unit)),
+                                       new 
HeightStyle(/*"14%"*/computeSize(size * 0.175,unit)), //note 0.175 is 14% of 
1.25
+                                       new WidthStyle(computeSize(size * 
0.625, unit)),
                                        new AlignSelf("center"),
                                        new PlaceSelf("center"),
                                        new 
BorderRadius(ThemeManager.instance.activeTheme.radiusSM),

Reply via email to