chore: cleanup

This commit is contained in:
Nathan Walker
2020-07-23 15:16:17 -07:00
parent 1e6fccf272
commit 47aa03a950
20 changed files with 103 additions and 119 deletions

View File

@@ -8,7 +8,7 @@ import { Color } from '../../color';
import { Trace } from '../../trace';
import { opacityProperty, backgroundColorProperty, rotateProperty, rotateXProperty, rotateYProperty, translateXProperty, translateYProperty, scaleXProperty, scaleYProperty, heightProperty, widthProperty, PercentLength } from '../styling/style-properties';
import { layout } from '../../utils';
import { Device, screen } from '../../platform';
import { Device, Screen } from '../../platform';
import lazy from '../../utils/lazy';
export * from './animation-common';
@@ -499,10 +499,10 @@ export class Animation extends AnimationBase {
throw new Error(`cannot animate ${propertyAnimation.property} on root view`);
}
const parentExtent: number = isVertical ? parent.getMeasuredHeight() : parent.getMeasuredWidth();
toValue = PercentLength.toDevicePixels(toValue, parentExtent, parentExtent) / screen.mainScreen.scale;
toValue = PercentLength.toDevicePixels(toValue, parentExtent, parentExtent) / Screen.mainScreen.scale;
let nativeHeight: number = isVertical ? nativeView.getHeight() : nativeView.getWidth();
const targetStyle: string = setLocal ? extentProperty.name : extentProperty.keyframe;
originalValue1 = nativeHeight / screen.mainScreen.scale;
originalValue1 = nativeHeight / Screen.mainScreen.scale;
nativeArray[0] = originalValue1;
nativeArray[1] = toValue;
let extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray);

View File

@@ -9,7 +9,7 @@ import { opacityProperty, backgroundColorProperty, rotateProperty, rotateXProper
import { iOSNativeHelper } from '../../utils/native-helper';
import { screen } from '../../platform';
import { Screen } from '../../platform';
export * from './animation-common';
export { KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './keyframe-animation';
@@ -263,7 +263,6 @@ export class Animation extends AnimationBase {
const style = view.style;
const nativeView = <UIView>view.nativeViewProtected;
const parent = view.parent as View;
const screenScale: number = screen.mainScreen.scale;
let propertyNameToAnimate = animation.property;
let subPropertyNameToAnimate;
@@ -388,7 +387,7 @@ export class Animation extends AnimationBase {
throw new Error(`cannot animate ${direction} on root view`);
}
const parentExtent: number = isHeight ? parent.getMeasuredHeight() : parent.getMeasuredWidth();
const asNumber = PercentLength.toDevicePixels(PercentLength.parse(toValue), parentExtent, parentExtent) / screenScale;
const asNumber = PercentLength.toDevicePixels(PercentLength.parse(toValue), parentExtent, parentExtent) / Screen.mainScreen.scale;
let currentBounds = nativeView.layer.bounds;
let extentX = isHeight ? currentBounds.size.width : asNumber;
let extentY = isHeight ? asNumber : currentBounds.size.height;