refactor: refactor

This commit is contained in:
Martin Yankov
2019-05-09 09:38:09 +03:00
parent 08fae2fb8e
commit f189152a4b
3 changed files with 5 additions and 16 deletions

View File

@@ -10,9 +10,8 @@ import {
} from "../styling/style-properties";
import { layout } from "../../utils/utils";
import { device } from "../../platform";
import { device, screen } from "../../platform";
import lazy from "../../utils/lazy";
import * as platform from "../../platform";
export * from "./animation-common";
interface AnimationDefinitionInternal extends AnimationDefinition {
@@ -467,10 +466,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) / platform.screen.mainScreen.scale;
toValue = PercentLength.toDevicePixels(toValue, parentExtent, parentExtent) / screen.mainScreen.scale;
const nativeHeight: number = isVertical ? nativeView.getHeight() : nativeView.getWidth();
const targetStyle: string = setLocal ? extentProperty.name : extentProperty.keyframe;
originalValue1 = nativeHeight / platform.screen.mainScreen.scale;
originalValue1 = nativeHeight / screen.mainScreen.scale;
nativeArray[0] = originalValue1;
nativeArray[1] = toValue;
let extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray);

View File

@@ -8,8 +8,7 @@ import {
heightProperty, widthProperty, PercentLength
} from "../styling/style-properties";
import { ios } from "../../utils/utils";
import * as platform from "../../platform";
import { screen } from "../../platform";
export * from "./animation-common";
@@ -276,7 +275,7 @@ export class Animation extends AnimationBase {
let toValue = animation.value;
let fromValue;
const parent = animation.target.parent as View;
const screenScale: number = platform.screen.mainScreen.scale;
const screenScale: number = screen.mainScreen.scale;
let tempRotate = (animation.target.rotate || 0) * Math.PI / 180;
let abs;