0 Replies Latest reply on Dec 16, 2009 5:51 PM by Jason Szeto

    [svn:fx-trunk] 13026: UITextField and UIFTETextField measurement fixes

    Jason Szeto Level 3

      Revision: 13026

      Revision: 13026

      Author:   jszeto@adobe.com

      Date:     2009-12-16 17:51:29 -0800 (Wed, 16 Dec 2009)

      Log Message:


      UITextField and UIFTETextField measurement fixes


      http://bugs.adobe.com/jira/browse/SDK-24687 - DateField does not position month/year as expected in date dropDown

      when scale is applied


      UITextField and UIFTETextField were returning incorrect values for measuredHeight and measuredWidth when an ancestor was scaled.


      UITextField works around a quirk of a scaled TextField. When using device fonts, textWidth and textHeight return a value modified by scale (when it really shouldn't).


      I?\226?\128?\153ll use the term "scaledWidth" and "scaledHeight" to represent the actual pixel dimensions of a scaled textField. This is the dimensions of the textField as it appears on the screen.


      textWidth = scaledWidth / scaleX

      textHeight = scaledHeight / scaleX


      To calculate the unscaled textWidth and textHeight, we need to multiply textWidth and textHeight by scaleX / scaleY.


      unscaled textWidth = textWidth * scaleX / scaleY

      unscaled textHeight = textHeight * scaleX / scaleY


      UIFTETextField properly returns textWidth and textHeight properties even when scaled. So measuredWidth and measuredHeight can just use textWidth and textHeight when using device or embedded fonts.


      DateChooser was measuring and laying itself out before it was added to the stage (which is true for all components in an application). Thus it was not getting the correct measurements for the month and year textFields. The fix is to listen for the addedToStage event and invalidate our size if scaleX or scaleY != 1.


      QE notes: Add tests for scaled DateChooser and DateField

      Doc notes: None

      Bugs: SDK-24687

      Reviewer: Alex

      Tests run: checkintests, DateChooser, DateField

      Is noteworthy for integration: No


      Ticket Links:





      Modified Paths: