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

harbs pushed a commit to branch feature/layout-optimization
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/layout-optimization by 
this push:
     new dee6ccf  Seems to be about twice as fast
dee6ccf is described below

commit dee6ccf2b680a9e374957a96d00171d675e3adf3
Author: Harbs <[email protected]>
AuthorDate: Mon Mar 26 15:31:22 2018 +0300

    Seems to be about twice as fast
---
 .../apache/royale/html/beads/NumericStepperView.as | 36 ++++++++++++++++------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/NumericStepperView.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/NumericStepperView.as
index 0529771..446d426 100644
--- 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/NumericStepperView.as
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/NumericStepperView.as
@@ -72,6 +72,8 @@ package org.apache.royale.html.beads
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
                 *  @productversion Royale 0.0
+                *  @royaleignorecoercion org.apache.royale.core.IUIBase
+                * @royaleignorecoercion org.apache.royale.core.IParent
                 */
                override public function set strand(value:IStrand):void
                {
@@ -81,7 +83,7 @@ package org.apache.royale.html.beads
                        input = new TextInput();
             input.className = "NumericStepperInput";
             input.typeNames = "NumericStepperInput";
-                       IParent(value).addElement(input);
+                       (value as IParent).addElement(input);
                        COMPILE::JS
                        {
                    input.positioner.style.display = 'inline-block';
@@ -89,10 +91,14 @@ package org.apache.royale.html.beads
                        }
                        // add a spinner
                        spinner = new Spinner();
-                       spinner.addBead( UIBase(value).model as IBead );
-                       IParent(value).addElement(spinner);
-                       spinner.height = input.height;
-                       spinner.width = input.height/2;
+                       spinner.addBead( (value as UIBase).model as IBead );
+                       (value as IParent).addElement(spinner);
+                       // delay this until the resize event in JS
+                       COMPILE::SWF
+                       {
+                               spinner.height = input.height;
+                               spinner.width = input.height/2;
+                       }
                        COMPILE::JS
                        {
                    spinner.positioner.style.display = 'inline-block';
@@ -140,23 +146,33 @@ package org.apache.royale.html.beads
                
                /**
                 * @private
+                * @royaleignorecoercion org.apache.royale.core.UIBase
                 */
                private function sizeChangeHandler(event:Event) : void
                {
+                       // first reads
+                       var widthToContent:Boolean = (_strand as 
UIBase).isWidthSizedToContent();
+                       var inputWidth:Number = input.width;
+                       var inputHeight:Number = input.height;
+                       var strandWidth:Number;
+                       if (!widthToContent)
+                       {
+                               strandWidth = (_strand as UIBase).width;
+                       }
                        COMPILE::JS
                        {
-                               spinner.height = input.height;
-                               spinner.width = input.height/2;
+                               spinner.height = inputHeight;
+                               spinner.width = inputHeight/2;
                        }
                        
                        input.x = 0;
                        input.y = 0;
-                       if (!UIBase(_strand).isWidthSizedToContent())
-                               input.width = 
UIBase(_strand).width-spinner.width-2;
+                       if (!widthToContent)
+                               input.width = strandWidth - spinner.width - 2;
                        
                        COMPILE::SWF
                        {
-                               spinner.x = input.width;
+                               spinner.x = inputWidth;
                                spinner.y = 0;
                        }
                }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to