(view: View)
| 945 | } |
| 946 | |
| 947 | function calculateTransform(view: View): CATransform3D { |
| 948 | const scaleX = view.scaleX || 1e-6; |
| 949 | const scaleY = view.scaleY || 1e-6; |
| 950 | const perspective = view.perspective || 300; |
| 951 | |
| 952 | // Order is important: translate, rotate, scale |
| 953 | let expectedTransform = new CATransform3D(CATransform3DIdentity); |
| 954 | |
| 955 | // Only set perspective if there is 3D rotation |
| 956 | if (view.rotateX || view.rotateY) { |
| 957 | expectedTransform.m34 = -1 / perspective; |
| 958 | } |
| 959 | |
| 960 | expectedTransform = CATransform3DTranslate(expectedTransform, view.translateX, view.translateY, 0); |
| 961 | expectedTransform = iosHelper.applyRotateTransform(expectedTransform, view.rotateX, view.rotateY, view.rotate); |
| 962 | expectedTransform = CATransform3DScale(expectedTransform, scaleX, scaleY, 1); |
| 963 | |
| 964 | return expectedTransform; |
| 965 | } |
| 966 | |
| 967 | function getCATransform3DString(t: CATransform3D) { |
| 968 | return `[ |
no outgoing calls
no test coverage detected