mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: refactor
This commit is contained in:
@@ -184,15 +184,6 @@ export function install() {
|
|||||||
registerOnGlobalContext("Headers", "fetch");
|
registerOnGlobalContext("Headers", "fetch");
|
||||||
registerOnGlobalContext("Request", "fetch");
|
registerOnGlobalContext("Request", "fetch");
|
||||||
registerOnGlobalContext("Response", "fetch");
|
registerOnGlobalContext("Response", "fetch");
|
||||||
|
|
||||||
// check whether the 'android' namespace is exposed
|
|
||||||
// if positive - the current device is an Android
|
|
||||||
// so a custom implementation of the global 'console' object is attached.
|
|
||||||
// otherwise do nothing on iOS - the NS runtime provides a native 'console' functionality.
|
|
||||||
if ((<any>global).android) {
|
|
||||||
const consoleModule = require("console");
|
|
||||||
(<any>global).console = new consoleModule.Console();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
install();
|
install();
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ import {
|
|||||||
} from "../styling/style-properties";
|
} from "../styling/style-properties";
|
||||||
|
|
||||||
import { layout } from "../../utils/utils";
|
import { layout } from "../../utils/utils";
|
||||||
import { device } from "../../platform";
|
import { device, screen } from "../../platform";
|
||||||
import lazy from "../../utils/lazy";
|
import lazy from "../../utils/lazy";
|
||||||
import * as platform from "../../platform";
|
|
||||||
export * from "./animation-common";
|
export * from "./animation-common";
|
||||||
|
|
||||||
interface AnimationDefinitionInternal extends AnimationDefinition {
|
interface AnimationDefinitionInternal extends AnimationDefinition {
|
||||||
@@ -467,10 +466,10 @@ export class Animation extends AnimationBase {
|
|||||||
throw new Error(`cannot animate ${propertyAnimation.property} on root view`);
|
throw new Error(`cannot animate ${propertyAnimation.property} on root view`);
|
||||||
}
|
}
|
||||||
const parentExtent: number = isVertical ? parent.getMeasuredHeight() : parent.getMeasuredWidth();
|
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 nativeHeight: number = isVertical ? nativeView.getHeight() : nativeView.getWidth();
|
||||||
const targetStyle: string = setLocal ? extentProperty.name : extentProperty.keyframe;
|
const targetStyle: string = setLocal ? extentProperty.name : extentProperty.keyframe;
|
||||||
originalValue1 = nativeHeight / platform.screen.mainScreen.scale;
|
originalValue1 = nativeHeight / screen.mainScreen.scale;
|
||||||
nativeArray[0] = originalValue1;
|
nativeArray[0] = originalValue1;
|
||||||
nativeArray[1] = toValue;
|
nativeArray[1] = toValue;
|
||||||
let extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray);
|
let extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray);
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import {
|
|||||||
heightProperty, widthProperty, PercentLength
|
heightProperty, widthProperty, PercentLength
|
||||||
} from "../styling/style-properties";
|
} from "../styling/style-properties";
|
||||||
|
|
||||||
import { ios } from "../../utils/utils";
|
import { screen } from "../../platform";
|
||||||
import * as platform from "../../platform";
|
|
||||||
|
|
||||||
export * from "./animation-common";
|
export * from "./animation-common";
|
||||||
|
|
||||||
@@ -276,7 +275,7 @@ export class Animation extends AnimationBase {
|
|||||||
let toValue = animation.value;
|
let toValue = animation.value;
|
||||||
let fromValue;
|
let fromValue;
|
||||||
const parent = animation.target.parent as View;
|
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 tempRotate = (animation.target.rotate || 0) * Math.PI / 180;
|
||||||
let abs;
|
let abs;
|
||||||
|
|||||||
Reference in New Issue
Block a user