@@ -5,62 +5,59 @@ import { Screen } from "@nativescript/core/platform";
55export class AbsoluteLayout extends Common {
66 public initNativeView ( ) : void {
77 super . initNativeView ( ) ;
8- this . _updateDirection ( ) ;
8+ this . scheduleDirectionUpdate ( ) ;
99 }
1010
1111 [ isRtlProperty . setNative ] ( isRtl : boolean ) : void {
1212 this . isRtl = isRtl ;
13- this . _updateDirection ( ) ;
13+ this . scheduleDirectionUpdate ( ) ;
1414 }
1515
1616 public addChild ( view : View ) : void {
1717 super . addChild ( view ) ;
1818 if ( view . nativeViewProtected ) {
19- this . _updateDirection ( ) ;
19+ this . scheduleDirectionUpdate ( ) ;
2020 }
2121 }
2222
2323 public removeChild ( view : View ) : void {
2424 super . removeChild ( view ) ;
2525 if ( view . nativeViewProtected ) {
26- this . _updateDirection ( ) ;
26+ this . scheduleDirectionUpdate ( ) ;
2727 }
2828 }
2929
30- private _updateDirection ( ) : void {
30+ protected _updateDirection ( ) : void {
3131 let ZeroRotation = CATransform3DRotate ( CATransform3DIdentity , 0.0 , 0.0 , 0.0 , 0.0 ) ;
3232 let RotationInYAxis180Deg = CATransform3DRotate ( CATransform3DIdentity , ( 180 * Math . PI ) / 180.0 , 0.0 , 1.0 , 0.0 ) ;
33-
34- setTimeout ( ( ) => {
35- if ( this . isRtl ) {
36- this . nativeViewProtected . layer . transform = RotationInYAxis180Deg ;
37- for (
38- let viewIndex = 0 ;
39- viewIndex < this [ "getChildrenCount" ] ( ) ;
40- viewIndex ++
41- ) {
42- let NSView : View = this [ "getChildAt" ] ( viewIndex ) ;
43- let isRtl : boolean = NSView [ "isRtl" ] || false ;
44- if ( isRtl ) {
45- NSView . nativeView . layer . transform = ZeroRotation ;
46- } else {
47- NSView . nativeView . layer . transform = RotationInYAxis180Deg ;
48- }
49- NSView . nativeViewProtected . layer . rasterizationScale = Screen . mainScreen . scale ;
50- }
51- this . nativeViewProtected . layer . rasterizationScale = Screen . mainScreen . scale ;
52- } else {
53- this . nativeViewProtected . layer . transform = ZeroRotation ;
54- for (
55- let viewIndex = 0 ;
56- viewIndex < this [ "getChildrenCount" ] ( ) ;
57- viewIndex ++
58- ) {
59- let NSView : View = this [ "getChildAt" ] ( viewIndex ) ;
33+ if ( this . isRtl ) {
34+ this . nativeViewProtected . layer . transform = RotationInYAxis180Deg ;
35+ for (
36+ let viewIndex = 0 ;
37+ viewIndex < this [ "getChildrenCount" ] ( ) ;
38+ viewIndex ++
39+ ) {
40+ let NSView : View = this [ "getChildAt" ] ( viewIndex ) ;
41+ let isRtl : boolean = NSView [ "isRtl" ] || false ;
42+ if ( isRtl ) {
6043 NSView . nativeView . layer . transform = ZeroRotation ;
61- NSView . nativeViewProtected . layer . rasterizationScale = Screen . mainScreen . scale ;
44+ } else {
45+ NSView . nativeView . layer . transform = RotationInYAxis180Deg ;
6246 }
47+ NSView . nativeViewProtected . layer . rasterizationScale = Screen . mainScreen . scale ;
6348 }
64- } , 1 ) ;
49+ this . nativeViewProtected . layer . rasterizationScale = Screen . mainScreen . scale ;
50+ } else {
51+ this . nativeViewProtected . layer . transform = ZeroRotation ;
52+ for (
53+ let viewIndex = 0 ;
54+ viewIndex < this [ "getChildrenCount" ] ( ) ;
55+ viewIndex ++
56+ ) {
57+ let NSView : View = this [ "getChildAt" ] ( viewIndex ) ;
58+ NSView . nativeView . layer . transform = ZeroRotation ;
59+ NSView . nativeViewProtected . layer . rasterizationScale = Screen . mainScreen . scale ;
60+ }
61+ }
6562 }
6663}
0 commit comments