mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
import { Background, ad as androidBackground } from '../../styling/background';
|
||||
import { profile } from '../../../profiling';
|
||||
import { topmost } from '../../frame/frame-stack';
|
||||
import { screen } from '../../../platform';
|
||||
import { Screen } from '../../../platform';
|
||||
import { AndroidActivityBackPressedEventData, android as androidApp } from '../../../application';
|
||||
import { Device } from '../../../platform';
|
||||
import lazy from '../../../utils/lazy';
|
||||
@@ -940,9 +940,7 @@ export class View extends ViewCommon {
|
||||
}
|
||||
|
||||
[perspectiveProperty.setNative](value: number) {
|
||||
const scale = screen.mainScreen.scale;
|
||||
const distance = value * scale;
|
||||
org.nativescript.widgets.ViewHelper.setPerspective(this.nativeViewProtected, float(distance));
|
||||
org.nativescript.widgets.ViewHelper.setPerspective(this.nativeViewProtected, float(value * Screen.mainScreen.scale));
|
||||
}
|
||||
|
||||
[scaleXProperty.setNative](value: number) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ImageAsset } from '../../image-asset';
|
||||
import { Length } from '../styling/style-properties';
|
||||
import { knownFolders } from '../../file-system';
|
||||
|
||||
import * as platform from '../../platform';
|
||||
import { Screen } from '../../platform';
|
||||
export * from './image-common';
|
||||
|
||||
const FILE_PREFIX = 'file:///';
|
||||
@@ -87,10 +87,8 @@ export class Image extends ImageBase {
|
||||
return;
|
||||
}
|
||||
|
||||
let screen = platform.screen.mainScreen;
|
||||
|
||||
let decodeWidth = Math.min(Length.toDevicePixels(this.decodeWidth, 0), screen.widthPixels);
|
||||
let decodeHeight = Math.min(Length.toDevicePixels(this.decodeHeight, 0), screen.heightPixels);
|
||||
let decodeWidth = Math.min(Length.toDevicePixels(this.decodeWidth, 0), Screen.mainScreen.widthPixels);
|
||||
let decodeHeight = Math.min(Length.toDevicePixels(this.decodeHeight, 0), Screen.mainScreen.heightPixels);
|
||||
let keepAspectRatio = this._calculateKeepAspectRatio();
|
||||
if (value instanceof ImageAsset) {
|
||||
if (value.options) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as transition from '.';
|
||||
import * as platform from '../../platform';
|
||||
import { Screen } from '../../platform';
|
||||
import lazy from '../../utils/lazy';
|
||||
|
||||
const screenWidth = lazy(() => platform.screen.mainScreen.widthPixels);
|
||||
const screenHeight = lazy(() => platform.screen.mainScreen.heightPixels);
|
||||
const screenWidth = lazy(() => Screen.mainScreen.widthPixels);
|
||||
const screenHeight = lazy(() => Screen.mainScreen.heightPixels);
|
||||
|
||||
export class SlideTransition extends transition.Transition {
|
||||
private _direction: string;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Transition } from '.';
|
||||
import { screen } from '../../platform';
|
||||
import { Screen } from '../../platform';
|
||||
|
||||
let screenWidth = screen.mainScreen.widthDIPs;
|
||||
let screenHeight = screen.mainScreen.heightDIPs;
|
||||
let leftEdge = CGAffineTransformMakeTranslation(-screenWidth, 0);
|
||||
let rightEdge = CGAffineTransformMakeTranslation(screenWidth, 0);
|
||||
let topEdge = CGAffineTransformMakeTranslation(0, -screenHeight);
|
||||
let bottomEdge = CGAffineTransformMakeTranslation(0, screenHeight);
|
||||
let leftEdge = CGAffineTransformMakeTranslation(-Screen.mainScreen.widthDIPs, 0);
|
||||
let rightEdge = CGAffineTransformMakeTranslation(Screen.mainScreen.widthDIPs, 0);
|
||||
let topEdge = CGAffineTransformMakeTranslation(0, -Screen.mainScreen.heightDIPs);
|
||||
let bottomEdge = CGAffineTransformMakeTranslation(0, Screen.mainScreen.heightDIPs);
|
||||
|
||||
export class SlideTransition extends Transition {
|
||||
private _direction: string;
|
||||
|
||||
Reference in New Issue
Block a user