@@ -750,10 +750,11 @@ ccs.UILayout = ccs.UIWidget.extend(/** @lends ccs.UILayout# */{
750750 default :
751751 break ;
752752 }
753- var locRelativeWidgetMargin ;
753+ var locRelativeWidgetMargin , locRelativeWidgetLPAlign ;
754754 var locMargin = locLayoutParameter . getMargin ( ) ;
755755 if ( locRelativeWidgetLP ) {
756756 locRelativeWidgetMargin = locRelativeWidgetLP . getMargin ( ) ;
757+ locRelativeWidgetLPAlign = locRelativeWidgetLP . getAlign ( ) ;
757758 }
758759 //handle margin
759760 switch ( locAlign ) {
@@ -791,63 +792,63 @@ ccs.UILayout = ccs.UIWidget.extend(/** @lends ccs.UILayout# */{
791792
792793 case ccs . UIRelativeAlign . locationAboveLeftAlign :
793794 locFinalPosY += locMargin . bottom ;
794- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopCenterHorizontal
795- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopLeft
796- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignNone
797- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopRight )
795+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopCenterHorizontal
796+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopLeft
797+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignNone
798+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopRight )
798799 {
799800 locFinalPosY += locRelativeWidgetMargin . top ;
800801 }
801802 locFinalPosY += locMargin . left ;
802803 break ;
803804 case ccs . UIRelativeAlign . locationAboveCenter :
804805 locFinalPosY += locMargin . bottom ;
805- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopCenterHorizontal
806- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopLeft
807- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignNone
808- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopRight )
806+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopCenterHorizontal
807+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopLeft
808+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignNone
809+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopRight )
809810 {
810811 locFinalPosY += locRelativeWidgetMargin . top ;
811812 }
812813 break ;
813814 case ccs . UIRelativeAlign . locationAboveRightAlign :
814815 locFinalPosY += locMargin . bottom ;
815- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopCenterHorizontal
816- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopLeft
817- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignNone
818- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopRight )
816+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopCenterHorizontal
817+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopLeft
818+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignNone
819+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopRight )
819820 {
820821 locFinalPosY += locRelativeWidgetMargin . top ;
821822 }
822823 locFinalPosX -= locMargin . right ;
823824 break ;
824825 case ccs . UIRelativeAlign . locationLeftOfTopAlign :
825826 locFinalPosX -= locMargin . right ;
826- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopLeft
827- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignNone
828- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftBottom
829- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftCenterVertical )
827+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopLeft
828+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignNone
829+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftBottom
830+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftCenterVertical )
830831 {
831832 locFinalPosX -= locRelativeWidgetMargin . left ;
832833 }
833834 locFinalPosY -= locMargin . top ;
834835 break ;
835836 case ccs . UIRelativeAlign . locationLeftOfCenter :
836837 locFinalPosX -= locMargin . right ;
837- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopLeft
838- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignNone
839- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftBottom
840- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftCenterVertical )
838+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopLeft
839+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignNone
840+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftBottom
841+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftCenterVertical )
841842 {
842843 locFinalPosX -= locRelativeWidgetMargin . left ;
843844 }
844845 break ;
845846 case ccs . UIRelativeAlign . locationLeftOfBottomAlign :
846847 locFinalPosX -= locMargin . right ;
847- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopLeft
848- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignNone
849- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftBottom
850- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftCenterVertical )
848+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopLeft
849+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignNone
850+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftBottom
851+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftCenterVertical )
851852 {
852853 locFinalPosX -= locRelativeWidgetMargin . left ;
853854 }
@@ -856,28 +857,28 @@ ccs.UILayout = ccs.UIWidget.extend(/** @lends ccs.UILayout# */{
856857 break ;
857858 case ccs . UIRelativeAlign . locationRightOfTopAlign :
858859 locFinalPosX += locMargin . left ;
859- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopRight
860- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightBottom
861- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightCenterVertical )
860+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopRight
861+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightBottom
862+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightCenterVertical )
862863 {
863864 locFinalPosX += locRelativeWidgetMargin . right ;
864865 }
865866 locFinalPosY -= locMargin . top ;
866867 break ;
867868 case ccs . UIRelativeAlign . locationRightOfCenter :
868869 locFinalPosX += locMargin . left ;
869- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopRight
870- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightBottom
871- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightCenterVertical )
870+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopRight
871+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightBottom
872+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightCenterVertical )
872873 {
873874 locFinalPosX += locRelativeWidgetMargin . right ;
874875 }
875876 break ;
876877 case ccs . UIRelativeAlign . locationRightOfBottomAlign :
877878 locFinalPosX += locMargin . left ;
878- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentTopRight
879- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightBottom
880- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightCenterVertical )
879+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentTopRight
880+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightBottom
881+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightCenterVertical )
881882 {
882883 locFinalPosX += locRelativeWidgetMargin . right ;
883884 }
@@ -886,28 +887,28 @@ ccs.UILayout = ccs.UIWidget.extend(/** @lends ccs.UILayout# */{
886887 break ;
887888 case ccs . UIRelativeAlign . locationBelowLeftAlign :
888889 locFinalPosY -= locMargin . top ;
889- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftBottom
890- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightBottom
891- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentBottomCenterHorizontal )
890+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftBottom
891+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightBottom
892+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentBottomCenterHorizontal )
892893 {
893894 locFinalPosY -= locRelativeWidgetMargin . bottom ;
894895 }
895896 locFinalPosX += locMargin . left ;
896897 break ;
897898 case ccs . UIRelativeAlign . locationBelowCenter :
898899 locFinalPosY -= locMargin . top ;
899- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftBottom
900- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightBottom
901- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentBottomCenterHorizontal )
900+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftBottom
901+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightBottom
902+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentBottomCenterHorizontal )
902903 {
903904 locFinalPosY -= locRelativeWidgetMargin . bottom ;
904905 }
905906 break ;
906907 case ccs . UIRelativeAlign . locationBelowRightAlign :
907908 locFinalPosY -= locMargin . top ;
908- if ( locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentLeftBottom
909- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentRightBottom
910- && locRelativeWidgetLP . getAlign ( ) != ccs . UIRelativeAlign . alignParentBottomCenterHorizontal )
909+ if ( locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentLeftBottom
910+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentRightBottom
911+ && locRelativeWidgetLPAlign != ccs . UIRelativeAlign . alignParentBottomCenterHorizontal )
911912 {
912913 locFinalPosY -= locRelativeWidgetMargin . bottom ;
913914 }
0 commit comments